-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The mono repo structure will divide the argilla repository into different folders, each one containing a different part of the project. The `.github/workflows` folder will contain the different workflows for each part of the project because of the limitation of GitHub Actions to have only one workflow folder per repository. The `docs` (or `argilla-docs`) folder will contain the documentation for the whole project. The rest of the folders will contain the different parts of the project, such as the SDK, the frontend, and the server. Each part of the project will have its own `CHANGELOG.md` file and its own `README.md` file. Contribution guidelines will be in the `CONTRIBUTING.md` file and the code of conduct will be in the `CODE_OF_CONDUCT.md` file. A example of the project structure would be: ``` - .github/workflows/ |_ argilla.yml # test + build argilla |_ argilla-frontend.yml # test + build argilla-frontend |_ argilla-server.yml # test + build argilla-server ... - argilla-sdk/ # -> V2 |_ CHANGELOG.md |_ README.md |_ src/ |_ tests/ ... - argilla/ # -> V1 |_ CHANGELOG.md |_ README.md |_ src/ |_ tests/ ... - argilla-frontend/ |_ CHANGELOG.md |_ README.md |_ package.json |_ nuxt.config.ts ... - argilla-server/ |_ CHANGELOG.md |_ README.md |_ src/ |_ tests/ ... - docs/ ... - CONTRIBUTING.md - CODE_OF_CONDUCT.md ... ``` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: José Francisco Calvo <[email protected]> Co-authored-by: Natalia Elvira <[email protected]> Co-authored-by: José Francisco Calvo <[email protected]>
- Loading branch information
1 parent
a9f2845
commit 66bebda
Showing
2,355 changed files
with
62,464 additions
and
776 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
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,87 @@ | ||
name: Build Argilla frontend package | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
|
||
workflow_call: | ||
|
||
pull_request: | ||
paths: | ||
- "argilla-frontend/**" | ||
types: | ||
- opened | ||
- edited | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build argilla-frontend | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: argilla-frontend | ||
|
||
steps: | ||
|
||
- name: Checkout Code 🛎 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Run tests | ||
run: | | ||
npm install | ||
npm run lint | ||
npm run test | ||
- name: Build package | ||
env: | ||
# BASE_URL is used in the server to support parameterizable base root path | ||
# See scripts/build_frontend.sh | ||
BASE_URL: "@@baseUrl@@" | ||
DIST_FOLDER: ./dist | ||
run: | | ||
npm run build | ||
- name: Upload frontend statics as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: argilla-frontend | ||
path: argilla-frontend/dist | ||
|
||
build_dev_docker_image: | ||
name: Build development argilla-fronted docker image | ||
needs: build | ||
uses: ./.github/workflows/argilla.build-push-dev-frontend-docker.yml | ||
if: | | ||
!cancelled() && | ||
github.event_name == 'pull_request' && github.event.pull_request.draft == false | ||
with: | ||
image-name: argilla/argilla-frontend-for-dev | ||
dockerfile: argilla-frontend/dev.frontend.Dockerfile | ||
platforms: linux/amd64 | ||
build-args: | | ||
ARGILLA_SERVER_TAG=main | ||
secrets: inherit | ||
|
||
deploy: | ||
name: Deploy pr environment | ||
uses: ./.github/workflows/argilla.deploy-environment.yml | ||
needs: build_dev_docker_image | ||
if: | | ||
!cancelled() && | ||
needs.build_dev_docker_image.result == 'success' && | ||
github.event_name == 'pull_request' && github.event.pull_request.draft == false | ||
with: | ||
image-name: argilla/argilla-frontend-for-dev | ||
image-version: ${{ needs.build_dev_docker_image.outputs.version }} | ||
secrets: inherit |
105 changes: 105 additions & 0 deletions
105
.github/workflows/argilla-server.build-docker-image.yml
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,105 @@ | ||
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 }} |
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,192 @@ | ||
name: Build Argilla server package | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
paths: | ||
- "argilla-server/**" | ||
types: | ||
- opened | ||
- edited | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
|
||
build: | ||
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 | ||
ports: | ||
- 9200:9200 | ||
env: | ||
discovery.type: single-node | ||
xpack.security.enabled: false | ||
|
||
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 | ||
ARGILLA_ELASTICSEARCH=http://localhost:9200 | ||
ARGILLA_SEARCH_ENGINE=elasticsearch | ||
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 | ||
flags: argilla-server | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# This section is used to build the frontend and copy the build files to the server. | ||
# In the future, static files should be downloaded after the frontend is built and uploaded as an artifact. | ||
- name: Setup Node.js for frontend dependencies | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install frontend dependencies | ||
working-directory: argilla-frontend | ||
env: | ||
BASE_URL: "@@baseUrl@@" | ||
DIST_FOLDER: ./dist | ||
run: | | ||
npm install | ||
npm run build | ||
# End of frontend build section | ||
- name: Build package | ||
run: | | ||
cp -r ../argilla-frontend/dist src/argilla_server/static | ||
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-docker-image.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-docker-image.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 |
Oops, something went wrong.