1name: 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". 6on: 7 push: 8 branches: 9 - master 10 - 3.10 11 - 3.9 12 - 3.8 13 - 3.7 14 pull_request: 15 branches: 16 - master 17 - 3.10 18 - 3.9 19 - 3.8 20 - 3.7 21 22jobs: 23 check_source: 24 name: 'Check for source changes' 25 runs-on: ubuntu-latest 26 outputs: 27 run_tests: ${{ steps.check.outputs.run_tests }} 28 run_ssl_tests: ${{ steps.check.outputs.run_ssl_tests }} 29 steps: 30 - uses: actions/checkout@v2 31 - name: Check for source changes 32 id: check 33 run: | 34 if [ -z "$GITHUB_BASE_REF" ]; then 35 echo '::set-output name=run_tests::true' 36 echo '::set-output name=run_ssl_tests::true' 37 else 38 git fetch origin $GITHUB_BASE_REF --depth=1 39 # git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more 40 # reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots), 41 # but it requires to download more commits (this job uses 42 # "git fetch --depth=1"). 43 # 44 # git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git 45 # 2.26, but Git 2.28 is stricter and fails with "no merge base". 46 # 47 # git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on 48 # GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF 49 # into the PR branch anyway. 50 # 51 # https://github.com/python/core-workflow/issues/373 52 git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true 53 git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo '::set-output name=run_ssl_tests::true' || true 54 fi 55 56 check_abi: 57 name: 'Check if the ABI has changed' 58 runs-on: ubuntu-20.04 59 needs: check_source 60 if: needs.check_source.outputs.run_tests == 'true' 61 steps: 62 - uses: actions/checkout@v2 63 - uses: actions/setup-python@v2 64 - name: Install Dependencies 65 run: | 66 sudo ./.github/workflows/posix-deps-apt.sh 67 sudo apt-get install -yq abigail-tools 68 - name: Build CPython 69 env: 70 CFLAGS: -g3 -O0 71 run: | 72 # Build Python with the libpython dynamic library 73 ./configure --enable-shared 74 make -j4 75 - name: Check for changes in the ABI 76 run: make check-abidump 77 78 check_generated_files: 79 name: 'Check if generated files are up to date' 80 runs-on: ubuntu-latest 81 needs: check_source 82 if: needs.check_source.outputs.run_tests == 'true' 83 steps: 84 - uses: actions/checkout@v2 85 - uses: actions/setup-python@v2 86 - name: Install Dependencies 87 run: sudo ./.github/workflows/posix-deps-apt.sh 88 - name: Add ccache to PATH 89 run: echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV 90 - name: Configure ccache action 91 uses: hendrikmuhs/ccache-action@v1 92 - name: Check Autoconf version 2.69 and aclocal 1.16.3 93 run: | 94 grep "Generated by GNU Autoconf 2.69" configure 95 grep "aclocal 1.16.3" aclocal.m4 96 grep -q "runstatedir" configure 97 grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4 98 - name: Regenerate autoconf files 99 run: docker run --rm -v $(pwd):/src quay.io/tiran/cpython_autoconf:269 100 - name: Build CPython 101 run: | 102 # Build Python with the libpython dynamic library 103 ./configure --with-pydebug --enable-shared 104 make -j4 regen-all 105 make regen-stdlib-module-names 106 - name: Check for changes 107 run: | 108 changes=$(git status --porcelain) 109 # Check for changes in regenerated files 110 if test -n "$changes"; then 111 echo "Generated files not up to date." 112 echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)" 113 echo "configure files must be regenerated with a specific, unpatched version of autoconf." 114 echo "$changes" 115 exit 1 116 fi 117 - name: Check exported libpython symbols 118 run: make smelly 119 - name: Check limited ABI symbols 120 run: make check-limited-abi 121 122 build_win32: 123 name: 'Windows (x86)' 124 runs-on: windows-latest 125 needs: check_source 126 if: needs.check_source.outputs.run_tests == 'true' 127 env: 128 IncludeUwp: 'true' 129 steps: 130 - uses: actions/checkout@v2 131 - name: Build CPython 132 run: .\PCbuild\build.bat -e -p Win32 133 - name: Display build info 134 run: .\python.bat -m test.pythoninfo 135 - name: Tests 136 run: .\PCbuild\rt.bat -p Win32 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 137 138 build_win_amd64: 139 name: 'Windows (x64)' 140 runs-on: windows-latest 141 needs: check_source 142 if: needs.check_source.outputs.run_tests == 'true' 143 env: 144 IncludeUwp: 'true' 145 steps: 146 - uses: actions/checkout@v2 147 - name: Register MSVC problem matcher 148 run: echo "::add-matcher::.github/problem-matchers/msvc.json" 149 - name: Build CPython 150 run: .\PCbuild\build.bat -e -p x64 151 - name: Display build info 152 run: .\python.bat -m test.pythoninfo 153 - name: Tests 154 run: .\PCbuild\rt.bat -p x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 155 156 build_macos: 157 name: 'macOS' 158 runs-on: macos-latest 159 needs: check_source 160 if: needs.check_source.outputs.run_tests == 'true' 161 env: 162 PYTHONSTRICTEXTENSIONBUILD: 1 163 steps: 164 - uses: actions/checkout@v2 165 - name: Prepare homebrew environment variables 166 run: | 167 echo "LDFLAGS=-L$(brew --prefix tcl-tk)/lib" >> $GITHUB_ENV 168 echo "PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" >> $GITHUB_ENV 169 - name: Configure CPython 170 run: ./configure --with-pydebug --prefix=/opt/python-dev 171 - name: Build CPython 172 run: make -j4 173 - name: Display build info 174 run: make pythoninfo 175 - name: Tests 176 run: make buildbottest TESTOPTS="-j4 -uall,-cpu" 177 178 build_ubuntu: 179 name: 'Ubuntu' 180 runs-on: ubuntu-20.04 181 needs: check_source 182 if: needs.check_source.outputs.run_tests == 'true' 183 env: 184 OPENSSL_VER: 1.1.1n 185 PYTHONSTRICTEXTENSIONBUILD: 1 186 steps: 187 - uses: actions/checkout@v2 188 - name: Register gcc problem matcher 189 run: echo "::add-matcher::.github/problem-matchers/gcc.json" 190 - name: Install Dependencies 191 run: sudo ./.github/workflows/posix-deps-apt.sh 192 - name: Configure OpenSSL env vars 193 run: | 194 echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV 195 echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV 196 echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV 197 - name: 'Restore OpenSSL build' 198 id: cache-openssl 199 uses: actions/cache@v2.1.4 200 with: 201 path: ./multissl/openssl/${{ env.OPENSSL_VER }} 202 key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} 203 - name: Install OpenSSL 204 if: steps.cache-openssl.outputs.cache-hit != 'true' 205 run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux 206 - name: Add ccache to PATH 207 run: | 208 echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV 209 - name: Configure ccache action 210 uses: hendrikmuhs/ccache-action@v1 211 - name: Configure CPython 212 run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR 213 - name: Build CPython 214 run: make -j4 215 - name: Display build info 216 run: make pythoninfo 217 - name: Tests 218 run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu" 219 220 build_ubuntu_ssltests: 221 name: 'Ubuntu SSL tests with OpenSSL' 222 runs-on: ubuntu-20.04 223 needs: check_source 224 if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_ssl_tests == 'true' 225 strategy: 226 fail-fast: false 227 matrix: 228 openssl_ver: [1.1.1n, 3.0.2] 229 env: 230 OPENSSL_VER: ${{ matrix.openssl_ver }} 231 MULTISSL_DIR: ${{ github.workspace }}/multissl 232 OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }} 233 LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib 234 steps: 235 - uses: actions/checkout@v2 236 - name: Register gcc problem matcher 237 run: echo "::add-matcher::.github/problem-matchers/gcc.json" 238 - name: Install Dependencies 239 run: sudo ./.github/workflows/posix-deps-apt.sh 240 - name: Configure OpenSSL env vars 241 run: | 242 echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV 243 echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> $GITHUB_ENV 244 echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV 245 - name: 'Restore OpenSSL build' 246 id: cache-openssl 247 uses: actions/cache@v2.1.4 248 with: 249 path: ./multissl/openssl/${{ env.OPENSSL_VER }} 250 key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} 251 - name: Install OpenSSL 252 if: steps.cache-openssl.outputs.cache-hit != 'true' 253 run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $OPENSSL_VER --system Linux 254 - name: Add ccache to PATH 255 run: | 256 echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV 257 - name: Configure ccache action 258 uses: hendrikmuhs/ccache-action@v1 259 - name: Configure CPython 260 run: ./configure --with-pydebug --with-openssl=$OPENSSL_DIR 261 - name: Build CPython 262 run: make -j4 263 - name: Display build info 264 run: make pythoninfo 265 - name: SSL tests 266 run: ./python Lib/test/ssltests.py 267