Skip to content

Merge pull request #3143 from pygame-community/ankith26-drop-py38 #509

Merge pull request #3143 from pygame-community/ankith26-drop-py38

Merge pull request #3143 from pygame-community/ankith26-drop-py38 #509

# 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'
# gcov/lcov only gets C coverage
- 'src_py/**'
# re-include current file to not be excluded
- '!.github/workflows/build-ubuntu-coverage.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-coverage
cancel-in-progress: true
jobs:
gen_coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # if a particular matrix build fails, don't skip the rest
matrix:
os: [ubuntu-24.04]
env:
# Pip now forces us to either make a venv or set this flag, so we will do
# this
PIP_BREAK_SYSTEM_PACKAGES: 1
# We are using dependencies installed from apt
PG_DEPS_FROM_SYSTEM: 1
steps:
- uses: actions/[email protected]
- name: Install deps
# 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
- name: Build with coverage hooks and install
id: build
run: |
python3 dev.py build --coverage
- 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
id: gen-coverage
# want to continue regardless of whether a test failed or not as long as the job wasn't cancelled
if: ${{ steps.build.conclusion == 'success' && !cancelled() }}
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 html
# want to continue only if the coverage generation was successful
if: ${{ steps.gen-coverage.conclusion == 'success' && !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: pygame-wheels-coverage
path: ./out