argh again #580
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
| # Based on | |
| # python-package.yml | |
| # and | |
| # https://medium.com/@wkrzywiec/how-to-write-good-quality-python-code-with-github-actions-2f635a2ab09a | |
| name: Coverage | |
| on: | |
| push: | |
| branches: [ master ] | |
| jobs: | |
| codecov: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 | |
| pip install coverage | |
| pip install pdm | |
| - name: Install Python for pdm venv | |
| run: | | |
| pdm python install ${{ matrix.python-version }} | |
| - name: Activate virtualenv | |
| run: | | |
| pdm use --venv in-project | |
| source .venv/bin/activate | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable | |
| # https://stackoverflow.com/questions/74668349/how-to-activate-a-virtualenv-in-a-github-action | |
| echo "PATH=$PATH" >> "$GITHUB_ENV" | |
| echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> "$GITHUB_ENV" | |
| - name: Install dependencies into virtualenv | |
| run: | | |
| pdm install | |
| - name: Generate coverage report | |
| run: | | |
| coverage run --source=. -m runtests | |
| coverage xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: unittests |