Skip to content

Commit 3887f7c

Browse files
committed
Switch to libz-rs-sys for zlib implementation
1 parent 235adaf commit 3887f7c

File tree

7 files changed

+148
-194
lines changed

7 files changed

+148
-194
lines changed

.github/workflows/ci.yaml

Lines changed: 68 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
env:
18-
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,sqlite,ssl
18+
CARGO_ARGS:
19+
--no-default-features --features stdlib,importlib,encodings,sqlite,ssl
1920
# Skip additional tests on Windows. They are checked on Linux and MacOS.
2021
# test_glob: many failing tests
2122
# test_io: many failing tests
@@ -24,88 +25,27 @@ env:
2425
# test_posixpath: OSError: (22, 'The filename, directory name, or volume label syntax is incorrect. (os error 123)')
2526
# test_venv: couple of failing tests
2627
WINDOWS_SKIPS: >-
27-
test_glob
28-
test_io
29-
test_os
30-
test_rlcompleter
31-
test_pathlib
32-
test_posixpath
28+
test_glob test_io test_os test_rlcompleter test_pathlib test_posixpath
3329
test_venv
3430
# configparser: https://github.com/RustPython/RustPython/issues/4995#issuecomment-1582397417
3531
# socketserver: seems related to configparser crash.
3632
MACOS_SKIPS: >-
37-
test_configparser
38-
test_socketserver
33+
test_configparser test_socketserver
3934
# PLATFORM_INDEPENDENT_TESTS are tests that do not depend on the underlying OS. They are currently
4035
# only run on Linux to speed up the CI.
4136
PLATFORM_INDEPENDENT_TESTS: >-
42-
test__colorize
43-
test_array
44-
test_asyncgen
45-
test_binop
46-
test_bisect
47-
test_bool
48-
test_bytes
49-
test_call
50-
test_class
51-
test_cmath
52-
test_collections
53-
test_complex
54-
test_contains
55-
test_copy
56-
test_dataclasses
57-
test_decimal
58-
test_decorators
59-
test_defaultdict
60-
test_deque
61-
test_dict
62-
test_dictcomps
63-
test_dictviews
64-
test_dis
65-
test_enumerate
66-
test_exception_variations
67-
test_float
68-
test_format
69-
test_fractions
70-
test_genericalias
71-
test_genericclass
72-
test_grammar
73-
test_range
74-
test_index
75-
test_int
76-
test_int_literal
77-
test_isinstance
78-
test_iter
79-
test_iterlen
80-
test_itertools
81-
test_json
82-
test_keyword
83-
test_keywordonlyarg
84-
test_list
85-
test_long
86-
test_longexp
87-
test_math
88-
test_operator
89-
test_ordered_dict
90-
test_pow
91-
test_raise
92-
test_richcmp
93-
test_scope
94-
test_set
95-
test_slice
96-
test_sort
97-
test_string
98-
test_string_literals
99-
test_strtod
100-
test_structseq
101-
test_subclassinit
102-
test_super
103-
test_syntax
104-
test_tuple
105-
test_types
106-
test_unary
107-
test_unpack
108-
test_weakref
37+
test__colorize test_array test_asyncgen test_binop test_bisect test_bool
38+
test_bytes test_call test_class test_cmath test_collections test_complex
39+
test_contains test_copy test_dataclasses test_decimal test_decorators
40+
test_defaultdict test_deque test_dict test_dictcomps test_dictviews test_dis
41+
test_enumerate test_exception_variations test_float test_format
42+
test_fractions test_genericalias test_genericclass test_grammar test_range
43+
test_index test_int test_int_literal test_isinstance test_iter test_iterlen
44+
test_itertools test_json test_keyword test_keywordonlyarg test_list
45+
test_long test_longexp test_math test_operator test_ordered_dict test_pow
46+
test_raise test_richcmp test_scope test_set test_slice test_sort test_string
47+
test_string_literals test_strtod test_structseq test_subclassinit test_super
48+
test_syntax test_tuple test_types test_unary test_unpack test_weakref
10949
test_yield_from
11050
# Python version targeted by the CI.
11151
PYTHON_VERSION: "3.13.1"
@@ -116,7 +56,7 @@ jobs:
11656
env:
11757
RUST_BACKTRACE: full
11858
name: Run rust tests
119-
runs-on: ${{ matrix.os }}
59+
runs-on: ${{ matrix.os }}
12060
strategy:
12161
matrix:
12262
os: [macos-latest, ubuntu-latest, windows-latest]
@@ -139,22 +79,28 @@ jobs:
13979
if: runner.os == 'macOS'
14080

14181
- name: run clippy
142-
run: cargo clippy ${{ env.CARGO_ARGS }} --workspace --exclude rustpython_wasm -- -Dwarnings
82+
run:
83+
cargo clippy ${{ env.CARGO_ARGS }} --workspace --exclude
84+
rustpython_wasm -- -Dwarnings
14385

14486
- name: run rust tests
145-
run: cargo test --workspace --exclude rustpython_wasm --verbose --features threading ${{ env.CARGO_ARGS }}
87+
run:
88+
cargo test --workspace --exclude rustpython_wasm --verbose --features
89+
threading ${{ env.CARGO_ARGS }}
14690
if: runner.os != 'macOS'
14791
- name: run rust tests
148-
run: cargo test --workspace --exclude rustpython_wasm --exclude rustpython-jit --verbose --features threading ${{ env.CARGO_ARGS }}
92+
run:
93+
cargo test --workspace --exclude rustpython_wasm --exclude
94+
rustpython-jit --verbose --features threading ${{ env.CARGO_ARGS }}
14995
if: runner.os == 'macOS'
15096

15197
- name: check compilation without threading
15298
run: cargo check ${{ env.CARGO_ARGS }}
15399

154100
- name: Test example projects
155101
run:
156-
cargo run --manifest-path example_projects/barebone/Cargo.toml
157-
cargo run --manifest-path example_projects/frozen_stdlib/Cargo.toml
102+
cargo run --manifest-path example_projects/barebone/Cargo.toml cargo
103+
run --manifest-path example_projects/frozen_stdlib/Cargo.toml
158104
if: runner.os == 'Linux'
159105

160106
- name: prepare AppleSilicon build
@@ -239,7 +185,7 @@ jobs:
239185
env:
240186
RUST_BACKTRACE: full
241187
name: Run snippets and cpython tests
242-
runs-on: ${{ matrix.os }}
188+
runs-on: ${{ matrix.os }}
243189
strategy:
244190
matrix:
245191
os: [macos-latest, ubuntu-latest, windows-latest]
@@ -261,10 +207,14 @@ jobs:
261207
run: brew install autoconf automake libtool openssl@3
262208
if: runner.os == 'macOS'
263209
- name: build rustpython
264-
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }}
210+
run:
211+
cargo build --release --verbose --features=threading ${{
212+
env.CARGO_ARGS }}
265213
if: runner.os == 'macOS'
266214
- name: build rustpython
267-
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }},jit
215+
run:
216+
cargo build --release --verbose --features=threading ${{
217+
env.CARGO_ARGS }},jit
268218
if: runner.os != 'macOS'
269219
- uses: actions/setup-python@v5
270220
with:
@@ -275,17 +225,23 @@ jobs:
275225
- if: runner.os == 'Linux'
276226
name: run cpython platform-independent tests
277227
run:
278-
target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
228+
target/release/rustpython -m test -j 1 -u all --slowest
229+
--fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
279230
- if: runner.os == 'Linux'
280231
name: run cpython platform-dependent tests (Linux)
281-
run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
232+
run:
233+
target/release/rustpython -m test -j 1 -u all --slowest
234+
--fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
282235
- if: runner.os == 'macOS'
283236
name: run cpython platform-dependent tests (MacOS)
284-
run: target/release/rustpython -m test -j 1 --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ env.MACOS_SKIPS }}
237+
run:
238+
target/release/rustpython -m test -j 1 --slowest --fail-env-changed -v
239+
-x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ env.MACOS_SKIPS }}
285240
- if: runner.os == 'Windows'
286241
name: run cpython platform-dependent tests (windows partial - fixme)
287242
run:
288-
target/release/rustpython -m test -j 1 --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ env.WINDOWS_SKIPS }}
243+
target/release/rustpython -m test -j 1 --slowest --fail-env-changed -v
244+
-x ${{ env.PLATFORM_INDEPENDENT_TESTS }} ${{ env.WINDOWS_SKIPS }}
289245
- if: runner.os != 'Windows'
290246
name: check that --install-pip succeeds
291247
run: |
@@ -312,7 +268,7 @@ jobs:
312268
- uses: actions/checkout@v4
313269
- uses: dtolnay/rust-toolchain@stable
314270
with:
315-
components: rustfmt, clippy
271+
components: rustfmt, clippy
316272
- name: run rustfmt
317273
run: cargo fmt --check
318274
- name: run clippy on wasm
@@ -323,9 +279,13 @@ jobs:
323279
- name: install ruff
324280
run: python -m pip install ruff==0.0.291 # astral-sh/ruff#7778
325281
- name: run python lint
326-
run: ruff extra_tests wasm examples --exclude='./.*',./Lib,./vm/Lib,./benches/ --select=E9,F63,F7,F82 --show-source
282+
run:
283+
ruff extra_tests wasm
284+
examples --exclude='./.*',./Lib,./vm/Lib,./benches/
285+
--select=E9,F63,F7,F82 --show-source
327286
- name: install prettier
328-
run: yarn global add prettier && echo "$(yarn global bin)" >>$GITHUB_PATH
287+
run:
288+
yarn global add prettier && echo "$(yarn global bin)" >>$GITHUB_PATH
329289
- name: check wasm code with prettier
330290
# prettier doesn't handle ignore files very well: https://github.com/prettier/prettier/issues/8506
331291
run: cd wasm && git ls-files -z | xargs -0 prettier --check -u
@@ -338,14 +298,16 @@ jobs:
338298
- uses: actions/checkout@v4
339299
- uses: dtolnay/rust-toolchain@master
340300
with:
341-
toolchain: nightly
342-
components: miri
301+
toolchain: nightly
302+
components: miri
343303

344304
- uses: Swatinem/rust-cache@v2
345305
- name: Run tests under miri
346306
# miri-ignore-leaks because the type-object circular reference means that there will always be
347307
# a memory leak, at least until we have proper cyclic gc
348-
run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test
308+
run:
309+
MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p
310+
rustpython-vm -- miri_test
349311

350312
wasm:
351313
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
@@ -357,7 +319,8 @@ jobs:
357319

358320
- uses: Swatinem/rust-cache@v2
359321
- name: install wasm-pack
360-
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
322+
run:
323+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
361324
- name: install geckodriver
362325
run: |
363326
wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
@@ -420,8 +383,14 @@ jobs:
420383
- name: Install clang
421384
run: sudo apt-get update && sudo apt-get install clang -y
422385
- name: build rustpython
423-
run: cargo build --release --target wasm32-wasip1 --features freeze-stdlib,stdlib --verbose
386+
run:
387+
cargo build --release --target wasm32-wasip1 --features
388+
freeze-stdlib,stdlib --verbose
424389
- name: run snippets
425-
run: wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm -- `pwd`/extra_tests/snippets/stdlib_random.py
390+
run:
391+
wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm --
392+
`pwd`/extra_tests/snippets/stdlib_random.py
426393
- name: run cpython unittest
427-
run: wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm -- `pwd`/Lib/test/test_int.py
394+
run:
395+
wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm --
396+
`pwd`/Lib/test/test_int.py

.github/workflows/cron-ci.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
on:
22
schedule:
3-
- cron: '0 0 * * 6'
3+
- cron: "0 0 * * 6"
44
workflow_dispatch:
55

66
name: Periodic checks/tasks
77

88
env:
9-
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit
9+
CARGO_ARGS:
10+
--no-default-features --features stdlib,importlib,encodings,ssl,jit
1011
PYTHON_VERSION: "3.13.1"
1112

1213
jobs:
@@ -24,12 +25,17 @@ jobs:
2425
python-version: ${{ env.PYTHON_VERSION }}
2526
- run: sudo apt-get update && sudo apt-get -y install lcov
2627
- name: Run cargo-llvm-cov with Rust tests.
27-
run: cargo llvm-cov --no-report --workspace --exclude rustpython_wasm --verbose --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit
28+
run:
29+
cargo llvm-cov --no-report --workspace --exclude rustpython_wasm
30+
--verbose --no-default-features --features
31+
stdlib,importlib,encodings,ssl,jit
2832
- name: Run cargo-llvm-cov with Python snippets.
2933
run: python scripts/cargo-llvm-cov.py
3034
continue-on-error: true
3135
- name: Run cargo-llvm-cov with Python test suite.
32-
run: cargo llvm-cov --no-report run -- -m test -u all --slowest --fail-env-changed
36+
run:
37+
cargo llvm-cov --no-report run -- -m test -u all --slowest
38+
--fail-env-changed
3339
continue-on-error: true
3440
- name: Prepare code coverage data
3541
run: cargo llvm-cov report --lcov --output-path='codecov.lcov'

0 commit comments

Comments
 (0)