name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install webview system libraries
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
build:
name: Build & test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install webview system libraries
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
fuzz:
name: Fuzz (time-boxed)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --no-default-features
- name: Fuzz
run: |
ulimit -v 6000000
seed=$(( GITHUB_RUN_ID % 1000000007 ))
./target/debug/neyuki fuzz file --seconds 90 --seed "$seed" --keep-going
./target/debug/neyuki fuzz tree --seconds 60 --seed "$seed" --keep-going
./target/debug/neyuki fuzz vm --seconds 60 --seed "$seed" --keep-going
./target/debug/neyuki fuzz libs --seconds 45 --seed "$seed" --keep-going
./target/debug/neyuki fuzz memory --seconds 30 --seed "$seed" --keep-going
- name: Upload crashing inputs
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-artifacts
path: fuzz-artifacts/
if-no-files-found: ignore
deny:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check advisories, licenses, bans and sources
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check advisories licenses bans sources
lint-libs:
name: Lint bundled libraries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install webview system libraries
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Lint lib/*.nyk
run: |
status=0
for file in lib/*.nyk; do
if [ "$(./target/debug/neyuki lint --json "$file")" != "[]" ]; then
./target/debug/neyuki lint "$file" || true
echo "::error file=$file::neyuki lint reported issues"
status=1
else
echo "$file: clean"
fi
done
exit $status