Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Lib/** linguist-vendored
Cargo.lock linguist-generated -merge
parser/src/python.rs linguist-generated -diff -merge
ast/src/ast_gen.rs linguist-generated -merge
vm/src/stdlib/ast/gen.rs linguist-generated -merge
parser/python.lalrpop text eol=LF
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,19 @@ jobs:
env:
RUST_BACKTRACE: full
name: Run rust tests
needs: lalrpop
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}
- uses: dtolnay/rust-toolchain@stable
- name: Set up the Windows environment
shell: bash
Expand Down Expand Up @@ -143,9 +149,15 @@ jobs:

exotic_targets:
name: Ensure compilation on various targets
needs: lalrpop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}

- uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -200,6 +212,7 @@ jobs:
command: check

snippets_cpython:
needs: lalrpop
env:
RUST_BACKTRACE: full
name: Run snippets and cpython tests
Expand All @@ -210,6 +223,12 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}

- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -258,11 +277,49 @@ jobs:
mkdir site-packages
target/release/rustpython --install-pip ensurepip --user

lalrpop:
name: Generate parser with lalrpop
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}
- name: Check if cached generated parser exists
id: generated_parser
uses: andstor/file-existence-action@v1
with:
files: "parser/python.rs"
- if: runner.os == 'Windows'
name: Force python.lalrpop to be lf # actions@checkout ignore .gitattributes
run: |
set file parser/python.lalrpop; ((Get-Content $file) -join "`n") + "`n" | Set-Content -NoNewline $file
- name: Install lalrpop
if: steps.generated_parser.outputs.files_exists == 'false'
uses: baptiste0928/cargo-install@v1
with:
crate: lalrpop
version: "0.19.8"
- name: Run lalrpop
if: steps.generated_parser.outputs.files_exists == 'false'
run: lalrpop parser/python.lalrpop

lint:
name: Check Rust code with rustfmt and clippy
needs: lalrpop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
Expand All @@ -284,11 +341,18 @@ jobs:
- 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
needs: lalrpop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
Expand All @@ -304,6 +368,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v1
- name: install wasm-pack
Expand Down Expand Up @@ -343,9 +412,15 @@ jobs:

wasm-wasi:
name: Run snippets and cpython tests on wasm-wasi
needs: lalrpop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache generated parser
uses: actions/cache@v2
with:
path: parser/python.rs
key: lalrpop-${{ hashFiles('parser/python.lalrpop') }}
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasi
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ flamescope.json

extra_tests/snippets/resources
extra_tests/not_impl.py

parser/python.rs
129 changes: 127 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading