From a3715c7948d1421374533941e6566ee044aac54b Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Mon, 17 Jun 2024 14:07:49 +0200 Subject: [PATCH 1/6] [CI] Prepare workflow for `argilla-v1` - 1.29.0 (#5032) This PR reviews the `argilla-v1` release job and modifies the execution conditions. In general (and this will apply to all the projects): - Each project will release when merging changes to `main` (if paths config detects project changes) - The project release won't create a repo status. This tag must be created from the `main` branch. --- .github/workflows/argilla-v1.yml | 38 +++++++++++++++++---------- argilla-v1/src/argilla_v1/_version.py | 2 +- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index c6db82e697..f2b3e7dd76 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -6,7 +6,6 @@ concurrency: on: workflow_dispatch: - workflow_call: push: paths: @@ -102,37 +101,48 @@ jobs: 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' + + permissions: + # This permission is needed for private repositories. + # contents: read + # IMPORTANT: this permission is mandatory for trusted publishing on PyPI + id-token: write + # This permission is needed for creating tags + contents: write needs: - build - defaults: - run: - shell: bash -l {0} - working-directory: argilla-v1 - steps: - name: Checkout Code 🛎 uses: actions/checkout@v4 + - name: Download python package uses: actions/download-artifact@v4 with: name: argilla-v1 path: dist + + - name: Read package info + run: | + pip install --no-deps dist/*.whl + PACKAGE_VERSION=$(python -c 'from importlib.metadata import version; print(version("argilla-v1"))') + PACKAGE_NAME=argilla-v1 + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV + echo "$PACKAGE_NAME==$PACKAGE_VERSION" + - name: Publish Package to TestPyPI 🥪 uses: pypa/gh-action-pypi-publish@release/v1 continue-on-error: true with: - user: __token__ - password: ${{ secrets.AR_TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ + - name: Test Installing 🍿 continue-on-error: true - run: pip install --index-url https://test.pypi.org/simple --no-deps argilla==${GITHUB_REF#refs/*/v} + run: pip install --upgrade --no-deps --force-reinstall --index-url https://test.pypi.org/simple $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 + if: github.ref == 'refs/heads/main' uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.AR_PYPI_API_TOKEN }} diff --git a/argilla-v1/src/argilla_v1/_version.py b/argilla-v1/src/argilla_v1/_version.py index 0be5545ddf..c677226355 100644 --- a/argilla-v1/src/argilla_v1/_version.py +++ b/argilla-v1/src/argilla_v1/_version.py @@ -13,4 +13,4 @@ # limitations under the License. # coding: utf-8 -version = "1.29.0-alpha.1" +version = "1.29.0-alpha0" From fd0dfff9dfbff227479119c25f8c01bc1a110d0b Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Mon, 17 Jun 2024 17:10:10 +0200 Subject: [PATCH 2/6] [CI] Prepare `argilla` release job (#5037) This PR reviews the `argilla.yml` workflow and prepares the job for the package release. A successful execution using as stable branch `releases/stable` https://github.com/argilla-io/argilla/actions/runs/9548888112/job/26317320004 --- .github/workflows/argilla.yml | 28 ++++++++++----------------- argilla/pdm.lock | 34 ++++++++++++++++----------------- argilla/pyproject.toml | 3 ++- argilla/src/argilla/__init__.py | 2 +- 4 files changed, 30 insertions(+), 37 deletions(-) diff --git a/.github/workflows/argilla.yml b/.github/workflows/argilla.yml index 5b0bfe4845..4a7e98f4f4 100644 --- a/.github/workflows/argilla.yml +++ b/.github/workflows/argilla.yml @@ -8,10 +8,6 @@ concurrency: on: workflow_dispatch: - inputs: - release: - description: "If true, the workflow will publish the package to PyPI. Default is false." - default: false push: paths: @@ -28,10 +24,6 @@ on: - argilla/** - "!argilla/docs/**" -defaults: - run: - working-directory: argilla - jobs: build: services: @@ -46,6 +38,9 @@ jobs: ADMIN_USERNAME: admin ADMIN_API_KEY: admin.apikey runs-on: ubuntu-latest + defaults: + run: + working-directory: argilla strategy: fail-fast: false matrix: @@ -58,7 +53,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: true cache-dependency-path: | - argilla/pyproject.toml + argilla/pdm.lock - name: Install dependencies run: | pdm install @@ -86,7 +81,7 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' + if: github.ref == 'refs/heads/main' || ${{ github.event_name }} == 'workflow_dispatch' needs: - build @@ -101,6 +96,7 @@ jobs: defaults: run: shell: bash -l {0} + working-directory: argilla steps: - name: Checkout Code 🛎 @@ -116,6 +112,9 @@ jobs: uses: pdm-project/setup-pdm@v4 with: cache: true + python-version-file: argilla/pyproject.toml + cache-dependency-path: | + argilla/pdm.lock - name: Read package info run: | @@ -125,13 +124,6 @@ jobs: echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV echo "$PACKAGE_NAME==$PACKAGE_VERSION" - - name: Create tag - run: | - git config user.name "${{ github.actor }}" - git config user.email "${{ github.actor }}@users.noreply.github.com" - git tag -f -a v${{ env.PACKAGE_VERSION }} -m "Release v${{ env.PACKAGE_VERSION }}" - git push -f origin v${{ env.PACKAGE_VERSION }} - - name: Publish Package to PyPI test environment 🥪 run: pdm publish --no-build --repository testpypi continue-on-error: true @@ -141,5 +133,5 @@ jobs: pip install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION - name: Publish Package to PyPI 🥩 - if: ${{ inputs.release == 'true' }} + if: github.ref == 'refs/heads/main' run: pdm publish --no-build diff --git a/argilla/pdm.lock b/argilla/pdm.lock index a4c1dbae00..0f22c0b9c9 100644 --- a/argilla/pdm.lock +++ b/argilla/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["cross_platform", "inherit_metadata"] lock_version = "4.4.1" -content_hash = "sha256:21d1388229fea007d4f9ba997b02c37cb792ec71e7efb00d02b4c1864560ba38" +content_hash = "sha256:a941796b5f600d43fa2ce12600fb3737618867160ac4ea70f0facb61f3b1ed0c" [[package]] name = "aiohttp" @@ -89,7 +89,7 @@ name = "annotated-types" version = "0.7.0" requires_python = ">=3.8" summary = "Reusable constraint types to use with typing.Annotated" -groups = ["default"] +groups = ["default", "dev"] files = [ {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, @@ -114,11 +114,11 @@ files = [ [[package]] name = "argilla-v1" -version = "1.29.0a1" +version = "1.29.0a0" requires_python = "<3.13,>=3.8" path = "../argilla-v1" summary = "Open-source tool for exploring, labeling, and monitoring data for NLP projects." -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "backoff", "deprecated~=1.2.0", @@ -136,12 +136,12 @@ dependencies = [ [[package]] name = "argilla-v1" -version = "1.29.0a1" +version = "1.29.0a0" extras = ["listeners"] requires_python = "<3.13,>=3.8" path = "../argilla-v1" summary = "Open-source tool for exploring, labeling, and monitoring data for NLP projects." -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "argilla-v1 @ file:///${PROJECT_ROOT}/../argilla-v1", "schedule~=1.1.0", @@ -199,7 +199,7 @@ name = "backoff" version = "2.2.1" requires_python = ">=3.7,<4.0" summary = "Function decoration for backoff and retry" -groups = ["default"] +groups = ["default", "dev"] files = [ {file = "backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8"}, {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, @@ -535,7 +535,7 @@ name = "deprecated" version = "1.2.14" requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" summary = "Python @deprecated decorator to deprecate old python classes, functions or methods." -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "wrapt<2,>=1.10", ] @@ -1036,7 +1036,7 @@ name = "markdown-it-py" version = "3.0.0" requires_python = ">=3.8" summary = "Python port of markdown-it. Markdown parsing, done right!" -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "mdurl~=0.1", ] @@ -1115,7 +1115,7 @@ name = "mdurl" version = "0.1.2" requires_python = ">=3.7" summary = "Markdown URL utilities" -groups = ["default"] +groups = ["default", "dev"] files = [ {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, @@ -1388,7 +1388,7 @@ files = [ name = "monotonic" version = "1.6" summary = "An implementation of time.monotonic() for Python 2 & < 3.3" -groups = ["default"] +groups = ["default", "dev"] files = [ {file = "monotonic-1.6-py2.py3-none-any.whl", hash = "sha256:68687e19a14f11f26d140dd5c86f3dba4bf5df58003000ed467e0e2a69bca96c"}, {file = "monotonic-1.6.tar.gz", hash = "sha256:3a55207bcfed53ddd5c5bae174524062935efed17792e9de2ad0205ce9ad63f7"}, @@ -1903,7 +1903,7 @@ name = "pydantic" version = "2.7.4" requires_python = ">=3.8" summary = "Data validation using Python type hints" -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "annotated-types>=0.4.0", "pydantic-core==2.18.4", @@ -1919,7 +1919,7 @@ name = "pydantic-core" version = "2.18.4" requires_python = ">=3.8" summary = "Core functionality for Pydantic validation and serialization" -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "typing-extensions!=4.7.0,>=4.6.0", ] @@ -2338,7 +2338,7 @@ name = "rich" version = "13.7.1" requires_python = ">=3.7.0" summary = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "markdown-it-py>=2.2.0", "pygments<3.0.0,>=2.13.0", @@ -2461,7 +2461,7 @@ name = "schedule" version = "1.1.0" requires_python = ">=3.6" summary = "Job scheduling for humans." -groups = ["default"] +groups = ["default", "dev"] files = [ {file = "schedule-1.1.0-py2.py3-none-any.whl", hash = "sha256:617adce8b4bf38c360b781297d59918fbebfb2878f1671d189f4f4af5d0567a4"}, {file = "schedule-1.1.0.tar.gz", hash = "sha256:e6ca13585e62c810e13a08682e0a6a8ad245372e376ba2b8679294f377dfc8e4"}, @@ -2602,7 +2602,7 @@ name = "typer" version = "0.9.4" requires_python = ">=3.6" summary = "Typer, build great CLIs. Easy to code. Based on Python type hints." -groups = ["default"] +groups = ["default", "dev"] dependencies = [ "click<9.0.0,>=7.1.1", "typing-extensions>=3.7.4.3", @@ -2731,7 +2731,7 @@ name = "wrapt" version = "1.14.1" requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" summary = "Module for decorators, wrappers and monkey patching." -groups = ["default"] +groups = ["default", "dev"] files = [ {file = "wrapt-1.14.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:80bb5c256f1415f747011dc3604b59bc1f91c6e7150bd7db03b19170ee06b320"}, {file = "wrapt-1.14.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:07f7a7d0f388028b2df1d916e94bbb40624c59b48ecc6cbc232546706fac74c2"}, diff --git a/argilla/pyproject.toml b/argilla/pyproject.toml index b57eda2830..83880b564b 100644 --- a/argilla/pyproject.toml +++ b/argilla/pyproject.toml @@ -13,7 +13,7 @@ dynamic = ["version"] dependencies = [ "httpx>=0.26.0", "pydantic>=2.6.0, <3.0.0", - "argilla-v1[listeners] @ file:///${PROJECT_ROOT}/../argilla-v1", + "argilla-v1[listeners]" ] [project.optional-dependencies] @@ -60,6 +60,7 @@ dev = [ "CairoSVG >= 2.7.1", "mknotebooks >= 0.8.0", "datasets>=2.19.1", + "argilla-v1[listeners] @ file:///${PROJECT_ROOT}/../argilla-v1", ] [tool.pdm.scripts] diff --git a/argilla/src/argilla/__init__.py b/argilla/src/argilla/__init__.py index 7b2e325318..3faaed0386 100644 --- a/argilla/src/argilla/__init__.py +++ b/argilla/src/argilla/__init__.py @@ -23,4 +23,4 @@ from argilla.vectors import * # noqa -__version__ = "2.0.0a0.dev0" +__version__ = "2.0.0-alpha0" From 762a1bffe3dd3f129fdde9d800dd1b791831bd95 Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Tue, 18 Jun 2024 13:25:17 +0200 Subject: [PATCH 3/6] [CI] Prepare the`argilla-server` package release (#5039) Reviewing server build and release workflow. - Simplify docker image generation - Set image version from package version for releases - Align the release job with other workflows. An example of successful action https://github.com/argilla-io/argilla/actions/runs/9560262017 --- .../argilla-server.build-docker-image.yml | 105 ------------- .../argilla-server.build-docker-images.yml | 141 ++++++++++++++++++ .github/workflows/argilla-server.yml | 62 ++++---- argilla-server/src/argilla_server/_version.py | 2 +- 4 files changed, 171 insertions(+), 139 deletions(-) delete mode 100644 .github/workflows/argilla-server.build-docker-image.yml create mode 100644 .github/workflows/argilla-server.build-docker-images.yml diff --git a/.github/workflows/argilla-server.build-docker-image.yml b/.github/workflows/argilla-server.build-docker-image.yml deleted file mode 100644 index d49d6471d2..0000000000 --- a/.github/workflows/argilla-server.build-docker-image.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build Argilla server docker image - -on: - workflow_call: - inputs: - download-python-package: - description: "True if python package should be downloaded" - type: boolean - default: false - image-name: - description: "Name of the image to build" - required: true - type: string - dockerfile: - description: "Path to the Dockerfile to build" - required: true - type: string - context: - description: "Dockerfile build context" - required: true - type: string - platforms: - description: "Platforms to build for" - required: true - type: string - build-args: - description: "Build arguments" - required: false - type: string - default: "" - readme: - description: "Path to the README file" - required: false - type: string - default: "README.md" - outputs: - version: - description: "Version of the Docker image" - value: ${{ jobs.build.outputs.version }} - -jobs: - build: - name: Build Docker image - runs-on: ubuntu-latest - outputs: - version: ${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }} - steps: - - uses: actions/checkout@v4 - - - name: Download python package - uses: actions/download-artifact@v4 - if: ${{ inputs.download-python-package }} - with: - name: argilla-server - path: ${{ inputs.context }}/dist - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Get Docker image tag from GITHUB_REF - id: docker-image-tag-from-ref - uses: ./.github/actions/docker-image-tag-from-ref - - - name: Generate Docker tags - id: generate-docker-tags - run: | - DOCKER_HUB_TAGS="$IMAGE_NAME:$DOCKER_IMAGE_TAG" - - if [[ $GITHUB_REF == refs/tags/* ]]; then - DOCKER_HUB_TAGS="$DOCKER_HUB_TAGS,$IMAGE_NAME:latest" - fi - - echo "tags=$DOCKER_HUB_TAGS" >> $GITHUB_OUTPUT - env: - IMAGE_NAME: ${{ inputs.image-name }} - DOCKER_IMAGE_TAG: ${{ steps.docker-image-tag-from-ref.outputs.docker-image-tag }} - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.AR_DOCKER_USERNAME }} - password: ${{ secrets.AR_DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: ${{ inputs.context }} - file: ${{ inputs.dockerfile }} - platforms: ${{ inputs.platforms }} - tags: ${{ steps.generate-docker-tags.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - build-args: ${{ inputs.build-args }} - push: true - - - name: Docker Hub Description - uses: peter-evans/dockerhub-description@v4 - if: github.event_name == 'release' - with: - username: ${{ secrets.AR_DOCKER_USERNAME }} - password: ${{ secrets.AR_DOCKER_PASSWORD }} - repository: ${{ inputs.image-name }} - readme-filepath: ${{ inputs.readme }} diff --git a/.github/workflows/argilla-server.build-docker-images.yml b/.github/workflows/argilla-server.build-docker-images.yml new file mode 100644 index 0000000000..028e2db095 --- /dev/null +++ b/.github/workflows/argilla-server.build-docker-images.yml @@ -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 diff --git a/.github/workflows/argilla-server.yml b/.github/workflows/argilla-server.yml index e0af03f1fa..909f21074e 100644 --- a/.github/workflows/argilla-server.yml +++ b/.github/workflows/argilla-server.yml @@ -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/** @@ -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 @@ -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. @@ -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 diff --git a/argilla-server/src/argilla_server/_version.py b/argilla-server/src/argilla_server/_version.py index 0f4e84ce92..f2bedea2c6 100644 --- a/argilla-server/src/argilla_server/_version.py +++ b/argilla-server/src/argilla_server/_version.py @@ -13,4 +13,4 @@ # limitations under the License. # coding: utf-8 -__version__ = "2.0.0-dev" +__version__ = "2.0.0-alpha0" From 5ef4a8cf7b4afbc8fcfa1d2ecc6801a306816ef4 Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Wed, 19 Jun 2024 13:11:30 +0200 Subject: [PATCH 4/6] [CI] docs: Configure docs publish for releases (#5047) This PR reviews the workflow for publishing docs: - A merge to the `main` (release/stable branch) will deploy docs `latest` version. - A tag creation (tag pattern = v*) will deploy `vX.Y.Z` version. (we can iterate on this and keep just the minor version) --- .github/workflows/argilla.docs.yml | 41 +++++++++++++----------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/.github/workflows/argilla.docs.yml b/.github/workflows/argilla.docs.yml index c171ab253f..d07b65c101 100644 --- a/.github/workflows/argilla.docs.yml +++ b/.github/workflows/argilla.docs.yml @@ -6,14 +6,16 @@ concurrency: on: push: + tags: + - "v*" paths: - "argilla/docs/**" - "argilla/src/**" + - "argilla/mkdocs.yml" branches: - # - "main" - # - "develop" + - "main" + - "develop" - "feat/v2.0.0" # Fixing this branch until we merge everything into develop - - "docs/**" # When we create a new branch only for docs defaults: run: @@ -22,10 +24,10 @@ defaults: jobs: publish: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.10"] + + env: + GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} + steps: - name: checkout docs-site uses: actions/checkout@v4 @@ -37,10 +39,10 @@ jobs: - name: Setup Python uses: pdm-project/setup-pdm@v4 with: - python-version: ${{ matrix.python-version }} + python-version: "3.10" cache: true cache-dependency-path: | - argilla/pyproject.toml + argilla/pdm.lock - name: Install dependencies run: | @@ -55,23 +57,14 @@ jobs: run: echo "${{ github.ref }}" echo "${{ github.head_ref }}" + - run: | + pdm run mike deploy latest --push + pdm run mike set-default latest + if: github.ref == 'refs/heads/main' + - run: pdm run mike deploy dev --push if: github.ref == 'refs/heads/feat/v2.0.0' # if: github.ref == 'refs/heads/develop' - env: - GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} - - run: pdm run mike deploy ${{ github.ref_name }} latest --update-aliases --push + - run: pdm run mike deploy ${{ github.ref_name }} if: startsWith(github.ref, 'refs/tags/') - env: - GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} - - - name: Extract branch name - shell: bash - run: echo "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's/\//_/g' >> $GITHUB_OUTPUT - id: extract_branch_name - - - run: pdm run mike deploy ${{ steps.extract_branch_name.outputs.branch_name }} --push - if: startsWith(github.ref, 'refs/heads/docs') || startsWith(github.head_ref, 'docs/') - env: - GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} From b0b243419d43b83411bd90681cf5438dd0c0d58c Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Wed, 19 Jun 2024 15:28:28 +0200 Subject: [PATCH 5/6] [CI] Point dev version for docs to develop branch (#5060) NOTE: This PR will be merged when `feat/v2.0.0` is ready to integrate into `develop` The change include here is just pointing to the `develop` branch to build the `dev` version of docs. --- .github/workflows/argilla.docs.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/argilla.docs.yml b/.github/workflows/argilla.docs.yml index d07b65c101..619d072598 100644 --- a/.github/workflows/argilla.docs.yml +++ b/.github/workflows/argilla.docs.yml @@ -15,7 +15,6 @@ on: branches: - "main" - "develop" - - "feat/v2.0.0" # Fixing this branch until we merge everything into develop defaults: run: @@ -63,8 +62,7 @@ jobs: if: github.ref == 'refs/heads/main' - run: pdm run mike deploy dev --push - if: github.ref == 'refs/heads/feat/v2.0.0' - # if: github.ref == 'refs/heads/develop' + if: github.ref == 'refs/heads/develop' - run: pdm run mike deploy ${{ github.ref_name }} if: startsWith(github.ref, 'refs/tags/') From 03c1b2865166d66b23f4c126d89afcf7e85c76ef Mon Sep 17 00:00:00 2001 From: Paco Aranda Date: Wed, 19 Jun 2024 15:36:34 +0200 Subject: [PATCH 6/6] [BUGFIX] ci: Define conditions to publish the release properly (#5061) Otherwise, the release job will be executed each time. --- .github/workflows/argilla-v1.yml | 2 +- .github/workflows/argilla.yml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/argilla-v1.yml b/.github/workflows/argilla-v1.yml index f2b3e7dd76..62df3dba5e 100644 --- a/.github/workflows/argilla-v1.yml +++ b/.github/workflows/argilla-v1.yml @@ -101,7 +101,7 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || ${{ github.event_name }} == 'workflow_dispatch' + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }} permissions: # This permission is needed for private repositories. diff --git a/.github/workflows/argilla.yml b/.github/workflows/argilla.yml index 4a7e98f4f4..c129584e9c 100644 --- a/.github/workflows/argilla.yml +++ b/.github/workflows/argilla.yml @@ -81,9 +81,7 @@ jobs: publish_release: name: Publish Release runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || ${{ github.event_name }} == 'workflow_dispatch' - needs: - - build + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }} permissions: # This permission is needed for private repositories. @@ -93,6 +91,9 @@ jobs: # This permission is needed for creating tags contents: write + needs: + - build + defaults: run: shell: bash -l {0}