[Python-checkins] bpo-39041: Add GitHub Actions support (GH-17594)

Steve Dower webhook-mailer at python.org
Mon Dec 16 13:35:29 EST 2019


https://github.com/python/cpython/commit/a76ba362c4d86adf5e7f8254398135d12d7afd25
commit: a76ba362c4d86adf5e7f8254398135d12d7afd25
branch: master
author: Steve Dower <steve.dower at python.org>
committer: GitHub <noreply at github.com>
date: 2019-12-16T10:35:22-08:00
summary:

bpo-39041: Add GitHub Actions support (GH-17594)

files:
A .github/workflows/build.yml
A .github/workflows/coverage.yml
A .github/workflows/doc.yml
A .github/workflows/posix-deps-apt.sh
M Doc/make.bat
M Lib/test/test_py_compile.py

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000000000..16d6f0db8c908
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,85 @@
+name: Tests
+
+on:
+  #push:
+  #  branches:
+  #  - master
+  #  - 3.8
+  #  - 3.7
+  #  paths-ignore:
+  #  - 'Doc/**'
+  #  - 'Misc/**'
+  pull_request:
+    branches:
+    - master
+    - 3.8
+    - 3.7
+    paths-ignore:
+    - 'Doc/**'
+    - 'Misc/**'
+
+jobs:
+  build_win32:
+    name: 'Windows (x86)'
+    runs-on: windows-latest
+    steps:
+    - uses: actions/checkout at v1
+    - name: Build CPython
+      run: .\PCbuild\build.bat -e -p Win32
+    - name: Display build info
+      run: .\python.bat -m test.pythoninfo
+    - name: Tests
+      run: .\PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
+
+  build_win_amd64:
+    name: 'Windows (x64)'
+    runs-on: windows-latest
+    steps:
+    - uses: actions/checkout at v1
+    - name: Build CPython
+      run: .\PCbuild\build.bat -e -p x64
+    - name: Display build info
+      run: .\python.bat -m test.pythoninfo
+    - name: Tests
+      run: .\PCbuild\rt.bat -x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
+
+  build_macos:
+    name: 'macOS'
+    runs-on: macos-latest
+    steps:
+    - uses: actions/checkout at v1
+    - name: Configure CPython
+      run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev
+    - name: Build CPython
+      run: make -s -j4
+    - name: Display build info
+      run: make pythoninfo
+    - name: Tests
+      run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
+
+  build_ubuntu:
+    name: 'Ubuntu'
+    runs-on: ubuntu-latest
+    env:
+      OPENSSL_VER: 1.1.1d
+    steps:
+    - uses: actions/checkout at v1
+    - name: Install Dependencies
+      run: sudo ./.github/workflows/posix-deps-apt.sh
+    - name: 'Restore OpenSSL build'
+      id: cache-openssl
+      uses: actions/cache at v1
+      with:
+        path: ./multissl/openssl/${{ env.OPENSSL_VER }}
+        key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
+    - name: Install OpenSSL
+      if: steps.cache-openssl.outputs.cache-hit != 'true'
+      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
+    - name: Configure CPython
+      run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
+    - name: Build CPython
+      run: make -s -j4
+    - name: Display build info
+      run: make pythoninfo
+    - name: Tests
+      run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644
index 0000000000000..cb05e8e2f71f0
--- /dev/null
+++ b/.github/workflows/coverage.yml
@@ -0,0 +1,89 @@
+name: Coverage
+
+on:
+  push:
+    branches:
+    - master
+    - 3.8
+    - 3.7
+    paths-ignore:
+    - 'Doc/**'
+    - 'Misc/**'
+  #pull_request:
+  #  branches:
+  #  - master
+  #  - 3.8
+  #  - 3.7
+  #  paths-ignore:
+  #  - 'Doc/**'
+  #  - 'Misc/**'
+
+jobs:
+  coverage_ubuntu:
+    name: 'Ubuntu (Coverage)'
+    runs-on: ubuntu-latest
+    env:
+      OPENSSL_VER: 1.1.1d
+    steps:
+    - uses: actions/checkout at v1
+    - name: Install Dependencies
+      run: sudo ./.github/workflows/posix-deps-apt.sh
+    - name: 'Restore OpenSSL build'
+      id: cache-openssl
+      uses: actions/cache at v1
+      with:
+        path: ./multissl/openssl/${{ env.OPENSSL_VER }}
+        key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
+    - name: Install OpenSSL
+      if: steps.cache-openssl.outputs.cache-hit != 'true'
+      run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
+    - name: Configure CPython
+      run: ./configure --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
+    - name: Build CPython
+      run: make -s -j4
+    - name: Display build info
+      run: make pythoninfo
+    - name: 'Coverage Preparation'
+      run: |
+        ./python -m venv .venv
+        source ./.venv/bin/activate
+        python -m pip install -U coverage
+        python -m test.pythoninfo
+    - name: 'Tests with coverage'
+      run: >
+        source ./.venv/bin/activate &&
+        xvfb-run python -m coverage
+        run --branch --pylib
+        -m test
+        --fail-env-changed
+        -uall,-cpu
+        -x test_multiprocessing_fork
+        -x test_multiprocessing_forkserver
+        -x test_multiprocessing_spawn
+        -x test_concurrent_futures
+        || true
+    - name: 'Publish code coverage results'
+      run: |
+        ./.venv/bin/python -m coverage xml
+        bash <(curl -s https://codecov.io/bash)
+      env:
+        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
+  c_coverage_ubuntu:
+    name: 'Ubuntu (C Coverage)'
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout at v1
+    - name: Install Dependencies
+      run: sudo ./.github/workflows/posix-deps-apt.sh
+    - name: Configure CPython
+      run: ./configure
+    - name: 'Build CPython and measure coverage'
+      run: xvfb-run make -j4 coverage-report
+    - name: 'Publish code coverage results'
+      if: always()
+      run: |
+        make pythoninfo
+        bash <(curl -s https://codecov.io/bash)
+      env:
+        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml
new file mode 100644
index 0000000000000..405b12e3d29c9
--- /dev/null
+++ b/.github/workflows/doc.yml
@@ -0,0 +1,40 @@
+name: Docs
+
+on:
+  #push:
+  #  branches:
+  #  - master
+  #  - 3.8
+  #  - 3.7
+  #  paths:
+  #  - 'Doc/**'
+  pull_request:
+    branches:
+    - master
+    - 3.8
+    - 3.7
+    paths:
+    - 'Doc/**'
+    - 'Misc/**'
+
+jobs:
+  build_doc:
+    name: 'Docs'
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout at v1
+    - uses: actions/setup-python at v1
+      with:
+        python-version: '3.7'
+        architecture: 'x64'
+    - name: 'Install build dependencies'
+      run: python -m pip install sphinx==2.2.0 blurb python-docs-theme
+    - name: 'Build documentation'
+      run: |
+        cd Doc
+        make check suspicious html PYTHON=python
+    - name: Upload
+      uses: actions/upload-artifact at v1
+      with:
+        name: doc-html
+        path: Doc/build/html
diff --git a/.github/workflows/posix-deps-apt.sh b/.github/workflows/posix-deps-apt.sh
new file mode 100755
index 0000000000000..2b879d32f8150
--- /dev/null
+++ b/.github/workflows/posix-deps-apt.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+apt-get update
+
+apt-get -yq install \
+    build-essential \
+    zlib1g-dev \
+    libbz2-dev \
+    liblzma-dev \
+    libncurses5-dev \
+    libreadline6-dev \
+    libsqlite3-dev \
+    libssl-dev \
+    libgdbm-dev \
+    tk-dev \
+    lzma \
+    lzma-dev \
+    liblzma-dev \
+    libffi-dev \
+    uuid-dev \
+    xvfb \
+    lcov
diff --git a/Doc/make.bat b/Doc/make.bat
index dfc622f66615d..6f8f172e95eb8 100644
--- a/Doc/make.bat
+++ b/Doc/make.bat
@@ -54,9 +54,9 @@ if not exist "%HTMLHELP%" (
 )
 :skiphhcsearch
 
-if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v
+if not defined DISTVERSION for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v
 
-if "%BUILDDIR%" EQU "" set BUILDDIR=build
+if not defined BUILDDIR set BUILDDIR=build
 
 rem Targets that don't require sphinx-build
 if "%1" EQU "" goto help
@@ -131,7 +131,7 @@ if exist ..\Misc\NEWS (
     )
 )
 
-if NOT "%PAPER%" == "" (
+if defined PAPER (
     set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS%
 )
 if "%1" EQU "htmlhelp" (
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index d6677ab45ff50..d4a68c9320d04 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -51,7 +51,7 @@ def __new__(mcls, name, bases, dct, *, source_date_epoch):
 class PyCompileTestsBase:
 
     def setUp(self):
-        self.directory = tempfile.mkdtemp()
+        self.directory = tempfile.mkdtemp(dir=os.getcwd())
         self.source_path = os.path.join(self.directory, '_test.py')
         self.pyc_path = self.source_path + 'c'
         self.cache_path = importlib.util.cache_from_source(self.source_path)



More information about the Python-checkins mailing list