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.9 11 - 3.8 12 - 3.7 13 pull_request: 14 branches: 15 - master 16 - 3.9 17 - 3.8 18 - 3.7 19 20jobs: 21 check_source: 22 name: 'Check for source changes' 23 runs-on: ubuntu-latest 24 outputs: 25 run_tests: ${{ steps.check.outputs.run_tests }} 26 steps: 27 - uses: actions/checkout@v2 28 - name: Check for source changes 29 id: check 30 run: | 31 if [ -z "GITHUB_BASE_REF" ]; then 32 echo '::set-output name=run_tests::true' 33 else 34 git fetch origin $GITHUB_BASE_REF --depth=1 35 # git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more 36 # reliable than git diff "origin/$GITHUB_BASE_REF.." (2 dots), 37 # but it requires to download more commits (this job uses 38 # "git fetch --depth=1"). 39 # 40 # git diff "origin/$GITHUB_BASE_REF..." (3 dots) works with Git 41 # 2.26, but Git 2.28 is stricter and fails with "no merge base". 42 # 43 # git diff "origin/$GITHUB_BASE_REF.." (2 dots) should be enough on 44 # GitHub, since GitHub starts by merging origin/$GITHUB_BASE_REF 45 # into the PR branch anyway. 46 # 47 # https://github.com/python/core-workflow/issues/373 48 git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true 49 fi 50 51 check_generated_files: 52 name: 'Check if generated files are up to date' 53 runs-on: ubuntu-latest 54 needs: check_source 55 if: needs.check_source.outputs.run_tests == 'true' 56 steps: 57 - uses: actions/checkout@v2 58 - uses: actions/setup-python@v2 59 - name: Install Dependencies 60 run: sudo ./.github/workflows/posix-deps-apt.sh 61 - name: Build CPython 62 run: | 63 ./configure --with-pydebug 64 make -j4 regen-all 65 - name: Check for changes 66 run: | 67 changes=$(git status --porcelain) 68 # Check for changes in regenerated files 69 if ! test -z "$changes" 70 then 71 echo "Generated files not up to date. Perhaps you forgot to run make regen-all ;)" 72 echo "$changes" 73 exit 1 74 fi 75 - name: Check exported libpython symbols 76 run: make smelly 77 78 build_win32: 79 name: 'Windows (x86)' 80 runs-on: windows-latest 81 needs: check_source 82 if: needs.check_source.outputs.run_tests == 'true' 83 steps: 84 - uses: actions/checkout@v2 85 - name: Build CPython 86 run: .\PCbuild\build.bat -e -p Win32 87 - name: Display build info 88 run: .\python.bat -m test.pythoninfo 89 - name: Tests 90 run: .\PCbuild\rt.bat -p Win32 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 91 92 build_win_amd64: 93 name: 'Windows (x64)' 94 runs-on: windows-latest 95 needs: check_source 96 if: needs.check_source.outputs.run_tests == 'true' 97 steps: 98 - uses: actions/checkout@v2 99 - name: Build CPython 100 run: .\PCbuild\build.bat -e -p x64 101 - name: Display build info 102 run: .\python.bat -m test.pythoninfo 103 - name: Tests 104 run: .\PCbuild\rt.bat -p x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 105 106 build_macos: 107 name: 'macOS' 108 runs-on: macos-latest 109 needs: check_source 110 if: needs.check_source.outputs.run_tests == 'true' 111 steps: 112 - uses: actions/checkout@v2 113 - name: Configure CPython 114 run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev 115 - name: Build CPython 116 run: make -j4 117 - name: Display build info 118 run: make pythoninfo 119 - name: Tests 120 run: make buildbottest TESTOPTS="-j4 -uall,-cpu" 121 122 build_ubuntu: 123 name: 'Ubuntu' 124 runs-on: ubuntu-latest 125 needs: check_source 126 if: needs.check_source.outputs.run_tests == 'true' 127 env: 128 OPENSSL_VER: 1.1.1f 129 steps: 130 - uses: actions/checkout@v2 131 - name: Install Dependencies 132 run: sudo ./.github/workflows/posix-deps-apt.sh 133 - name: 'Restore OpenSSL build' 134 id: cache-openssl 135 uses: actions/cache@v2.1.3 136 with: 137 path: ./multissl/openssl/${{ env.OPENSSL_VER }} 138 key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }} 139 - name: Install OpenSSL 140 if: steps.cache-openssl.outputs.cache-hit != 'true' 141 run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux 142 - name: Configure CPython 143 run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER 144 - name: Build CPython 145 run: make -j4 146 - name: Display build info 147 run: make pythoninfo 148 - name: Tests 149 run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu" 150