update comments #589
  
    
      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 in CI virtualenv | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 | |
| pip install pdm | |
| - name: Create in-project virtualenv and install dependencies | |
| run: | | |
| pdm python install ${{ matrix.python-version }} | |
| # "When you run pdm install the first time on a new PDM-managed project, whose Python interpreter is not decided yet, | |
| # PDM will create a virtualenv in <project_root>/.venv, and install dependencies into it." | |
| # https://pdm-project.org/en/latest/usage/venv/ | |
| pdm install | |
| - name: Install coverage tool in in-project virtualenv | |
| run: | | |
| pdm run python -m ensurepip | |
| # coverage must run in the same venv as the code being tested. | |
| pdm run python -m pip install coverage | |
| - name: Generate coverage report | |
| run: | | |
| pdm use --venv in-project | |
| source .venv/bin/activate | |
| python -m coverage run --source=. -m runtests | |
| python -m coverage xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: unittests |