name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
toolchain: [nightly, beta, stable, 1.59.0]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
components: rustfmt, clippy
- name: Cache cargo dependencies
uses: Swatinem/rust-cache@v1
- name: Check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Lint
uses: actions-rs/cargo@v1
with:
command: clippy
- name: Install Homebrew
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
set -xeuo pipefail
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "LIBRARY_PATH=$(brew --prefix)/lib" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$(brew --prefix)/lib" >> $GITHUB_ENV
sudo apt-get update
sudo apt-get install build-essential
- name: Install build dependencies
if: matrix.os != 'windows-latest'
shell: bash
run: |
set -xeuo pipefail
brew update
brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_ttf
- name: Build source
run: |
cargo build --all-targets --features "serde" --verbose
# bash bin/build_wasm.sh --dev
- name: Build documentation
run: cargo doc --features "serde" --verbose
- name: Run unit tests
run: cargo test --features "serde" --verbose
- name: Run integration tests
if: matrix.os == 'macos-latest'
run: cargo test run_engine --features "serde" -- --test-threads=1 --ignored