Skip to content

Coverage CI created, hopefully it works first time lol #8

Coverage CI created, hopefully it works first time lol

Coverage CI created, hopefully it works first time lol #8

# 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-22.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 meson-python ninja cython sphinx<=7.2.6 # because we are doing --no-build-isolation
pip3 install numpy>=1.21.0
- name: Build with coverage hooks and install
run: |
pip3 install -e . --no-build-isolation -Cbuild-dir=.mesonpy-rel -Csetup-args=-Dcoverage=true
- 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
if: always()
run: |
lcov --capture --directory . --output-file coverage.info
genhtml coverage.info --output-directory ${{ github.workspace}}/out
# We upload the generated files under github actions assets
- name: Upload coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: pygame-wheels-coverage
path: ${{ github.workspace }}/out