|
| 1 | +name: Tests |
| 2 | + |
| 3 | +# bpo-40548: "paths-ignore" is not used to skip documentation-only PRs, because |
| 4 | +# it prevents to mark a job as mandatory. A PR cannot be merged if a job is |
| 5 | +# mandatory but not scheduled because of "paths-ignore". |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + - 3.8 |
| 11 | + - 3.7 |
| 12 | + |
| 13 | +jobs: |
| 14 | + check_source: |
| 15 | + name: 'Check for source changes' |
| 16 | + runs-on: ubuntu-latest |
| 17 | + outputs: |
| 18 | + run_tests: ${{ steps.check.outputs.run_tests }} |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + fetch-depth: 1000 |
| 23 | + - name: Check for source changes |
| 24 | + id: check |
| 25 | + run: | |
| 26 | + if [ -z "$GITHUB_BASE_REF" ]; then |
| 27 | + echo '::set-output name=run_tests::true' |
| 28 | + else |
| 29 | + git fetch origin $GITHUB_BASE_REF --depth=1 |
| 30 | + # git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more |
| 31 | + # reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots), |
| 32 | + # but it requires to download more commits (this job uses |
| 33 | + # "git fetch --depth=1"). |
| 34 | + # |
| 35 | + # git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git |
| 36 | + # 2.26, but Git 2.28 is stricter and fails with "no merge base". |
| 37 | + # |
| 38 | + # git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on |
| 39 | + # GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF |
| 40 | + # into the PR branch anyway. |
| 41 | + # |
| 42 | + # https://github.com/python/core-workflow/issues/373 |
| 43 | + git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true |
| 44 | + fi |
| 45 | +
|
| 46 | + check_abi: |
| 47 | + name: 'Check if the ABI has changed' |
| 48 | + runs-on: ubuntu-20.04 |
| 49 | + needs: check_source |
| 50 | + if: needs.check_source.outputs.run_tests == 'true' |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v2 |
| 53 | + - uses: actions/setup-python@v2 |
| 54 | + - name: Install Dependencies |
| 55 | + run: | |
| 56 | + sudo ./.github/workflows/posix-deps-apt.sh |
| 57 | + sudo apt-get install -yq abigail-tools |
| 58 | + - name: Build CPython |
| 59 | + env: |
| 60 | + CFLAGS: -g3 -O0 |
| 61 | + run: | |
| 62 | + # Build Python with the libpython dynamic library |
| 63 | + ./configure --enable-shared |
| 64 | + make -j4 |
| 65 | + - name: Check for changes in the ABI |
| 66 | + run: make check-abidump |
| 67 | + |
| 68 | + check_generated_files: |
| 69 | + name: 'Check if generated files are up to date' |
| 70 | + runs-on: ubuntu-latest |
| 71 | + needs: check_source |
| 72 | + if: needs.check_source.outputs.run_tests == 'true' |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v2 |
| 75 | + - uses: actions/setup-python@v2 |
| 76 | + - name: Install Dependencies |
| 77 | + run: sudo ./.github/workflows/posix-deps-apt.sh |
| 78 | + - name: Build CPython |
| 79 | + run: | |
| 80 | + ./configure --with-pydebug |
| 81 | + make -j4 regen-all |
| 82 | + - name: Check for changes |
| 83 | + run: | |
| 84 | + changes=$(git status --porcelain) |
| 85 | + # Check for changes in regenerated files |
| 86 | + if ! test -z "$changes" |
| 87 | + then |
| 88 | + echo "Generated files not up to date. Perhaps you forgot to run make regen-all ;)" |
| 89 | + echo "$changes" |
| 90 | + exit 1 |
| 91 | + fi |
| 92 | + - name: Check exported libpython symbols |
| 93 | + run: make smelly |
| 94 | + |
| 95 | + build_win32: |
| 96 | + name: 'Windows (x86)' |
| 97 | + runs-on: windows-2019 |
| 98 | + needs: check_source |
| 99 | + if: needs.check_source.outputs.run_tests == 'true' |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v2 |
| 102 | + - name: Build CPython |
| 103 | + run: .\PCbuild\build.bat -e -p Win32 |
| 104 | + - name: Display build info |
| 105 | + run: .\python.bat -m test.pythoninfo |
| 106 | + - name: Tests |
| 107 | + run: .\PCbuild\rt.bat -p Win32 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 |
| 108 | + |
| 109 | + build_win_amd64: |
| 110 | + name: 'Windows (x64)' |
| 111 | + runs-on: windows-2019 |
| 112 | + needs: check_source |
| 113 | + if: needs.check_source.outputs.run_tests == 'true' |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@v2 |
| 116 | + - name: Build CPython |
| 117 | + run: .\PCbuild\build.bat -e -p x64 |
| 118 | + - name: Display build info |
| 119 | + run: .\python.bat -m test.pythoninfo |
| 120 | + - name: Tests |
| 121 | + run: .\PCbuild\rt.bat -p x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 |
| 122 | + |
| 123 | + build_macos: |
| 124 | + name: 'macOS' |
| 125 | + runs-on: macos-latest |
| 126 | + needs: check_source |
| 127 | + if: needs.check_source.outputs.run_tests == 'true' |
| 128 | + env: |
| 129 | + HOMEBREW_NO_ANALYTICS: 1 |
| 130 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 131 | + HOMEBREW_NO_INSTALL_CLEANUP: 1 |
| 132 | + steps: |
| 133 | + - uses: actions/checkout@v2 |
| 134 | + - name: Configure CPython |
| 135 | + run: | |
| 136 | + brew install pkg-config [email protected] xz gdbm tcl-tk |
| 137 | + brew install zlib bzip2 ncurses readline sqlite |
| 138 | + SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk \ |
| 139 | + CC=clang \ |
| 140 | + CPPFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include \ |
| 141 | + -I$(brew --prefix zlib)/include -I$(brew --prefix bzip2)/include \ |
| 142 | + -I$(brew --prefix ncurses)/include -I$(brew --prefix readline)/include \ |
| 143 | + -I$(brew --prefix sqlite)/include" \ |
| 144 | + LDFLAGS="-L$(brew --prefix gdbm)/lib -L$(brew --prefix xz)/lib \ |
| 145 | + -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib \ |
| 146 | + -L$(brew --prefix ncurses)/lib -L$(brew --prefix readline)/lib \ |
| 147 | + -L$(brew --prefix sqlite)/lib" \ |
| 148 | + ./configure --prefix=/opt/python-dev \ |
| 149 | + --with-pydebug \ |
| 150 | + --with-openssl="$(brew --prefix [email protected])" \ |
| 151 | + --with-tcltk-libs="$(pkg-config --libs tk)" \ |
| 152 | + --with-tcltk-includes="$(pkg-config --cflags tk)" |
| 153 | + - name: Build CPython |
| 154 | + run: make -j4 |
| 155 | + - name: Display build info |
| 156 | + run: make pythoninfo |
| 157 | + - name: Tests |
| 158 | + run: make buildbottest TESTOPTS="-j4 -uall,-cpu" |
| 159 | + |
| 160 | + build_ubuntu: |
| 161 | + name: 'Ubuntu' |
| 162 | + runs-on: ubuntu-20.04 |
| 163 | + needs: check_source |
| 164 | + if: needs.check_source.outputs.run_tests == 'true' |
| 165 | + env: |
| 166 | + OPENSSL_VER: 1.1.1u |
| 167 | + steps: |
| 168 | + - uses: actions/checkout@v2 |
| 169 | + - name: Install Dependencies |
| 170 | + run: sudo ./.github/workflows/posix-deps-apt.sh |
| 171 | + - name: 'Restore OpenSSL build' |
| 172 | + id: cache-openssl |
| 173 | + |
| 174 | + with: |
| 175 | + path: ./multissl/openssl/${{ env.OPENSSL_VER }} |
| 176 | + key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} |
| 177 | + - name: Install OpenSSL |
| 178 | + if: steps.cache-openssl.outputs.cache-hit != 'true' |
| 179 | + run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux |
| 180 | + - name: Configure CPython |
| 181 | + run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER |
| 182 | + - name: Build CPython |
| 183 | + run: make -j4 |
| 184 | + - name: Display build info |
| 185 | + run: make pythoninfo |
| 186 | + - name: Tests |
| 187 | + run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu" |
0 commit comments