diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 82e5b39c2..c88049eb5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -108,6 +108,23 @@ jobs: path: | ${{ github.workspace }}/artifacts + - name: Test with pytest + id: test + shell: bash + run: | + python -m pytest \ + -rxXs \ + --tb=native \ + --verbose \ + --cov=src \ + tests + + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.os }}-${{ matrix.architecture }} + path: .coverage + - name: Create/Update GitHub Release if: ${{ needs.setup_release.outputs.publish_release == 'true' }} uses: LizardByte/create-release-action@v2023.1210.832 @@ -121,3 +138,30 @@ jobs: prerelease: true # ${{ needs.setup_release.outputs.publish_pre_release }} tag: ${{ needs.setup_release.outputs.release_tag }} token: ${{ secrets.GH_BOT_TOKEN }} + + coverage: + name: Process test coverage (${{ matrix.os }}-${{ matrix.architecture }}) + runs-on: ${{ matrix.os }} + needs: build + if: always() # code coverage tracks coverage on all branches + strategy: + fail-fast: false + matrix: + os: [windows-2019, ubuntu-20.04, macos-11] + architecture: [x64] + include: # additional runs + - os: windows-2019 + architecture: x86 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download coverage artifacts + uses: actions/download-artifact@v4 + with: + name: coverage-${{ matrix.os }}-${{ matrix.architecture }} + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + flags: ${{ runner.os }}-${{ matrix.architecture }} diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml deleted file mode 100644 index f1ecb08d6..000000000 --- a/.github/workflows/python-tests.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -name: Python Tests - -on: - pull_request: - branches: [master, nightly] - types: [opened, synchronize, reopened] - -jobs: - pytest: - strategy: - fail-fast: false - matrix: - os: [windows-2019, ubuntu-20.04, macos-11] - architecture: [x64] - include: # additional runs - - os: windows-2019 - architecture: x86 - - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 # https://github.com/actions/setup-python - with: - python-version: '3.9' - architecture: ${{ matrix.architecture }} - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install -r requirements-dev.txt - - - name: Compile Locale Translations - run: | - python ./scripts/_locale.py --compile - - - name: Compile Docs - run: | - cd docs - make html - - - name: Test with pytest - run: | - python -m pytest -v diff --git a/requirements-dev.txt b/requirements-dev.txt index 3a1af5bb1..a28a7002d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,4 +2,5 @@ flake8==6.1.0 pyinstaller==6.3.0 pytest==7.4.3 +pytest-cov==4.1.0 rstcheck[sphinx]==6.2.0