Appease clippy #260
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
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/rust.yaml' | |
- 'brilirs/**/*.rs' | |
- 'brilirs/**/*.toml' | |
- 'brilift/**/*.rs' | |
- 'brilift/**/*.toml' | |
- 'bril-rs/**/*.rs' | |
- 'bril-rs/**/*.toml' | |
- 'bril-rs/**/*.lalrpop' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/rust.yaml' | |
- 'brilirs/**/*.rs' | |
- 'brilirs/**/*.toml' | |
- 'brilift/**/*.rs' | |
- 'brilift/**/*.toml' | |
- 'bril-rs/**/*.rs' | |
- 'bril-rs/**/*.toml' | |
- 'bril-rs/**/*.lalrpop' | |
name: Workflow checks for rust code | |
env: | |
LLVM_VERSION: 18.0 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
test-code: | |
- "cd bril-rs && make test TURNTARGS=-v" | |
- "cd brilirs && make test TURNTARGS=-v" | |
- "cd brilirs && make benchmark TURNTARGS=-v" | |
- "cd brilift && cargo build --release && make rt.o && make test TURNTARGS=-v" | |
- "cd brilift && cargo build --release && make rt.o && make benchmark TURNTARGS=-v" | |
# Code requiring additional dependencies are separated out | |
include: | |
- test-code: "cd bril-rs && make features" | |
needs_cargo_hack: true | |
- test-code: "cd bril-rs/brillvm && make build" | |
needs_llvm: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install LLVM and Clang | |
if: matrix.needs_llvm | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh ${{ env.LLVM_VERSION }} all | |
- name: Install cargo-hack for feature-flag checking | |
run: cargo install cargo-hack | |
if: matrix.needs_cargo_hack | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: pip | |
cache-dependency-path: bril-txt/pyproject.toml | |
- name: Install Flit | |
run: pip install flit | |
- name: Install Python tools | |
run: cd bril-txt ; flit install --symlink | |
- name: Install Turnt | |
# run: pip install turnt # Use instead if pip turnt version >= 1.7 | |
uses: actions/checkout@v4 | |
with: | |
repository: cucapra/turnt | |
path: './turnt' | |
- name: Install Turnt part 2 | |
run: flit install --symlink | |
working-directory: ./turnt | |
- name: Problem matcher | |
run: echo '::add-matcher::.github/tap-matcher.json' | |
- name: Run test | |
run: ${{ matrix.test-code }} | |
rust-ci: | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: -D warnings | |
RUSTFLAGS: -D warnings | |
strategy: | |
matrix: | |
path: ["brilirs/Cargo.toml", "bril-rs/Cargo.toml", "bril-rs/bril2json/Cargo.toml", "bril-rs/brild/Cargo.toml", "brilift/Cargo.toml", "bril-rs/rs2bril/Cargo.toml", "bril-rs/brillvm/Cargo.toml"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install LLVM and Clang | |
if: matrix.path == 'bril-rs/brillvm/Cargo.toml' | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh ${{ env.LLVM_VERSION }} all | |
- name: cargo check | |
run: cargo check --manifest-path ${{ matrix.path }} --all-targets | |
- name: cargo fmt | |
run: cargo fmt --manifest-path ${{ matrix.path }} --all -- --check | |
- name: cargo clippy | |
run: cargo clippy --manifest-path ${{ matrix.path }} --all-targets | |
- name: cargo doc | |
run: cargo doc --manifest-path ${{ matrix.path }} --all |