Skip to content

Commit a76ba36

Browse files
authored
bpo-39041: Add GitHub Actions support (GH-17594)
1 parent 814d687 commit a76ba36

File tree

6 files changed

+239
-4
lines changed

6 files changed

+239
-4
lines changed

.github/workflows/build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Tests
2+
3+
on:
4+
#push:
5+
# branches:
6+
# - master
7+
# - 3.8
8+
# - 3.7
9+
# paths-ignore:
10+
# - 'Doc/**'
11+
# - 'Misc/**'
12+
pull_request:
13+
branches:
14+
- master
15+
- 3.8
16+
- 3.7
17+
paths-ignore:
18+
- 'Doc/**'
19+
- 'Misc/**'
20+
21+
jobs:
22+
build_win32:
23+
name: 'Windows (x86)'
24+
runs-on: windows-latest
25+
steps:
26+
- uses: actions/checkout@v1
27+
- name: Build CPython
28+
run: .\PCbuild\build.bat -e -p Win32
29+
- name: Display build info
30+
run: .\python.bat -m test.pythoninfo
31+
- name: Tests
32+
run: .\PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
33+
34+
build_win_amd64:
35+
name: 'Windows (x64)'
36+
runs-on: windows-latest
37+
steps:
38+
- uses: actions/checkout@v1
39+
- name: Build CPython
40+
run: .\PCbuild\build.bat -e -p x64
41+
- name: Display build info
42+
run: .\python.bat -m test.pythoninfo
43+
- name: Tests
44+
run: .\PCbuild\rt.bat -x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
45+
46+
build_macos:
47+
name: 'macOS'
48+
runs-on: macos-latest
49+
steps:
50+
- uses: actions/checkout@v1
51+
- name: Configure CPython
52+
run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev
53+
- name: Build CPython
54+
run: make -s -j4
55+
- name: Display build info
56+
run: make pythoninfo
57+
- name: Tests
58+
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
59+
60+
build_ubuntu:
61+
name: 'Ubuntu'
62+
runs-on: ubuntu-latest
63+
env:
64+
OPENSSL_VER: 1.1.1d
65+
steps:
66+
- uses: actions/checkout@v1
67+
- name: Install Dependencies
68+
run: sudo ./.github/workflows/posix-deps-apt.sh
69+
- name: 'Restore OpenSSL build'
70+
id: cache-openssl
71+
uses: actions/cache@v1
72+
with:
73+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
74+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
75+
- name: Install OpenSSL
76+
if: steps.cache-openssl.outputs.cache-hit != 'true'
77+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
78+
- name: Configure CPython
79+
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
80+
- name: Build CPython
81+
run: make -s -j4
82+
- name: Display build info
83+
run: make pythoninfo
84+
- name: Tests
85+
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"

.github/workflows/coverage.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 3.8
8+
- 3.7
9+
paths-ignore:
10+
- 'Doc/**'
11+
- 'Misc/**'
12+
#pull_request:
13+
# branches:
14+
# - master
15+
# - 3.8
16+
# - 3.7
17+
# paths-ignore:
18+
# - 'Doc/**'
19+
# - 'Misc/**'
20+
21+
jobs:
22+
coverage_ubuntu:
23+
name: 'Ubuntu (Coverage)'
24+
runs-on: ubuntu-latest
25+
env:
26+
OPENSSL_VER: 1.1.1d
27+
steps:
28+
- uses: actions/checkout@v1
29+
- name: Install Dependencies
30+
run: sudo ./.github/workflows/posix-deps-apt.sh
31+
- name: 'Restore OpenSSL build'
32+
id: cache-openssl
33+
uses: actions/cache@v1
34+
with:
35+
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
36+
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
37+
- name: Install OpenSSL
38+
if: steps.cache-openssl.outputs.cache-hit != 'true'
39+
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
40+
- name: Configure CPython
41+
run: ./configure --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
42+
- name: Build CPython
43+
run: make -s -j4
44+
- name: Display build info
45+
run: make pythoninfo
46+
- name: 'Coverage Preparation'
47+
run: |
48+
./python -m venv .venv
49+
source ./.venv/bin/activate
50+
python -m pip install -U coverage
51+
python -m test.pythoninfo
52+
- name: 'Tests with coverage'
53+
run: >
54+
source ./.venv/bin/activate &&
55+
xvfb-run python -m coverage
56+
run --branch --pylib
57+
-m test
58+
--fail-env-changed
59+
-uall,-cpu
60+
-x test_multiprocessing_fork
61+
-x test_multiprocessing_forkserver
62+
-x test_multiprocessing_spawn
63+
-x test_concurrent_futures
64+
|| true
65+
- name: 'Publish code coverage results'
66+
run: |
67+
./.venv/bin/python -m coverage xml
68+
bash <(curl -s https://codecov.io/bash)
69+
env:
70+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
71+
72+
c_coverage_ubuntu:
73+
name: 'Ubuntu (C Coverage)'
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v1
77+
- name: Install Dependencies
78+
run: sudo ./.github/workflows/posix-deps-apt.sh
79+
- name: Configure CPython
80+
run: ./configure
81+
- name: 'Build CPython and measure coverage'
82+
run: xvfb-run make -j4 coverage-report
83+
- name: 'Publish code coverage results'
84+
if: always()
85+
run: |
86+
make pythoninfo
87+
bash <(curl -s https://codecov.io/bash)
88+
env:
89+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/doc.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docs
2+
3+
on:
4+
#push:
5+
# branches:
6+
# - master
7+
# - 3.8
8+
# - 3.7
9+
# paths:
10+
# - 'Doc/**'
11+
pull_request:
12+
branches:
13+
- master
14+
- 3.8
15+
- 3.7
16+
paths:
17+
- 'Doc/**'
18+
- 'Misc/**'
19+
20+
jobs:
21+
build_doc:
22+
name: 'Docs'
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v1
26+
- uses: actions/setup-python@v1
27+
with:
28+
python-version: '3.7'
29+
architecture: 'x64'
30+
- name: 'Install build dependencies'
31+
run: python -m pip install sphinx==2.2.0 blurb python-docs-theme
32+
- name: 'Build documentation'
33+
run: |
34+
cd Doc
35+
make check suspicious html PYTHON=python
36+
- name: Upload
37+
uses: actions/upload-artifact@v1
38+
with:
39+
name: doc-html
40+
path: Doc/build/html

.github/workflows/posix-deps-apt.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
apt-get update
3+
4+
apt-get -yq install \
5+
build-essential \
6+
zlib1g-dev \
7+
libbz2-dev \
8+
liblzma-dev \
9+
libncurses5-dev \
10+
libreadline6-dev \
11+
libsqlite3-dev \
12+
libssl-dev \
13+
libgdbm-dev \
14+
tk-dev \
15+
lzma \
16+
lzma-dev \
17+
liblzma-dev \
18+
libffi-dev \
19+
uuid-dev \
20+
xvfb \
21+
lcov

Doc/make.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ if not exist "%HTMLHELP%" (
5454
)
5555
:skiphhcsearch
5656

57-
if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v
57+
if not defined DISTVERSION for /f "usebackq" %%v in (`%PYTHON% tools/extensions/patchlevel.py`) do set DISTVERSION=%%v
5858

59-
if "%BUILDDIR%" EQU "" set BUILDDIR=build
59+
if not defined BUILDDIR set BUILDDIR=build
6060

6161
rem Targets that don't require sphinx-build
6262
if "%1" EQU "" goto help
@@ -131,7 +131,7 @@ if exist ..\Misc\NEWS (
131131
)
132132
)
133133

134-
if NOT "%PAPER%" == "" (
134+
if defined PAPER (
135135
set SPHINXOPTS=-D latex_elements.papersize=%PAPER% %SPHINXOPTS%
136136
)
137137
if "%1" EQU "htmlhelp" (

Lib/test/test_py_compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __new__(mcls, name, bases, dct, *, source_date_epoch):
5151
class PyCompileTestsBase:
5252

5353
def setUp(self):
54-
self.directory = tempfile.mkdtemp()
54+
self.directory = tempfile.mkdtemp(dir=os.getcwd())
5555
self.source_path = os.path.join(self.directory, '_test.py')
5656
self.pyc_path = self.source_path + 'c'
5757
self.cache_path = importlib.util.cache_from_source(self.source_path)

0 commit comments

Comments
 (0)