|
| 1 | +# This workflow generates C code tests |
| 2 | +# Note that for intrinsics, it only runs what gets compiled |
| 3 | +# and would naturally run. It also is limited to what can run in |
| 4 | +# a CI environment |
| 5 | +# IMPORTANT: binaries are not to be uploaded from this workflow! |
| 6 | + |
| 7 | +name: Ubuntu ctest |
| 8 | + |
| 9 | +# Run CI only on changes to main branch, or any PR to main. |
| 10 | +# Do not run CI on any other branch. Also, skip any non-source changes |
| 11 | +# from running on CI |
| 12 | +on: |
| 13 | + push: |
| 14 | + branches: main |
| 15 | + paths-ignore: |
| 16 | + - 'docs/**' |
| 17 | + - 'examples/**' |
| 18 | + - '.gitignore' |
| 19 | + - '*.rst' |
| 20 | + - '*.md' |
| 21 | + - '.github/workflows/*.yml' |
| 22 | + # only care about c code that changes |
| 23 | + - 'src_py/**' |
| 24 | + # re-include current file to not be excluded |
| 25 | + - '!.github/workflows/build-ubuntu-ctest.yml' |
| 26 | + |
| 27 | + pull_request: |
| 28 | + branches: main |
| 29 | + paths-ignore: |
| 30 | + - 'docs/**' |
| 31 | + - 'examples/**' |
| 32 | + - '.gitignore' |
| 33 | + - '*.rst' |
| 34 | + - '*.md' |
| 35 | + - '.github/workflows/*.yml' |
| 36 | + # only care about c code that changes |
| 37 | + - 'src_py/**' |
| 38 | + # re-include current file to not be excluded |
| 39 | + - '!.github/workflows/build-ubuntu-ctest.yml' |
| 40 | + |
| 41 | +concurrency: |
| 42 | + group: ${{ github.workflow }}-${{ github.ref }}-ubuntu-ctest |
| 43 | + cancel-in-progress: true |
| 44 | + |
| 45 | +jobs: |
| 46 | + gen_coverage: |
| 47 | + runs-on: ${{ matrix.os }} |
| 48 | + strategy: |
| 49 | + fail-fast: false # if a particular matrix build fails, don't skip the rest |
| 50 | + matrix: |
| 51 | + os: [ubuntu-24.04] |
| 52 | + |
| 53 | + env: |
| 54 | + # Pip now forces us to either make a venv or set this flag, so we will do |
| 55 | + # this |
| 56 | + PIP_BREAK_SYSTEM_PACKAGES: 1 |
| 57 | + # We are using dependencies installed from apt |
| 58 | + PG_DEPS_FROM_SYSTEM: 1 |
| 59 | + |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4.2.2 |
| 62 | + |
| 63 | + - name: Install deps |
| 64 | + # https://github.com/actions/runner-images/issues/7192 |
| 65 | + # https://github.com/orgs/community/discussions/47863 |
| 66 | + run: | |
| 67 | + sudo apt-get update --fix-missing |
| 68 | + sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev -y |
| 69 | +
|
| 70 | + - name: Build with the ctest suite |
| 71 | + id: build |
| 72 | + run: | |
| 73 | + python3 -m pip install . -Csetup-args="-Dctest=true" --break-system-packages |
| 74 | +
|
| 75 | + - name: Run tests |
| 76 | + env: |
| 77 | + SDL_VIDEODRIVER: "dummy" |
| 78 | + SDL_AUDIODRIVER: "disk" |
| 79 | + run: python3 -m pygame.tests -v --exclude opengl,music,timing --time_out 300 |
| 80 | + |
| 81 | + # We upload the generated files under github actions assets |
| 82 | + - name: Upload ctest log |
| 83 | + if: !cancelled() |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + with: |
| 86 | + name: ctest_suite_log |
| 87 | + path: ctest.log |
0 commit comments