Better code coverage. #1
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: CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| jobs: | |
| unit-tests: | |
| name: Unit tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install build and test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build pytest pytest-cov | |
| - name: Install LD-Chem | |
| run: | | |
| python -m pip install -e . | |
| - name: Run unit tests with coverage | |
| run: | | |
| pytest tests/unit --cov=src/ld_chem --cov-config=.coveragerc --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| verbose: true | |
| token: a5c1d4e6-98be-428f-bc5e-c84555b70c0c | |
| fail_ci_if_error: false | |
| integration-tests: | |
| name: Integration tests (main & PRs only) | |
| runs-on: ubuntu-latest | |
| needs: unit-tests | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build, test, and integration dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install git+https://github.com/pnnl/part2pop.git | |
| python -m pip install build pytest | |
| - name: Build and install LD-Chem | |
| run: | | |
| python -m build | |
| python -m pip install dist/*.whl | |
| - name: Run integration tests | |
| run: | | |
| pytest tests/integration |