mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Restructure CI with matrix approach and multi-feature support (#7376)
* `--features` flag can take multiple values * Simplify CI job * Remove bad default * Enable jit on macOS
This commit is contained in:
1 parent
d9020c5841
commit
ab32c785ea
2 files changed
+20
-21
No files matched your search
+11
-16
@@ -293,7 +293,10 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-2025]
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
- windows-2025
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.2
|
||||
@@ -302,18 +305,14 @@ jobs:
|
||||
- uses: actions/setup-python@v6.2.0
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Set up the Mac environment
|
||||
run: brew install autoconf automake libtool openssl@3
|
||||
if: runner.os == 'macOS'
|
||||
|
||||
- name: build rustpython
|
||||
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }}
|
||||
if: runner.os == 'macOS'
|
||||
- name: build rustpython
|
||||
run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }},jit
|
||||
if: runner.os != 'macOS'
|
||||
- uses: actions/setup-python@v6.2.0
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
run: cargo build --release --verbose --features=threading,jit ${{ env.CARGO_ARGS }}
|
||||
|
||||
- name: run snippets
|
||||
run: python -m pip install -r requirements.txt && pytest -v
|
||||
working-directory: ./extra_tests
|
||||
@@ -445,14 +444,10 @@ jobs:
|
||||
run: |
|
||||
target/release/rustpython -m venv testvenv
|
||||
testvenv/bin/rustpython -m pip install wheel
|
||||
- if: runner.os != 'macOS'
|
||||
name: Check whats_left is not broken
|
||||
|
||||
- name: Check whats_left is not broken
|
||||
shell: bash
|
||||
run: python -I scripts/whats_left.py --no-default-features --features "$(sed -e 's/--[^ ]*//g' <<< "${{ env.CARGO_ARGS }}" | tr -d '[:space:]'),threading,jit"
|
||||
- if: runner.os == 'macOS' # TODO fix jit on macOS
|
||||
name: Check whats_left is not broken (macOS)
|
||||
shell: bash
|
||||
run: python -I scripts/whats_left.py --no-default-features --features "$(sed -e 's/--[^ ]*//g' <<< "${{ env.CARGO_ARGS }}" | tr -d '[:space:]'),threading" # no jit on macOS for now
|
||||
run: python -I scripts/whats_left.py ${{ env.CARGO_ARGS }} --features jit
|
||||
|
||||
lint:
|
||||
name: Lint Rust & Python code
|
||||
|
||||
@@ -67,9 +67,9 @@ def parse_args():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--features",
|
||||
action="store",
|
||||
help="which features to enable when building RustPython (default: ssl)",
|
||||
default="ssl",
|
||||
action="append",
|
||||
help="which features to enable when building RustPython (default: [])",
|
||||
default=[],
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
@@ -449,16 +449,20 @@ with open(GENERATED_FILE, "w", encoding="utf-8") as f:
|
||||
cargo_build_command = ["cargo", "build", "--release"]
|
||||
if args.no_default_features:
|
||||
cargo_build_command.append("--no-default-features")
|
||||
|
||||
joined_features = ",".join(args.features)
|
||||
if args.features:
|
||||
cargo_build_command.extend(["--features", args.features])
|
||||
cargo_build_command.extend(["--features", joined_features])
|
||||
|
||||
subprocess.run(cargo_build_command, check=True)
|
||||
|
||||
cargo_run_command = ["cargo", "run", "--release"]
|
||||
if args.no_default_features:
|
||||
cargo_run_command.append("--no-default-features")
|
||||
|
||||
if args.features:
|
||||
cargo_run_command.extend(["--features", args.features])
|
||||
cargo_run_command.extend(["--features", joined_features])
|
||||
|
||||
cargo_run_command.extend(["-q", "--", GENERATED_FILE])
|
||||
|
||||
result = subprocess.run(
|
||||
|
||||
Reference in new issue
Block a user