Skip to content

Commit 21e0ad6

Browse files
authored
Merge pull request RustPython#2360 from RustPython/master
Merge to release
2 parents 8d51040 + 9b76dc3 commit 21e0ad6

File tree

842 files changed

+191855
-34366
lines changed

Some content is hidden

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

842 files changed

+191855
-34366
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.vscode
99
wasm-pack.log
1010
.idea/
11-
tests/snippets/resources
11+
extra_tests/snippets/resources
1212

1313
flame-graph.html
1414
flame.txt

.github/workflows/ci.yaml

Lines changed: 118 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
on:
22
push:
33
branches: [master, release]
4-
pull_request:
4+
pull_request:
55

66
name: CI
77

8+
env:
9+
CARGO_ARGS: --features "ssl jit"
10+
NON_WASM_PACKAGES: >
11+
-p rustpython-bytecode
12+
-p rustpython-common
13+
-p rustpython-compiler
14+
-p rustpython-parser
15+
-p rustpython-vm
16+
-p rustpython-jit
17+
-p rustpython-derive
18+
-p rustpython
19+
820
jobs:
921
rust_tests:
1022
name: Run rust tests
@@ -15,61 +27,108 @@ jobs:
1527
fail-fast: false
1628
steps:
1729
- uses: actions/checkout@master
18-
- name: Convert symlinks to hardlink (windows only)
19-
run: powershell.exe scripts/symlinks-to-hardlinks.ps1
30+
- uses: actions-rs/toolchain@v1
31+
- name: Set up the Windows environment
32+
run: |
33+
choco install llvm
34+
powershell.exe scripts/symlinks-to-hardlinks.ps1
2035
if: runner.os == 'Windows'
36+
- name: Set up the Mac environment
37+
run: brew install autoconf automake libtool
38+
if: runner.os == 'macOS'
2139
- name: Cache cargo dependencies
22-
uses: actions/cache@v1
40+
uses: actions/cache@v2
2341
with:
24-
key: ${{ runner.os }}-rust_tests-${{ hashFiles('Cargo.lock') }}
25-
path: target
26-
restore-keys: |
27-
${{ runner.os }}-rust_tests-
42+
path: |
43+
~/.cargo/registry
44+
~/.cargo/git
45+
target
46+
key: ${{ runner.os }}-debug_opt3-${{ hashFiles('**/Cargo.lock') }}
2847
- name: run rust tests
2948
uses: actions-rs/cargo@v1
3049
with:
3150
command: test
32-
args: --verbose --all
51+
args: --verbose ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }}
52+
- name: check compilation without threading
53+
uses: actions-rs/cargo@v1
54+
with:
55+
command: check
56+
args: ${{ env.CARGO_ARGS }} --no-default-features
3357

34-
snippets:
35-
name: Run snippets tests
58+
snippets_cpython:
59+
name: Run snippets and cpython tests
3660
runs-on: ${{ matrix.os }}
3761
strategy:
3862
matrix:
3963
os: [macos-latest, ubuntu-latest, windows-latest]
4064
fail-fast: false
4165
steps:
4266
- uses: actions/checkout@master
43-
- name: Convert symlinks to hardlink (windows only)
44-
run: powershell.exe scripts/symlinks-to-hardlinks.ps1
67+
- uses: actions-rs/toolchain@v1
68+
- uses: actions/setup-python@v2
69+
with:
70+
python-version: 3.8
71+
- name: Set up the Windows environment
72+
run: |
73+
choco install llvm
74+
powershell.exe scripts/symlinks-to-hardlinks.ps1
4575
if: runner.os == 'Windows'
76+
- name: Set up the Mac environment
77+
run: brew install autoconf automake libtool
78+
if: runner.os == 'macOS'
4679
- name: Cache cargo dependencies
47-
uses: actions/cache@v1
80+
uses: actions/cache@v2
81+
# cache gets corrupted for some reason on mac
82+
if: runner.os != 'macOS'
4883
with:
49-
key: ${{ runner.os }}-snippets-${{ hashFiles('Cargo.lock') }}
50-
path: target
51-
restore-keys: |
52-
${{ runner.os }}-snippets-
84+
path: |
85+
~/.cargo/registry
86+
~/.cargo/git
87+
target
88+
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
5389
- name: build rustpython
5490
uses: actions-rs/cargo@v1
5591
with:
5692
command: build
57-
args: --release --verbose --all
93+
args: --release --verbose ${{ env.CARGO_ARGS }}
5894
- uses: actions/setup-python@v1
5995
with:
60-
python-version: 3.6
96+
python-version: 3.8
6197
- name: Install pipenv
6298
run: |
6399
python -V
64100
python -m pip install --upgrade pip
65101
python -m pip install pipenv
66-
- run: pipenv install
67-
working-directory: ./tests
102+
- run: pipenv install --python 3.8
103+
working-directory: ./extra_tests
68104
- name: run snippets
69105
run: pipenv run pytest -v
70-
working-directory: ./tests
106+
working-directory: ./extra_tests
107+
- name: run cpython tests
108+
run: target/release/rustpython -m test -v
109+
env:
110+
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
111+
if: runner.os == 'Linux'
112+
- name: run cpython tests (macOS lightweight)
113+
run:
114+
target/release/rustpython -m test -v -x
115+
test_argparse test_json test_bytes test_bytearray test_long test_unicode test_array
116+
test_asyncgen test_list test_complex test_json test_set test_dis test_calendar
117+
env:
118+
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
119+
if: runner.os == 'macOS'
120+
- name: run cpython tests (windows partial - fixme)
121+
run:
122+
target/release/rustpython -m test -v -x
123+
test_argparse test_json test_bytes test_long test_pwd test_bool test_cgi test_complex
124+
test_exception_hierarchy test_glob test_iter test_list test_os test_pathlib
125+
test_py_compile test_set test_shutil test_sys test_unicode test_unittest test_venv
126+
test_zipimport test_importlib test_io
127+
env:
128+
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
129+
if: runner.os == 'Windows'
71130

72-
format:
131+
lint:
73132
name: Check Rust code with rustfmt and clippy
74133
runs-on: ubuntu-latest
75134
steps:
@@ -89,48 +148,51 @@ jobs:
89148
uses: actions-rs/cargo@v1
90149
with:
91150
command: clippy
92-
args: --all -- -Dwarnings
93-
94-
lint:
95-
name: Lint Python code with flake8
96-
runs-on: ubuntu-latest
97-
steps:
98-
- uses: actions/checkout@master
151+
args: ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
152+
- name: run clippy on wasm
153+
uses: actions-rs/cargo@v1
154+
with:
155+
command: clippy
156+
args: --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
99157
- uses: actions/setup-python@v1
100158
with:
101-
python-version: 3.6
159+
python-version: 3.8
102160
- name: install flake8
103161
run: python -m pip install flake8
104162
- name: run lint
105-
run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib --select=E9,F63,F7,F82 --show-source --statistics
106-
107-
cpython:
108-
name: Run CPython test suite
163+
run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib,./benches/ --select=E9,F63,F7,F82 --show-source --statistics
164+
miri:
165+
name: Run tests under miri
109166
runs-on: ubuntu-latest
110167
steps:
111168
- uses: actions/checkout@master
112-
- name: build rustpython
113-
uses: actions-rs/cargo@v1
169+
- uses: actions-rs/toolchain@v1
114170
with:
115-
command: build
116-
args: --verbose --all
117-
- name: run tests
118-
run: |
119-
export RUSTPYTHONPATH=`pwd`/Lib
120-
cargo run -- -m test -v
171+
profile: minimal
172+
toolchain: nightly
173+
components: miri
174+
override: true
175+
- name: Run tests under miri
176+
# miri-ignore-leaks because the type-object circular reference means that there will always be
177+
# a memory leak, at least until we have proper cyclic gc
178+
run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test
121179

122180
wasm:
123181
name: Check the WASM package and demo
182+
needs: rust_tests
124183
runs-on: ubuntu-latest
125184
steps:
126185
- uses: actions/checkout@master
127186
- name: Cache cargo dependencies
128-
uses: actions/cache@v1
187+
uses: actions/cache@v2
129188
with:
130-
key: ${{ runner.os }}-wasm-${{ hashFiles('**/Cargo.lock') }}
131-
path: target
189+
path: |
190+
~/.cargo/registry
191+
~/.cargo/git
192+
target
193+
key: ${{ runner.os }}-wasm_opt3-${{ hashFiles('**/Cargo.lock') }}
132194
restore-keys: |
133-
${{ runner.os }}-wasm-
195+
${{ runner.os }}-debug_opt3-${{ hashFiles('**/Cargo.lock') }}
134196
- name: install wasm-pack
135197
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
136198
- name: install geckodriver
@@ -140,7 +202,7 @@ jobs:
140202
tar -xzf geckodriver-v0.24.0-linux32.tar.gz -C geckodriver
141203
- uses: actions/setup-python@v1
142204
with:
143-
python-version: 3.6
205+
python-version: 3.8
144206
- name: Install pipenv
145207
run: |
146208
python -V
@@ -155,6 +217,13 @@ jobs:
155217
npm install
156218
npm run test
157219
working-directory: ./wasm/demo
220+
- name: build notebook demo
221+
if: github.ref == 'refs/heads/release'
222+
run: |
223+
npm install
224+
npm run dist
225+
mv dist ../demo/dist/notebook
226+
working-directory: ./wasm/notebook
158227
- name: Deploy demo to Github Pages
159228
if: success() && github.ref == 'refs/heads/release'
160229
uses: peaceiris/actions-gh-pages@v2

.github/workflows/cron-ci.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
on:
2+
schedule:
3+
- cron: '0 0 * * 6'
4+
5+
jobs:
6+
redox:
7+
name: Check compilation on Redox
8+
runs-on: ubuntu-latest
9+
container:
10+
image: redoxos/redoxer:latest
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: prepare repository for redoxer compilation
14+
run: bash scripts/redox/uncomment-cargo.sh
15+
- name: compile for redox
16+
run: redoxer build --verbose
17+
18+
codecov:
19+
name: Collect code coverage data
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@master
23+
- uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: nightly
26+
override: true
27+
- uses: actions-rs/cargo@v1
28+
with:
29+
command: build
30+
args: --verbose
31+
env:
32+
CARGO_INCREMENTAL: '0'
33+
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests' # -Cpanic=abort
34+
- uses: actions/setup-python@v1
35+
with:
36+
python-version: 3.8
37+
- name: Install pipenv
38+
run: |
39+
python -V
40+
python -m pip install --upgrade pip
41+
python -m pip install pipenv
42+
- run: pipenv install
43+
working-directory: ./extra_tests
44+
- name: run snippets
45+
run: pipenv run pytest -v
46+
working-directory: ./extra_tests
47+
env:
48+
RUSTPYTHON_DEBUG: 'true'
49+
- name: run cpython tests
50+
run: cargo run -- -m test -v
51+
env:
52+
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
53+
- uses: actions-rs/[email protected]
54+
id: coverage
55+
- name: upload to Codecov
56+
uses: codecov/codecov-action@v1
57+
with:
58+
file: ${{ steps.coverage.outputs.report }}
59+
60+
testdata:
61+
name: Collect regression test data
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@master
65+
- name: build rustpython
66+
uses: actions-rs/cargo@v1
67+
with:
68+
command: build
69+
args: --release --verbose
70+
- name: collect tests data
71+
run: cargo run --release extra_tests/jsontests.py
72+
env:
73+
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
74+
- name: upload tests data to the website
75+
env:
76+
SSHKEY: ${{ secrets.ACTIONS_TESTS_DATA_DEPLOY_KEY }}
77+
GITHUB_ACTOR: ${{ github.actor }}
78+
run: |
79+
echo "$SSHKEY" >~/github_key
80+
chmod 600 ~/github_key
81+
export GIT_SSH_COMMAND="ssh -i ~/github_key"
82+
83+
git clone [email protected]:RustPython/rustpython.github.io.git website
84+
cd website
85+
cp ../extra_tests/cpython_tests_results.json ./_data/regrtests_results.json
86+
git add ./_data/regrtests_results.json
87+
git -c user.name="Github Actions" -c user.email="[email protected]" commit -m "Update regression test results" --author="$GITHUB_ACTOR"
88+
git push

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ __pycache__
99
.vscode
1010
wasm-pack.log
1111
.idea/
12-
tests/snippets/resources
12+
extra_tests/snippets/resources
1313

1414
flame-graph.html
1515
flame.txt
1616
flamescope.json
1717
/wapm.lock
1818
/wapm_packages
19+
/.cargo/config

.gitpod.Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM gitpod/workspace-full
2+
3+
USER gitpod
4+
5+
# Update Rust to the latest version
6+
RUN rm -rf ~/.rustup && \
7+
export PATH=$HOME/.cargo/bin:$PATH && \
8+
rustup update stable && \
9+
rustup component add rls && \
10+
# Set up wasm-pack and wasm32-unknown-unknown for rustpython_wasm
11+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh && \
12+
rustup target add wasm32-unknown-unknown
13+
14+
RUN sudo apt-get -q update \
15+
&& sudo apt-get install -yq \
16+
libpython3.6 \
17+
rust-lldb \
18+
&& sudo rm -rf /var/lib/apt/lists/*
19+
ENV RUST_LLDB=/usr/bin/lldb-8
20+
21+
USER root

.gitpod.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
image:
2+
file: .gitpod.Dockerfile
3+
4+
vscode:
5+
extensions:
6+
- [email protected]:vTh/rWhvJ5nQpeAVsD20QA==

0 commit comments

Comments
 (0)