fix(CI): trigger unit tests only on changing package-related files #556
Workflow file for this run
This file contains hidden or 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: Unit Tests | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - "src/**" | ||
| - "tests/package/**" | ||
| - "tox.ini" | ||
| - "pyproject.toml" | ||
| - "MANIFEST.in" | ||
| pull_request_target: | ||
| branches: [main] | ||
| paths: | ||
| - "src/**" | ||
| - "tests/package/**" | ||
| - "tox.ini" | ||
| - "pyproject.toml" | ||
| - "MANIFEST.in" | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| tests: | ||
| if: github.repository == 'NMRLipids/FAIRMD_lipids' | ||
| runs-on: ${{ matrix.os }} | ||
| name: ${{ matrix.os }} / Python ${{ matrix.python-version }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-24.04 | ||
| python-version: "3.10" | ||
| - os: ubuntu-24.04 | ||
| python-version: "3.13" | ||
| - os: macos-15 | ||
| python-version: "3.13" | ||
| - os: windows-2025 | ||
| python-version: "3.13" | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | ||
| ref: ${{ github.event.pull_request.head.sha || github.ref }} | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| check-latest: true | ||
| - run: python -m pip install tox coverage[toml] | ||
| - name: run Python tests | ||
| run: tox -e tests-min | ||
| - name: generate coverage.xml | ||
| run: coverage xml | ||
| - name: upload to codecov.io | ||
| uses: codecov/codecov-action@v6 | ||
| with: | ||
| fail_ci_if_error: true | ||
| files: tests/coverage.xml | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||