|
| 1 | +name: Tests |
| 2 | + |
| 3 | +# Cancel in-progress runs for the same PR. |
| 4 | +concurrency: |
| 5 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 6 | + cancel-in-progress: true |
| 7 | + |
| 8 | +on: |
| 9 | + pull_request: |
| 10 | + |
| 11 | +jobs: |
| 12 | + check_source: |
| 13 | + name: 'Check for source changes' |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + run_tests: ${{ steps.check.outputs.run_tests }} |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 1000 |
| 21 | + - name: Check for source changes |
| 22 | + id: check |
| 23 | + run: | |
| 24 | + if [ -z "$GITHUB_BASE_REF" ]; then |
| 25 | + echo "run_tests=true" >> "$GITHUB_OUTPUT" |
| 26 | + else |
| 27 | + git fetch origin $GITHUB_BASE_REF --depth=1 |
| 28 | + git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> "$GITHUB_OUTPUT" || true |
| 29 | + fi |
| 30 | +
|
| 31 | + opensuse-tests: |
| 32 | + name: '${{ matrix.name }} (openSUSE Leap)' |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: check_source |
| 35 | + if: needs.check_source.outputs.run_tests == 'true' |
| 36 | + # Use a specific image version for reproducible builds |
| 37 | + container: |
| 38 | + image: opensuse/leap:15.6 |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + include: |
| 43 | + - name: 'Check ABI' |
| 44 | + task: 'abi' |
| 45 | + - name: 'Check Generated Files' |
| 46 | + task: 'generated-files' |
| 47 | + - name: 'Build and Test' |
| 48 | + task: 'build-and-test' |
| 49 | + |
| 50 | + env: |
| 51 | + OPENSSL_VER: 1.1.1u |
| 52 | + |
| 53 | + steps: |
| 54 | + |
| 55 | + - name: Install Git and Tar |
| 56 | + run: | |
| 57 | + zypper ref |
| 58 | + zypper -n install -y git-core tar |
| 59 | +
|
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Install All Dependencies |
| 63 | + run: sh -x ./.github/workflows/posix-deps-zypp.sh |
| 64 | + |
| 65 | + - name: 'Restore OpenSSL build' |
| 66 | + if: matrix.task == 'build-and-test' |
| 67 | + id: cache-openssl |
| 68 | + uses: actions/cache@v4 |
| 69 | + with: |
| 70 | + path: ./multissl/openssl/${{ env.OPENSSL_VER }} |
| 71 | + key: opensuse-leap-multissl-openssl-${{ env.OPENSSL_VER }} |
| 72 | + |
| 73 | + # === Steps for ABI Check === |
| 74 | + - name: Build CPython for ABI Check |
| 75 | + if: matrix.task == 'abi' |
| 76 | + env: |
| 77 | + CFLAGS: -g3 -O0 |
| 78 | + run: | |
| 79 | + ./configure --enable-shared --with-fpectl |
| 80 | + make -j4 |
| 81 | +
|
| 82 | + - name: Check for changes in the ABI |
| 83 | + if: matrix.task == 'abi' |
| 84 | + run: make check-abidump |
| 85 | + |
| 86 | + # === Steps for Generated Files Check === |
| 87 | + - name: Build CPython for Generated Files Check |
| 88 | + # if: matrix.task == 'generated-files' |
| 89 | + if: false |
| 90 | + run: | |
| 91 | + ./configure --with-pydebug |
| 92 | + make -j4 regen-all |
| 93 | +
|
| 94 | + - name: Check for changes in generated files |
| 95 | + # if: matrix.task == 'generated-files' |
| 96 | + if: false |
| 97 | + run: | |
| 98 | + if ! git diff --quiet; then |
| 99 | + echo "Generated files are not up to date. Please run 'make regen-all' and commit the changes." |
| 100 | + git status |
| 101 | + git diff |
| 102 | + exit 1 |
| 103 | + fi |
| 104 | +
|
| 105 | + - name: Check exported libpython symbols |
| 106 | + # if: matrix.task == 'generated-files' |
| 107 | + if: false |
| 108 | + run: make smelly |
| 109 | + |
| 110 | + # === Steps for Full Build and Test === |
| 111 | + - name: Install OpenSSL |
| 112 | + if: matrix.task == 'build-and-test' && steps.cache-openssl.outputs.cache-hit != 'true' |
| 113 | + run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux |
| 114 | + |
| 115 | + - name: Configure CPython |
| 116 | + if: matrix.task == 'build-and-test' |
| 117 | + run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER |
| 118 | + |
| 119 | + - name: Build CPython |
| 120 | + if: matrix.task == 'build-and-test' |
| 121 | + run: make -j4 |
| 122 | + |
| 123 | + - name: Display build info |
| 124 | + if: matrix.task == 'build-and-test' |
| 125 | + run: make pythoninfo |
| 126 | + |
| 127 | + - name: Run tests |
| 128 | + if: matrix.task == 'build-and-test' |
| 129 | + run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu" |
0 commit comments