Coverage CI created, hopefully it works first time lol #2
Workflow file for this run
This file contains 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
# this workflow generates C code coverage information from the unit test | |
# suite. Note that for intrinsics, it only runs what gets compiled | |
# and would naturally run. It also is limited to what can run in | |
# a CI environment | |
# IMPORTANT: binaries are not to be uploaded from this workflow! | |
name: Ubuntu coverage | |
# Run CI only when a release is created, on changes to main branch, or any PR | |
# to main. Do not run CI on any other branch. Also, skip any non-source changes | |
# from running on CI | |
on: | |
push: | |
branches: main | |
paths-ignore: | |
- 'docs/**' | |
- 'examples/**' | |
- '.gitignore' | |
- '*.rst' | |
- '*.md' | |
- '.github/workflows/*.yml' | |
# gcov/lcov only gets C coverage | |
- 'src_py/**' | |
# re-include current file to not be excluded | |
- '!.github/workflows/build-ubuntu-coverage.yml' | |
pull_request: | |
branches: main | |
paths-ignore: | |
- 'docs/**' | |
- 'examples/**' | |
- '.gitignore' | |
- '*.rst' | |
- '*.md' | |
- '.github/workflows/*.yml' | |
# re-include current file to not be excluded | |
- '!.github/workflows/build-ubuntu-coverage.yml' | |
# the github release drafter can call this workflow | |
workflow_call: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-coverage | |
cancel-in-progress: true | |
jobs: | |
gen_coverage: | |
env: | |
CFLAGS: "-coverage" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false # if a particular matrix build fails, don't skip the rest | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- uses: actions/[email protected] | |
- name: Install deps | |
# install numpy from pip and not apt because the one from pip is newer, | |
# and has typestubs | |
# https://github.com/actions/runner-images/issues/7192 | |
# https://github.com/orgs/community/discussions/47863 | |
run: | | |
sudo apt-get update --fix-missing | |
sudo apt-get install lcov -y | |
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev -y | |
pip3 install --upgrade pip | |
pip3 install build numpy>=1.21.0 cython | |
- name: Build with coverage hooks and install | |
run: | | |
python3 setup.py build_ext --inplace | |
python3 setup.py install --user | |
- name: Run tests | |
env: | |
SDL_VIDEODRIVER: "dummy" | |
SDL_AUDIODRIVER: "disk" | |
run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 | |
- name: Generate coverage | |
run: | | |
lcov --capture --directory . --output-file coverage.info | |
genhtml coverage.info --output-directory out | |
# We upload the generated files under github actions assets | |
- name: Upload coverage | |
if: always() && matrix.os == 'ubuntu-20.04' # upload sdist only once | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pygame-wheels-coverage | |
path: out | |
compression-level: 0 # already compressed, no need for more compression | |