refactor: simplify code structure with visitors #337
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- name: Format | |
run: cargo fmt --all -- --check | |
clippy: | |
needs: rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- name: ⚡ Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: temurin | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
with: | |
dotnet-version: '7.x.x' | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build and run tests | |
run: cargo test | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: temurin | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.x.x' | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Setup grcov | |
env: | |
TAG: v0.8.13 | |
run: | | |
mkdir -p ~/.local/bin | |
curl -sL https://github.com/mozilla/grcov/releases/download/$TAG/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C ~/.local/bin | |
echo ~/.local/bin >> $GITHUB_PATH | |
- name: Run grcov | |
env: | |
PROJECT_NAME: pomsky | |
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | |
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' | |
CARGO_INCREMENTAL: 0 | |
run: | | |
cargo test | |
zip -0 cov.zip $(find . -name "$PROJECT_NAME*.gc*" -print) | |
grcov cov.zip -s . -t lcov --llvm --ignore-not-existing --ignore "/*" -o lcov.info | |
- name: Coveralls upload | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: 'lcov.info' |