Skip to content

Commit 423b04c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature-match-stmt
2 parents 5f98cdd + 4e7c2a0 commit 423b04c

File tree

1,077 files changed

+45410
-19951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,077 files changed

+45410
-19951
lines changed

.github/workflows/build_wheels.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Trigger wheel build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ['*']
7+
paths-ignore:
8+
- 'docs/**'
9+
- '**/*.rst'
10+
- '**/*.md'
11+
- .gitignore
12+
- CREDITS
13+
- LICENSE
14+
15+
jobs:
16+
build-wheels:
17+
if: github.repository == 'python/mypy'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- uses: actions/setup-python@v2
22+
with:
23+
python-version: '3.7'
24+
- name: Trigger script
25+
env:
26+
WHEELS_PUSH_TOKEN: ${{ secrets.WHEELS_PUSH_TOKEN }}
27+
run: ./misc/trigger_wheel_build.sh

.github/workflows/docs.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Check documentation build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ['*']
7+
pull_request:
8+
paths:
9+
- 'docs/**'
10+
- '**/*.rst'
11+
- '**/*.md'
12+
- CREDITS
13+
- LICENSE
14+
15+
jobs:
16+
docs:
17+
runs-on: ubuntu-latest
18+
env:
19+
TOXENV: docs
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: actions/setup-python@v2
23+
with:
24+
python-version: '3.7'
25+
- name: Install tox
26+
run: pip install --upgrade 'setuptools!=50' 'virtualenv<16.7.11' tox==3.20.1
27+
- name: Setup tox environment
28+
run: tox -e ${{ env.TOXENV }} --notest
29+
- name: Test
30+
run: tox -e ${{ env.TOXENV }} --skip-pkg-install

.github/workflows/mypy_primer.yml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -57,42 +57,13 @@ jobs:
5757
with:
5858
name: mypy_primer_diffs
5959
path: diff_${{ matrix.shard-index }}.txt
60-
61-
comment:
62-
name: Comment
63-
runs-on: ubuntu-latest
64-
needs: mypy_primer
65-
permissions:
66-
contents: read
67-
pull-requests: write
68-
steps:
69-
- name: Download diffs
70-
uses: actions/download-artifact@v2
60+
- if: ${{ matrix.shard-index }} == 0
61+
name: Save PR number
62+
run: |
63+
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
64+
- if: ${{ matrix.shard-index }} == 0
65+
name: Upload PR number
66+
uses: actions/upload-artifact@v2
7167
with:
7268
name: mypy_primer_diffs
73-
74-
- name: Post comment
75-
uses: actions/github-script@v3
76-
with:
77-
github-token: ${{secrets.GITHUB_TOKEN}}
78-
script: |
79-
const fs = require('fs')
80-
const data = (
81-
['diff_0.txt', 'diff_1.txt']
82-
.map(fileName => fs.readFileSync(fileName, { encoding: 'utf8' }))
83-
.join('')
84-
.substr(0, 30000) // About 300 lines
85-
)
86-
87-
console.log("Diff from mypy_primer:")
88-
console.log(data)
89-
90-
if (data.trim()) {
91-
const body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
92-
await github.issues.createComment({
93-
issue_number: context.issue.number,
94-
owner: context.repo.owner,
95-
repo: context.repo.repo,
96-
body
97-
})
98-
}
69+
path: pr_number.txt
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Comment with mypy_primer diff
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- Run mypy_primer
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
jobs:
15+
comment:
16+
name: Comment PR from mypy_primer
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Download diffs
20+
uses: actions/github-script@v3
21+
with:
22+
script: |
23+
const fs = require('fs');
24+
const artifacts = await github.actions.listWorkflowRunArtifacts({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
run_id: ${{ github.event.workflow_run.id }},
28+
});
29+
const [matchArtifact] = artifacts.data.artifacts.filter((artifact) =>
30+
artifact.name == "mypy_primer_diffs");
31+
32+
const download = await github.actions.downloadArtifact({
33+
owner: context.repo.owner,
34+
repo: context.repo.repo,
35+
artifact_id: matchArtifact.id,
36+
archive_format: "zip",
37+
});
38+
fs.writeFileSync("diff.zip", Buffer.from(download.data));
39+
40+
- run: unzip diff.zip
41+
42+
# Based on https://github.com/kanga333/comment-hider
43+
- name: Hide old comments
44+
uses: actions/github-script@v3
45+
with:
46+
github-token: ${{secrets.GITHUB_TOKEN}}
47+
script: |
48+
const fs = require('fs')
49+
50+
const response = await github.issues.listComments({
51+
issue_number: fs.readFileSync("pr_number.txt", { encoding: "utf8" }),
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
})
55+
const botCommentIds = response.data
56+
.filter(comment => comment.user.login === 'github-actions[bot]')
57+
.map(comment => comment.node_id)
58+
59+
for (const id of botCommentIds) {
60+
const resp = await github.graphql(`
61+
mutation {
62+
minimizeComment(input: {classifier: OUTDATED, subjectId: "${id}"}) {
63+
minimizedComment {
64+
isMinimized
65+
}
66+
}
67+
}
68+
`)
69+
if (resp.errors) {
70+
throw new Error(resp.errors)
71+
}
72+
}
73+
74+
- name: Post comment
75+
uses: actions/github-script@v3
76+
with:
77+
github-token: ${{secrets.GITHUB_TOKEN}}
78+
script: |
79+
const fs = require('fs')
80+
// Keep in sync with shards produced by mypy_primer workflow
81+
const data = (
82+
['diff_0.txt', 'diff_1.txt', 'diff_2.txt']
83+
.map(fileName => fs.readFileSync(fileName, { encoding: 'utf8' }))
84+
.join('')
85+
.substr(0, 30000) // About 300 lines
86+
)
87+
88+
console.log("Diff from mypy_primer:")
89+
console.log(data)
90+
91+
if (data.trim()) {
92+
const body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
93+
await github.issues.createComment({
94+
issue_number: fs.readFileSync("pr_number.txt", { encoding: "utf8" }),
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
body
98+
})
99+
}

.github/workflows/test.yml

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: main
1+
name: Tests
22

33
on:
44
push:
@@ -10,38 +10,120 @@ on:
1010
- '**/*.rst'
1111
- '**/*.md'
1212
- .gitignore
13-
- .travis.yml
1413
- CREDITS
1514
- LICENSE
1615

1716
jobs:
18-
build:
17+
main:
1918
runs-on: ${{ matrix.os }}
2019
strategy:
2120
fail-fast: false
2221
matrix:
23-
name: [windows-py37-32, windows-py37-64]
2422
include:
25-
- name: windows-py37-32
23+
- name: Test suite with py37-windows-32
2624
python: '3.7'
2725
arch: x86
2826
os: windows-latest
2927
toxenv: py37
30-
- name: windows-py37-64
28+
- name: Test suite with py37-windows-64
3129
python: '3.7'
3230
arch: x64
3331
os: windows-latest
3432
toxenv: py37
33+
- name: Test suite with py37-ubuntu
34+
python: '3.7'
35+
arch: x64
36+
os: ubuntu-latest
37+
toxenv: py
38+
tox_extra_args: "-n 2"
39+
- name: Test suite with py38-ubuntu
40+
python: '3.8'
41+
arch: x64
42+
os: ubuntu-latest
43+
toxenv: py
44+
tox_extra_args: "-n 2"
45+
- name: Test suite with py36-ubuntu, mypyc-compiled
46+
python: '3.6'
47+
arch: x64
48+
os: ubuntu-latest
49+
toxenv: py
50+
tox_extra_args: "-n 2"
51+
test_mypyc: true
52+
- name: Test suite with py39-ubuntu, mypyc-compiled
53+
python: '3.9'
54+
arch: x64
55+
os: ubuntu-latest
56+
toxenv: py
57+
tox_extra_args: "-n 2"
58+
test_mypyc: true
59+
- name: mypyc runtime tests with py36-macos
60+
python: '3.6'
61+
arch: x64
62+
os: macos-latest
63+
toxenv: py
64+
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
65+
- name: mypyc runtime tests with py36-debug-build-ubuntu
66+
python: '3.6.8'
67+
arch: x64
68+
os: ubuntu-latest
69+
toxenv: py36
70+
tox_extra_args: "-n 2 mypyc/test/test_run.py mypyc/test/test_external.py"
71+
debug_build: true
72+
- name: Type check our own code
73+
python: '3.7'
74+
arch: x64
75+
os: ubuntu-latest
76+
toxenv: type
77+
- name: Code style with flake8
78+
python: '3.7'
79+
arch: x64
80+
os: ubuntu-latest
81+
toxenv: lint
3582

83+
name: ${{ matrix.name }}
3684
steps:
3785
- uses: actions/checkout@v2
3886
- uses: actions/setup-python@v2
3987
with:
4088
python-version: ${{ matrix.python }}
4189
architecture: ${{ matrix.arch }}
42-
- name: install tox
43-
run: pip install --upgrade 'setuptools!=50' 'virtualenv<20' tox==3.20.1
44-
- name: setup tox environment
90+
- name: Debug build
91+
if: ${{ matrix.debug_build }}
92+
run: |
93+
PYTHONVERSION=${{ matrix.python }}
94+
PYTHONDIR=~/python-debug/python-$PYTHONVERSION
95+
VENV=$PYTHONDIR/env
96+
./misc/build-debug-python.sh $PYTHONVERSION $PYTHONDIR $VENV
97+
source $VENV/bin/activate
98+
- name: Install tox
99+
run: pip install --upgrade 'setuptools!=50' 'virtualenv<16.7.11' tox==3.20.1
100+
- name: Compiled with mypyc
101+
if: ${{ matrix.test_mypyc }}
102+
run: |
103+
pip install -r test-requirements.txt
104+
CC=clang MYPYC_OPT_LEVEL=0 python3 setup.py --use-mypyc build_ext --inplace
105+
- name: Setup tox environment
45106
run: tox -e ${{ matrix.toxenv }} --notest
46-
- name: test
47-
run: tox -e ${{ matrix.toxenv }} --skip-pkg-install
107+
- name: Test
108+
run: tox -e ${{ matrix.toxenv }} --skip-pkg-install -- ${{ matrix.tox_extra_args }}
109+
110+
python-nightly:
111+
runs-on: ubuntu-latest
112+
name: Test suite with Python nightly
113+
steps:
114+
- uses: actions/checkout@v2
115+
- uses: actions/setup-python@v2
116+
with:
117+
python-version: '3.10-dev'
118+
- name: Install tox
119+
run: |
120+
pip install -U pip==21.2.3 setuptools
121+
pip install --upgrade 'setuptools!=50' virtualenv==20.4.7 tox==3.20.1
122+
- name: Setup tox environment
123+
run: tox -e py --notest
124+
- name: Test
125+
run: tox -e py --skip-pkg-install -- "-n 2"
126+
continue-on-error: true
127+
- name: Mark as a success
128+
run: exit 0
129+

0 commit comments

Comments
 (0)