[RELEASES] v2.5.0 #2500
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish the `argilla` sdk python package | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
- releases/** | |
pull_request: | |
paths: | |
- "argilla/**" | |
permissions: | |
id-token: write | |
jobs: | |
build: | |
services: | |
argilla-server: | |
image: argilladev/argilla-hf-spaces:develop | |
ports: | |
- 6900:6900 | |
env: | |
ARGILLA_ENABLE_TELEMETRY: 0 | |
# Set credentials | |
USERNAME: argilla | |
PASSWORD: 12345678 | |
API_KEY: argilla.apikey | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: argilla | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: true | |
cache-dependency-path: | | |
argilla/pdm.lock | |
- name: Install dependencies | |
run: | | |
pdm install | |
- name: Wait for argilla server to start | |
run: | | |
while ! curl -XGET http://localhost:6900/api/_status; do sleep 5; done | |
- name: Set huggingface hub credentials | |
run: | | |
echo "HF_TOKEN_ARGILLA_INTERNAL_TESTING=${{ secrets.HF_TOKEN_ARGILLA_INTERNAL_TESTING }}" >> "$GITHUB_ENV" | |
echo "Enable HF access token" | |
- name: Run unit tests | |
run: | | |
pdm run test tests/unit | |
- name: Run integration tests | |
run: | | |
pdm run test tests/integration | |
- name: Build package | |
run: | | |
pdm build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
# Upload the package to be used in the next jobs only once | |
if: ${{ matrix.python-version == '3.9' }} | |
with: | |
name: argilla | |
path: argilla/dist | |
# This job will publish argilla package into PyPI repository | |
publish_release: | |
name: Publish Release | |
runs-on: ubuntu-latest | |
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 | |
needs: | |
- build | |
defaults: | |
run: | |
shell: bash -l {0} | |
working-directory: argilla | |
steps: | |
- name: Checkout Code 🛎 | |
uses: actions/checkout@v4 | |
- name: Download python package | |
uses: actions/download-artifact@v4 | |
with: | |
name: argilla | |
path: argilla/dist | |
- name: Setup PDM | |
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: | | |
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 🥪 | |
run: pdm publish --no-build --repository testpypi | |
continue-on-error: true | |
- name: Test Installing 🍿 | |
continue-on-error: true | |
run: | | |
pip3 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 |