feat: rewrite using syn #320
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: [ "1.70", "stable", "nightly" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
run: rustup toolchain install ${{ matrix.version }} | |
- name: Restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.version }}-build | |
- name: Update dependencies | |
run: cargo update | |
- name: Check the project | |
run: cargo check --workspace | |
lint: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: -D warnings | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
run: | | |
rustup toolchain install nightly | |
rustup component add clippy --toolchain nightly-x86_64-unknown-linux-gnu | |
- name: Restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: lint | |
- name: Update dependencies | |
run: cargo update | |
- name: Lint the project | |
run: cargo +nightly clippy --workspace | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: [ "1.70","stable", "nightly" ] | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
run: rustup toolchain install ${{ matrix.version }} | |
- name: Restore cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.version }}-test | |
- name: Update dependencies | |
run: cargo update | |
- name: Test the project | |
run: cargo test --workspace | |
format: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
run: rustup toolchain install nightly | |
- name: Install nightly rustfmt | |
run: rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu | |
- name: Restore cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Check crate source formatting | |
run: cargo +nightly fmt --all -- --check | |
- name: Check ui tests formatting | |
run: find tests/ -name "*.rs" -exec rustfmt +nightly --check {} + | |
- name: Check grammar formatting | |
run: rustfmt +nightly --check rust-grammar-dpdfa/grammar.rs | |
readme-check: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Install toolchain | |
run: rustup toolchain install nightly | |
- name: Restore cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Update dependencies | |
run: cargo update | |
- name: Generate documentation JSON file | |
run: cargo +nightly rustdoc -- --output-format json -Zunstable-options | |
- name: Compare README with crate-level documentation | |
run: cat target/doc/expandable.json | jq ".index[.root | tostring].docs" -r | cmp README.md - | |
grammar-check: | |
runs-on: ubuntu-latest | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
run: rustup toolchain install nightly | |
- name: Install nightly rustfmt | |
run: rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu | |
- name: Update dependencies | |
run: cargo update | |
- name: Generate a new generated.rs file | |
run: cargo +nightly run -p grammar-gen -- rust-grammar-dpdfa/grammar.rs generated.rs | |
- name: Compare new generated.rs file with HEAD | |
run: cmp -l rust-grammar-dpdfa/src/generated.rs generated.rs |