-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Define a clean workflow for argilla-server
- Loading branch information
1 parent
23ffc5f
commit 18bfffb
Showing
15 changed files
with
218 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
name: Build `argilla-server` package | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
paths: | ||
- 'argilla-server/**' | ||
types: | ||
- opened | ||
- edited | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build `argilla-server` package | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
working-directory: ./argilla-server | ||
|
||
services: | ||
search_engine: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2 | ||
ports: | ||
- 9200:9200 | ||
env: | ||
discovery.type: single-node | ||
xpack.security.enabled: false | ||
# NOTE: postgres service will not be executed by default. | ||
# It will only be executed if the postgresDockerImage input is provided. | ||
postgres: | ||
image: postgres:14 | ||
env: | ||
POSTGRES_HOST: localhost | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: argilla | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
env: | ||
ARGILLA_ENABLE_TELEMETRY: 0 | ||
|
||
steps: | ||
- name: Checkout Code 🛎 | ||
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: Install dependencies | ||
run: pdm install | ||
|
||
- name: Run tests 📈 | ||
run: | | ||
ARGILLA_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/argilla | ||
pdm test tests/unit -vs --cov=argilla_server --cov-report=xml:coverage.xml | ||
- name: Upload test coverage | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
file: coverage.xml | ||
|
||
- name: Build package | ||
run: | | ||
pdm build | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: argilla-server | ||
path: argilla-server/dist | ||
|
||
build_server_docker_image: | ||
name: Build Argilla server docker image | ||
uses: ./.github/workflows/argilla-server.build-push-docker.yml | ||
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | ||
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-push-docker.yml | ||
needs: build_server_docker_image | ||
if: github.event_name == 'pull_request' && github.event.pull_request.draft == false | ||
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 }} | ||
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' }} | ||
|
||
needs: | ||
- build | ||
- build_server_docker_image | ||
- build_quickstart_docker_image | ||
|
||
permissions: | ||
# This permission is needed for private repositories. | ||
# contents: read | ||
# IMPORTANT: this permission is mandatory for trusted publishing on PyPI | ||
id-token: write | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
working-directory: ./argilla-server | ||
|
||
steps: | ||
- name: Checkout Code 🛎 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download python package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: argilla-server | ||
path: argilla-server/dist | ||
|
||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v4 | ||
with: | ||
cache: true | ||
|
||
- name: Publish Package to PyPI test environment 🥪 | ||
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} | ||
|
||
- name: Publish Package to PyPI 🥩 | ||
run: pdm publish --no-build |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2021-present, the Recognai S.L. team. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
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
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
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
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
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
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
Oops, something went wrong.