Files
2023-12-01 17:27:36 +00:00

157 lines
4.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: CI
on:
push:
branches:
- master
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
env:
# Disable incremental compilation. CI builds are often closer to from-scratch builds, as changes
# are typically bigger than from a local edit-compile cycle.
# Incremental compilation also significantly increases the amount of IO and the size of ./target
# folder, which makes caching less effective.
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: short
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
# Cache should never takes more than a few seconds to get downloaded.
# If it does, let’s just rebuild from scratch instead of hanging "forever".
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
# Disabling debug info so compilation is faster and ./target folder is smaller.
CARGO_PROFILE_DEV_DEBUG: 0
jobs:
formatting:
name: Check formatting
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Check formatting
run: cargo xtask check fmt -v
typos:
name: Check typos
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Binary cache
uses: actions/cache@v3
with:
path: ./.cargo/local_root/bin
key: ${{ runner.os }}-bin-${{ github.job }}-${{ hashFiles('xtask/src/bin_version.rs') }}
- name: typos (prepare)
run: cargo xtask check install -v
- name: typos (check)
run: cargo xtask check typos -v
checks:
name: Checks [${{ matrix.os }}]
runs-on: ${{ matrix.runner }}
needs: formatting
strategy:
fail-fast: false
matrix:
os: [ windows, linux ]
include:
- os: windows
runner: windows-2019
- os: linux
runner: ubuntu-22.04 # 22.04 because we need a recent wabt version
steps:
- uses: actions/checkout@v3
- name: Rust cache
uses: Swatinem/rust-cache@v2.3.0
- name: Binary cache
uses: actions/cache@v3
with:
path: ./.cargo/local_root/bin
key: ${{ runner.os }}-bin-${{ github.job }}-${{ hashFiles('xtask/src/bin_version.rs') }}
# Compilation is separated from execution so we know exactly the time for each step.
- name: Tests (compile)
run: cargo xtask check tests --no-run -v
- name: Tests (run)
run: cargo xtask check tests -v
- name: Lints
run: cargo xtask check lints -v
- name: WASM (prepare)
run: cargo xtask wasm install -v
- name: WASM (check)
run: cargo xtask wasm check -v
- name: Lock files
run: cargo xtask check locks -v
fuzz:
name: Fuzzing
runs-on: ubuntu-20.04
needs: formatting
steps:
- uses: actions/checkout@v3
- name: Rust cache
uses: Swatinem/rust-cache@v2.3.0
with:
workspaces: fuzz -> target
- name: Binary cache
uses: actions/cache@v3
with:
path: ./.cargo/local_root/bin
key: ${{ runner.os }}-bin-${{ github.job }}-${{ hashFiles('xtask/src/bin_version.rs') }}
- name: Prepare
run: cargo xtask fuzz install -v
# Simply run all fuzz targets for a few seconds, just checking there is nothing obviously wrong at a quick glance
- name: Fuzz
run: cargo xtask fuzz run -v
- name: Lock files
run: cargo xtask check locks -v
web:
name: Web Client
runs-on: ubuntu-20.04
needs: formatting
steps:
- uses: actions/checkout@v3
- name: Rust cache
uses: Swatinem/rust-cache@v2.3.0
- name: Binary cache
uses: actions/cache@v3
with:
path: ./.cargo/local_root/bin
key: ${{ runner.os }}-bin-${{ github.job }}-${{ hashFiles('xtask/src/bin_version.rs') }}
- name: Prepare
run: cargo xtask web install -v
- name: Check
run: cargo xtask web check -v
- name: Lock files
run: cargo xtask check locks -v