forked from Rust-related/RustPython
258 lines
7.9 KiB
YAML
258 lines
7.9 KiB
YAML
on:
|
|
pull_request:
|
|
branches: [dev]
|
|
types: [unlabeled, opened, synchronize, reopened]
|
|
merge_group:
|
|
workflow_dispatch:
|
|
|
|
name: Dev-CI
|
|
|
|
env:
|
|
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,sqlite,ssl
|
|
# PLATFORM_INDEPENDENT_TESTS are tests that do not depend on the underlying OS. They are currently
|
|
# only run on Linux to speed up the CI.
|
|
PLATFORM_INDEPENDENT_TESTS: >-
|
|
test__colorize
|
|
test_array
|
|
test_asyncgen
|
|
test_binop
|
|
test_bisect
|
|
test_bool
|
|
test_bytes
|
|
test_call
|
|
test_class
|
|
test_cmath
|
|
test_collections
|
|
test_complex
|
|
test_contains
|
|
test_copy
|
|
test_dataclasses
|
|
test_decimal
|
|
test_decorators
|
|
test_defaultdict
|
|
test_deque
|
|
test_dict
|
|
test_dictcomps
|
|
test_dictviews
|
|
test_dis
|
|
test_enumerate
|
|
test_exception_variations
|
|
test_float
|
|
test_format
|
|
test_fractions
|
|
test_genericalias
|
|
test_genericclass
|
|
test_grammar
|
|
test_range
|
|
test_index
|
|
test_int
|
|
test_int_literal
|
|
test_isinstance
|
|
test_iter
|
|
test_iterlen
|
|
test_itertools
|
|
test_json
|
|
test_keyword
|
|
test_keywordonlyarg
|
|
test_list
|
|
test_long
|
|
test_longexp
|
|
test_math
|
|
test_operator
|
|
test_ordered_dict
|
|
test_pow
|
|
test_raise
|
|
test_richcmp
|
|
test_scope
|
|
test_set
|
|
test_slice
|
|
test_sort
|
|
test_string
|
|
test_string_literals
|
|
test_strtod
|
|
test_structseq
|
|
test_subclassinit
|
|
test_super
|
|
test_syntax
|
|
test_tuple
|
|
test_types
|
|
test_unary
|
|
test_unpack
|
|
test_weakref
|
|
test_yield_from
|
|
# Python version targeted by the CI.
|
|
PYTHON_VERSION: "3.13.1"
|
|
|
|
jobs:
|
|
rust_tests:
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
|
|
env:
|
|
RUST_BACKTRACE: full
|
|
name: Run rust tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: run clippy
|
|
run: cargo clippy ${{ env.CARGO_ARGS }} --workspace --exclude rustpython_wasm -- -Dwarnings
|
|
|
|
- name: run rust tests
|
|
run: cargo test --workspace --exclude rustpython_wasm --verbose --features threading ${{ env.CARGO_ARGS }}
|
|
|
|
- name: check compilation without threading
|
|
run: cargo check ${{ env.CARGO_ARGS }}
|
|
|
|
- name: Test example projects
|
|
run:
|
|
cargo run --manifest-path example_projects/barebone/Cargo.toml
|
|
cargo run --manifest-path example_projects/frozen_stdlib/Cargo.toml
|
|
|
|
exotic_targets:
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
|
|
name: Ensure compilation on various targets
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: i686-unknown-linux-gnu
|
|
|
|
- name: Install gcc-multilib and musl-tools
|
|
run: sudo apt-get update && sudo apt-get install gcc-multilib musl-tools
|
|
- name: Check compilation for x86 32bit
|
|
run: cargo check --target i686-unknown-linux-gnu
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: aarch64-linux-android
|
|
|
|
- name: Check compilation for android
|
|
run: cargo check --target aarch64-linux-android
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
- name: Install gcc-aarch64-linux-gnu
|
|
run: sudo apt install gcc-aarch64-linux-gnu
|
|
- name: Check compilation for aarch64 linux gnu
|
|
run: cargo check --target aarch64-unknown-linux-gnu
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: i686-unknown-linux-musl
|
|
|
|
- name: Check compilation for musl
|
|
run: cargo check --target i686-unknown-linux-musl
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: x86_64-unknown-freebsd
|
|
|
|
- name: Check compilation for freebsd
|
|
run: cargo check --target x86_64-unknown-freebsd
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: x86_64-unknown-freebsd
|
|
|
|
- name: Check compilation for freeBSD
|
|
run: cargo check --target x86_64-unknown-freebsd
|
|
|
|
- name: Prepare repository for redox compilation
|
|
run: bash scripts/redox/uncomment-cargo.sh
|
|
- name: Check compilation for Redox
|
|
uses: coolreader18/redoxer-action@v1
|
|
with:
|
|
command: check
|
|
args: --ignore-rust-version
|
|
|
|
snippets_cpython:
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
|
|
env:
|
|
RUST_BACKTRACE: full
|
|
name: Run snippets and cpython tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
- name: build rustpython
|
|
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }},jit
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
- name: run snippets
|
|
run: python -m pip install -r requirements.txt && pytest -v
|
|
working-directory: ./extra_tests
|
|
- name: run cpython platform-independent tests
|
|
run:
|
|
target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
|
|
- name: run cpython platform-dependent tests (Linux)
|
|
run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
|
|
- name: check that --install-pip succeeds
|
|
run: |
|
|
mkdir site-packages
|
|
target/release/rustpython --install-pip ensurepip --user
|
|
target/release/rustpython -m pip install six
|
|
- name: Check that ensurepip succeeds.
|
|
run: |
|
|
target/release/rustpython -m ensurepip
|
|
target/release/rustpython -c "import pip"
|
|
- name: Check if pip inside venv is functional
|
|
run: |
|
|
target/release/rustpython -m venv testvenv
|
|
testvenv/bin/rustpython -m pip install wheel
|
|
- name: Check whats_left is not broken
|
|
run: python -I whats_left.py
|
|
|
|
lint:
|
|
name: Check Rust code with rustfmt and clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- name: run rustfmt
|
|
run: cargo fmt --check
|
|
- name: run clippy on wasm
|
|
run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
- name: install ruff
|
|
run: python -m pip install ruff==0.0.291 # astral-sh/ruff#7778
|
|
- name: run python lint
|
|
run: ruff extra_tests wasm examples --exclude='./.*',./Lib,./vm/Lib,./benches/ --select=E9,F63,F7,F82 --show-source
|
|
- name: install prettier
|
|
run: yarn global add prettier && echo "$(yarn global bin)" >>$GITHUB_PATH
|
|
- name: check wasm code with prettier
|
|
# prettier doesn't handle ignore files very well: https://github.com/prettier/prettier/issues/8506
|
|
run: cd wasm && git ls-files -z | xargs -0 prettier --check -u
|
|
|
|
miri:
|
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
|
|
name: Run tests under miri
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: nightly
|
|
components: miri
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Run tests under miri
|
|
# miri-ignore-leaks because the type-object circular reference means that there will always be
|
|
# a memory leak, at least until we have proper cyclic gc
|
|
run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test
|
|
|