name: CI
on:
pull_request:
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
CARGO_INCREMENTAL: "0"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 with:
components: clippy, rustfmt
cache: "false"
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 with:
cache-targets: "false"
- name: Install glslang (provides glslangValidator)
run: sudo apt-get update && sudo apt-get install -y glslang-tools
- name: Format
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --all-targets --locked -- -D warnings
- name: Test
run: cargo test --locked
- name: sccache stats
if: ${{ always() }}
run: sccache --show-stats
npm:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
CARGO_INCREMENTAL: "0"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 with:
cache: "false"
- uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 with:
cache-targets: "false"
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 with:
node-version: 'lts/*'
- name: Check the drift guard without touching tracked files
run: node npm/prepare.mjs --version 0.0.0 --dry-run
- name: Build
run: cargo build --locked
- name: Stage it as the release assets
run: |
mkdir -p dist
for target in aarch64-apple-darwin x86_64-apple-darwin x86_64-unknown-linux-gnu; do
cp target/debug/glslint "dist/glslint-$target"
done
cp target/debug/glslint dist/glslint-x86_64-pc-windows-msvc.exe
- name: Lay out the packages
run: node npm/prepare.mjs --version 0.0.0 --binaries dist
- name: Link the platform package as an installed dependency
run: |
mkdir -p node_modules/@glslint
ln -s ../../npm/@glslint/linux-x64 node_modules/@glslint/linux-x64
- name: Run glslint through the npm shim
run: |
# Transparent passthrough: the shim must report exactly what the
# binary does, and mirror its exit status (no args is usage, exit 2).
test "$(node npm/glslint/bin/glslint.js --version)" = "$(target/debug/glslint --version)"
node npm/glslint/bin/glslint.js && code=0 || code=$?
test "$code" = 2
- name: sccache stats
if: ${{ always() }}
run: sccache --show-stats
deny:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 with:
command: check advisories bans licenses sources