Skip to content

Commit

Permalink
ci: Config base tests job
Browse files Browse the repository at this point in the history
  • Loading branch information
frascuchon committed Jul 2, 2023
1 parent 13ed3a6 commit efb6cd1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,28 @@ jobs:
uses: ./.github/workflows/check-repo-files.yml

run_tests:
name: Run server tests
name: Run base tests
uses: ./.github/workflows/run-python-tests.yml
needs: check_repo_files
if: ${{ needs.check_repo_files.outputs.pythonCode }}
with:
testFolders: tests/server
pytestArgs: >
--ignore=tests/training \
--ignore=tests/client/feedback/training \
--ignore=tests/monitoring
--ignore=tests/listeners
secrets: inherit

# run_training_tests:
# name: Run training tests
# uses: ./.github/workflows/run-python-tests.yml
# needs: check_repo_files
# if: ${{ needs.check_repo_files.outputs.pythonCode }}
# # continue-on-error: true
# with:
# testFolders: tests/client/feedback/training tests/training
# secrets: inherit

build:
name: Build the python package
runs-on: ubuntu-latest
Expand Down Expand Up @@ -103,6 +117,7 @@ jobs:
needs:
- build
- run_tests
#- run_training_tests
env:
IS_DEPLOYABLE: ${{ secrets.AR_DOCKER_USERNAME != '' }}
if: needs.build.outputs.code_changes == 'true'
Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/run-python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Run Argilla python tests
on:
workflow_call:
inputs:
testFolders:
description: "Provide test folders to run"
pytestArgs:
description: "Provide extra args to pytest command line"
required: true
type: string
searchEngine:
Expand Down Expand Up @@ -38,42 +38,28 @@ jobs:
steps:
- name: Checkout Code 🛎
uses: actions/checkout@v2
- name: Check affected files
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
python_code:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'setup.py'
- name: Setup Conda Env 🐍
uses: conda-incubator/setup-miniconda@v2
if: steps.filter.outputs.python_code == 'true'
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: argilla
- name: Get date for conda cache
if: steps.filter.outputs.python_code == 'true'
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash
- name: Cache Conda env
if: steps.filter.outputs.python_code == 'true'
uses: actions/cache@v2
id: cache
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('environment_dev.yml') }}-${{ env.CACHE_NUMBER }}
- name: Update environment
if: steps.filter.outputs.python_code == 'true' && steps.cache.outputs.cache-hit != 'true'
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n argilla -f environment_dev.yml
- name: Cache pip 👜
uses: actions/cache@v2
if: steps.filter.outputs.python_code == 'true'
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ env.CACHE_NUMBER }}-${{ hashFiles('pyproject.toml') }}
Expand All @@ -93,11 +79,10 @@ jobs:
with:
opensearch-version: ${{ inputs.searchEngineVersion }}
- name: Run tests 📈
if: steps.filter.outputs.python_code == 'true'
run: |
pip install -e ".[server,listeners]"
alembic upgrade head
pytest --cov=argilla --cov-report=xml ${{ inputs.testFolders }}
pytest --cov=argilla --cov-report=xml ${{ inputs.pytestArgs }}
- name: Upload Coverage to Codecov 📦
uses: codecov/codecov-action@v1
if: inputs.coverageReport
Expand Down

0 comments on commit efb6cd1

Please sign in to comment.