CI #2387
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: CI | |
"on": | |
push: | |
branches: | |
- trunk | |
pull_request: | |
branches: | |
- trunk | |
schedule: | |
- cron: "0 0 * * TUE" | |
jobs: | |
build-rust: | |
name: Build Rust | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Set toolchain versions | |
run: | | |
echo "emscripten=$(cat emscripten-toolchain)" >> $GITHUB_OUTPUT | |
id: toolchain_versions | |
- name: Install Rust toolchain | |
uses: artichoke/setup-rust/[email protected] | |
with: | |
toolchain: "1.69.0" | |
target: "wasm32-unknown-emscripten" | |
- name: Compile | |
run: cargo build --workspace --verbose | |
- name: Compile tests | |
run: cargo test --workspace --no-run | |
- name: Test | |
run: cargo test --workspace | |
build-webapp: | |
name: Build Webapp | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Set toolchain versions | |
run: | | |
echo "emscripten=$(cat emscripten-toolchain)" >> $GITHUB_OUTPUT | |
id: toolchain_versions | |
- name: Install Node.js toolchain | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
# Must install deps before setting up emscripten toolchain since emsdk | |
# includes its own older node which does not support lockfileversion 3 | |
# in package-lock.json. | |
- name: Install Node.js dependencies | |
run: npm ci | |
- name: Install Rust toolchain | |
uses: artichoke/setup-rust/[email protected] | |
with: | |
toolchain: "1.69.0" | |
target: "wasm32-unknown-emscripten" | |
- name: Install Ruby toolchain | |
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 | |
with: | |
ruby-version: ".ruby-version" | |
bundler-cache: true | |
- name: Install Emscripten toolchain | |
uses: mymindstorm/setup-emsdk@ab889da2abbcbb280f91ec4c215d3bb4f3a8f775 # v12 | |
with: | |
version: ${{ steps.toolchain_versions.outputs.emscripten }} | |
no-cache: true | |
- name: Verify emcc version | |
run: emcc -v | |
- name: Compile Wasm | |
run: ruby scripts/build-wasm.rb --release --verbose | |
- name: Build Webapp | |
run: node build.mjs --release | |
rust: | |
name: Lint and format Rust | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
CARGO_NET_GIT_FETCH_WITH_CLI: true | |
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Set toolchain versions | |
run: | | |
echo "emscripten=$(cat emscripten-toolchain)" >> $GITHUB_OUTPUT | |
id: toolchain_versions | |
- name: Install Rust toolchain | |
uses: artichoke/setup-rust/[email protected] | |
with: | |
toolchain: "1.69.0" | |
- name: Install emscripten target | |
run: rustup target add wasm32-unknown-emscripten | |
- name: Install Emscripten toolchain | |
uses: mymindstorm/setup-emsdk@ab889da2abbcbb280f91ec4c215d3bb4f3a8f775 # v12 | |
with: | |
version: ${{ steps.toolchain_versions.outputs.emscripten }} | |
- name: Verify emcc version | |
run: emcc -v | |
- name: Check formatting | |
run: cargo fmt --check | |
- name: Lint with Clippy | |
run: cargo clippy --workspace --all-features --all-targets | |
- name: Lint with Clippy on emscripten target | |
run: cargo clippy --workspace --all-features --all-targets --target wasm32-unknown-emscripten | |
ruby: | |
name: Lint and format Ruby | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install Ruby toolchain | |
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 | |
with: | |
ruby-version: ".ruby-version" | |
bundler-cache: true | |
- name: Lint and check formatting with Rubocop | |
run: bundle exec rubocop --format github | |
js-ts: | |
name: Lint and format JavaScript and TypeScript | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install Node.js toolchain | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: Install Nodejs toolchain | |
run: npm ci | |
- name: Create stubs for Wasm Sources | |
run: | | |
touch src/wasm/playground.js | |
touch src/wasm/playground.wasm | |
- name: Compile with TypeScript | |
run: npx tsc --extendedDiagnostics --listFiles --listEmittedFiles | |
- name: Lint with eslint | |
run: npm run lint | |
text: | |
name: Lint and format text | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Install Node.js toolchain | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: Install Nodejs toolchain | |
run: npm ci | |
- name: Lint and check formatting with prettier | |
run: npx prettier --check '**/*' | |
- name: Lint YAML sources with yamllint | |
run: | | |
yamllint --version | |
echo "Linting YAML sources with yamllint ..." | |
yamllint --strict --format github . | |
echo "OK" |