Skip to content

Draft: ci: test aicon in CI with pytest #21

Draft: ci: test aicon in CI with pytest

Draft: ci: test aicon in CI with pytest #21

name: Test PR
on:
pull_request:
types: [opened, synchronize, reopened]
push:
jobs:
quality:
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-precommit-run.yml@v2
with:
skip-hooks: "no-commit-to-branch"
checks:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install basic dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-md pytest-emoji
- name: Detect changed packages
id: changed-packages
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.sha }} ${{ github.sha }}) # temporarily disabled
echo "training_changed=$(echo "$CHANGED_FILES" | grep -q '^training/.*\.py$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "graphs_changed=$(echo "$CHANGED_FILES" | grep -q '^graphs/.*\.py$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
echo "models_changed=$(echo "$CHANGED_FILES" | grep -q '^models/.*\.py$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
- name: Install core packages
run: pip install -e ./graphs/[tests] -e ./training/[tests] -e ./models/[tests]
- name: Run integration tests
run: pytest tests
# - name: Run pytest for changed training package
# if: steps.changed-packages.outputs.training_changed == 'true'
# uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
# with:
# python-version: ${{ matrix.python-version }}
# install-dependencies: false
# custom-pytest: pytest training/tests
# - name: Run pytest for changed graphs package
# if: steps.changed-packages.outputs.graphs_changed == 'true'
# uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
# with:
# python-version: ${{ matrix.python-version }}
# install-dependencies: false
# custom-pytest: pytest graphs/tests
# - name: Run pytest for changed models package
# if: steps.changed-packages.outputs.models_changed == 'true'
# uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
# with:
# python-version: ${{ matrix.python-version }}
# install-dependencies: false
# custom-pytest: pytest models/tests
# - name: Run integration tests
# if: success()
# uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
# with:
# python-version: ${{ matrix.python-version }}
# install-dependencies: false
# custom-pytest: pytest tests