Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/v2.0.0' into docs/docs-text…
Browse files Browse the repository at this point in the history
…cat-tutorial
  • Loading branch information
sdiazlor committed Jun 19, 2024
2 parents a78e95c + 03c1b28 commit 47e3e3d
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 221 deletions.
105 changes: 0 additions & 105 deletions .github/workflows/argilla-server.build-docker-image.yml

This file was deleted.

141 changes: 141 additions & 0 deletions .github/workflows/argilla-server.build-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Build Argilla server docker images

on:
workflow_call:
inputs:
is_release:
description: "True if the images should be built for release"
required: true
type: boolean

publish_latest:
description: "True if the images should be published as latest"
required: true
type: boolean

jobs:
build:
name: Build Argilla server docker images
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version-file: argilla-server/pyproject.toml
cache-dependency-path: argilla-server/pdm.lock
cache: true

- name: Read package info
id: package-info
working-directory: argilla-server
run: |
PACKAGE_VERSION=$(pdm show --version)
PACKAGE_NAME=$(pdm show --name)
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo "$PACKAGE_NAME==$PACKAGE_VERSION"
- name: Get Docker image tag from GITHUB_REF
if: ${{ !inputs.is_release }}
id: docker-image-tag-from-ref
uses: ./.github/actions/docker-image-tag-from-ref

- name: Setup environment variables
run: |
if [[ $IS_RELEASE == true ]]; then
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
echo "IMAGE_TAG=v$PACKAGE_VERSION" >> $GITHUB_ENV
else
echo "PLATFORMS=linux/amd64" >> $GITHUB_ENV
echo "IMAGE_TAG=$DOCKER_IMAGE_TAG" >> $GITHUB_ENV
fi
env:
IS_RELEASE: ${{ inputs.is_release }}
PACKAGE_VERSION: ${{ steps.package-info.outputs.PACKAGE_VERSION }}
DOCKER_IMAGE_TAG: ${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }}

- name: Set up QEMU
if: ${{ inputs.is_release }}
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}

- name: Download python package
uses: actions/download-artifact@v4
with:
name: argilla-server
path: argilla-server/docker/server/dist

- name: Build and push `argilla-server` image
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/server
file: argilla-server/docker/server/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-server:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: Push latest `argilla-server` image
if: ${{ inputs.is_release && inputs.publish_latest }}
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/server
file: argilla-server/docker/server/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-server:latest
labels: ${{ steps.meta.outputs.labels }}
push: true

- name: Build and push `argilla-quickstart` image
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/quickstart
file: argilla-server/docker/quickstart/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-quickstart:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARGILLA_VERSION=${{ env.IMAGE_TAG }}
push: true

- name: Push latest `argilla-quickstart` image
if: ${{ inputs.is_release && inputs.publish_latest }}
uses: docker/build-push-action@v5
with:
context: argilla-server/docker/quickstart
file: argilla-server/docker/quickstart/Dockerfile
platforms: ${{ env.PLATFORMS }}
tags: argilla/argilla-quickstart:latest
labels: ${{ steps.meta.outputs.labels }}
build-args: |
ARGILLA_VERSION=${{ env.IMAGE_TAG }}
push: true

- name: Docker Hub Description for `argilla-server`
uses: peter-evans/dockerhub-description@v4
if: ${{ inputs.is_release && inputs.publish_latest }}
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}
repository: argilla/argilla-server
readme-filepath: argilla-server/README.md

- name: Docker Hub Description for `argilla-quickstart`
uses: peter-evans/dockerhub-description@v4
if: ${{ inputs.is_release && inputs.publish_latest }}
with:
username: ${{ secrets.AR_DOCKER_USERNAME }}
password: ${{ secrets.AR_DOCKER_PASSWORD }}
repository: argilla/argilla-quickstart
readme-filepath: argilla-server/docker/quickstart/README.md
62 changes: 29 additions & 33 deletions .github/workflows/argilla-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}
working-directory: argilla-server

on:
workflow_dispatch:

push:
paths:
- argilla-server/**
Expand All @@ -29,6 +25,11 @@ jobs:
name: Build `argilla-server` package
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}
working-directory: argilla-server

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
Expand Down Expand Up @@ -111,45 +112,30 @@ jobs:
name: argilla-server
path: argilla-server/dist

build_server_docker_image:
name: Build Argilla server docker image
uses: ./.github/workflows/argilla-server.build-docker-image.yml
build_docker_images:
name: Build docker images
uses: ./.github/workflows/argilla-server.build-docker-images.yml
needs:
- build
with:
download-python-package: true
image-name: argilla/argilla-server
dockerfile: argilla-server/docker/server/Dockerfile
context: argilla-server/docker/server
readme: argilla-server/README.md
platforms: linux/amd64,linux/arm64
secrets: inherit

build_quickstart_docker_image:
name: Build Argilla quickstart docker image
uses: ./.github/workflows/argilla-server.build-docker-image.yml
needs: build_server_docker_image
with:
download-python-package: false
image-name: argilla/argilla-quickstart
dockerfile: argilla-server/docker/quickstart/Dockerfile
context: argilla-server/docker/quickstart
readme: argilla-server/docker/quickstart/README.md
platforms: linux/amd64,linux/arm64
build-args: |
ARGILLA_VERSION=${{ needs.build_server_docker_image.outputs.version }}
is_release: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
publish_latest: false
secrets: inherit

# This job will publish argilla-server python package into PyPI repository
publish_release:
name: Publish Release
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}

needs:
- build
- build_server_docker_image
- build_quickstart_docker_image
- build_docker_images

defaults:
run:
shell: bash -l {0}
working-directory: argilla-server

permissions:
# This permission is needed for private repositories.
Expand All @@ -174,14 +160,24 @@ jobs:
cache-dependency-path: argilla-server/pdm.lock
cache: true

- name: Read package info
run: |
PACKAGE_VERSION=$(pdm show --version)
PACKAGE_NAME=$(pdm show --name)
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
echo "$PACKAGE_NAME==$PACKAGE_VERSION"
- name: Publish Package to PyPI test environment 🥪
continue-on-error: true
run: |
pdm publish --no-build --repository testpypi
- name: Test Installing 🍿
run: |
pip install --index-url https://test.pypi.org/simple --no-deps argilla-server==${GITHUB_REF#refs/*/v}
pip install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION
- name: Publish Package to PyPI 🥩
if: github.ref == 'refs/heads/main'
run: |
pdm publish --no-build
Loading

0 comments on commit 47e3e3d

Please sign in to comment.