mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
326 lines
10 KiB
YAML
326 lines
10 KiB
YAML
on:
|
|
push:
|
|
branches: [main, release]
|
|
pull_request:
|
|
|
|
name: CI
|
|
|
|
env:
|
|
CARGO_ARGS: --features ssl,jit
|
|
NON_WASM_PACKAGES: >
|
|
-p rustpython-bytecode
|
|
-p rustpython-common
|
|
-p rustpython-compiler
|
|
-p rustpython-parser
|
|
-p rustpython-vm
|
|
-p rustpython-stdlib
|
|
-p rustpython-jit
|
|
-p rustpython-derive
|
|
-p rustpython
|
|
PLATFORM_INDEPENDENT_TESTS: >-
|
|
test_argparse
|
|
test_array
|
|
test_asyncgen
|
|
test_bytes
|
|
test_calendar
|
|
test_complex
|
|
test_decimal
|
|
test_dis
|
|
test_json
|
|
test_list
|
|
test_long
|
|
test_set
|
|
test_unicode
|
|
test_weakref
|
|
|
|
jobs:
|
|
rust_tests:
|
|
env:
|
|
RUST_BACKTRACE: full
|
|
name: Run rust tests
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [macos-11, ubuntu-latest, windows-latest]
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
- name: Set up the Windows environment
|
|
shell: bash
|
|
run: |
|
|
choco install llvm openssl
|
|
echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV
|
|
if: runner.os == 'Windows'
|
|
- name: Set up the Mac environment
|
|
run: brew install autoconf automake libtool
|
|
if: runner.os == 'macOS'
|
|
- uses: Swatinem/rust-cache@v1
|
|
- name: run rust tests
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|
|
args: --workspace --exclude rustpython_wasm --verbose ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }}
|
|
- name: check compilation without threading
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: ${{ env.CARGO_ARGS }} --no-default-features
|
|
|
|
- name: prepare AppleSilicon build
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
target: aarch64-apple-darwin
|
|
if: runner.os == 'macOS'
|
|
- name: Check compilation for Apple Silicon
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target aarch64-apple-darwin
|
|
if: runner.os == 'macOS'
|
|
|
|
exotic_targets:
|
|
name: Ensure compilation on various targets
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
target: i686-unknown-linux-gnu
|
|
|
|
- name: Install gcc-multilib
|
|
run: sudo apt-get update && sudo apt-get install gcc-multilib
|
|
- name: Check compilation for x86 32bit
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target i686-unknown-linux-gnu
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
target: aarch64-linux-android
|
|
|
|
- name: Check compilation for android
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target aarch64-linux-android
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
target: wasm32-wasi
|
|
|
|
- name: Check compilation for wasi
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target wasm32-wasi --features freeze-stdlib
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
target: x86_64-unknown-freebsd
|
|
|
|
- name: Check compilation for freeBSD
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: check
|
|
args: --target x86_64-unknown-freebsd
|
|
|
|
- name: Prepare repository for redox compilation
|
|
run: bash scripts/redox/uncomment-cargo.sh
|
|
- name: Check compilation for Redox
|
|
if: false # FIXME: redoxer toolchain is from ~july 2021, edition2021 isn't stabilized
|
|
uses: coolreader18/redoxer-action@v1
|
|
with:
|
|
command: check
|
|
|
|
snippets_cpython:
|
|
env:
|
|
RUST_BACKTRACE: full
|
|
name: Run snippets and cpython tests
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.10"
|
|
- name: Set up the Windows environment
|
|
shell: bash
|
|
run: |
|
|
choco install llvm openssl
|
|
echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV
|
|
if: runner.os == 'Windows'
|
|
- name: Set up the Mac environment
|
|
run: brew install autoconf automake libtool
|
|
if: runner.os == 'macOS'
|
|
- uses: Swatinem/rust-cache@v1
|
|
- name: build rustpython
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --release --verbose ${{ env.CARGO_ARGS }}
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.10"
|
|
- name: Install pipenv
|
|
run: |
|
|
python -V
|
|
python -m pip install --upgrade pip
|
|
python -m pip install pipenv
|
|
- run: pipenv install --python "3.10"
|
|
working-directory: ./extra_tests
|
|
- name: run snippets
|
|
run: pipenv run pytest -v
|
|
working-directory: ./extra_tests
|
|
- if: runner.os == 'Linux'
|
|
name: run cpython platform-independent tests
|
|
run:
|
|
target/release/rustpython -m test -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
|
|
- if: runner.os != 'Windows'
|
|
name: run cpython platform-dependent tests
|
|
run: target/release/rustpython -m test -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
|
|
- if: runner.os == 'Windows'
|
|
name: run cpython platform-dependent tests (windows partial - fixme)
|
|
run:
|
|
target/release/rustpython -m test -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }}
|
|
test_bool
|
|
test_cgi
|
|
test_exception_hierarchy
|
|
test_glob
|
|
test_importlib
|
|
test_io
|
|
test_iter
|
|
test_os
|
|
test_pathlib
|
|
test_pwd
|
|
test_py_compile
|
|
test_shutil
|
|
test_sys
|
|
test_unittest
|
|
test_venv
|
|
test_zipimport
|
|
- # if: runner.os == 'Linux'
|
|
if: false # FIXME: pip is vendoring dependencies that we are incompatible with
|
|
name: check that --install-pip succeeds
|
|
run: |
|
|
mkdir site-packages
|
|
target/release/rustpython --install-pip -t site-packages
|
|
|
|
lint:
|
|
name: Check Rust code with rustfmt and clippy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: nightly
|
|
components: rustfmt, clippy
|
|
override: true
|
|
- name: run rustfmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: --all -- --check
|
|
- name: run clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
|
|
- name: run clippy on wasm
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.10"
|
|
- name: install flake8
|
|
run: python -m pip install flake8
|
|
- name: run lint
|
|
run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib,./benches/ --select=E9,F63,F7,F82 --show-source --statistics
|
|
- 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:
|
|
name: Run tests under miri
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: nightly
|
|
components: miri
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v1
|
|
- 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
|
|
|
|
wasm:
|
|
name: Check the WASM package and demo
|
|
needs: rust_tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
- name: Cache cargo dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-wasm_opt3-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-debug_opt3-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: install wasm-pack
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
- name: install geckodriver
|
|
run: |
|
|
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
|
|
mkdir geckodriver
|
|
tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.10"
|
|
- name: Install pipenv
|
|
run: |
|
|
python -V
|
|
python -m pip install --upgrade pip
|
|
python -m pip install pipenv
|
|
- run: pipenv install
|
|
working-directory: ./wasm/tests
|
|
- uses: actions/setup-node@v1
|
|
- name: run test
|
|
run: |
|
|
export PATH=$PATH:`pwd`/../../geckodriver
|
|
npm install
|
|
npm run test
|
|
working-directory: ./wasm/demo
|
|
- name: build notebook demo
|
|
if: github.ref == 'refs/heads/release'
|
|
run: |
|
|
npm install
|
|
npm run dist
|
|
mv dist ../demo/dist/notebook
|
|
working-directory: ./wasm/notebook
|
|
- name: Deploy demo to Github Pages
|
|
if: success() && github.ref == 'refs/heads/release'
|
|
uses: peaceiris/actions-gh-pages@v2
|
|
env:
|
|
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }}
|
|
PUBLISH_DIR: ./wasm/demo/dist
|
|
EXTERNAL_REPOSITORY: RustPython/demo
|
|
PUBLISH_BRANCH: master
|