mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
128 lines
4.8 KiB
YAML
128 lines
4.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
# This allows running it on any branch manually:
|
|
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# Deny warns here as a catch-all and because some commands (e.g. cargo build) don't accept `--deny warnings`
|
|
# but also deny them on all individual cargo invocations where available because:
|
|
# 1) Some commands might not support rustflags (e.g. clippy didn't at first, cargo doc uses a different var, ...)
|
|
# 2) People might copy paste the commands into CI where this flag is missing without noticing.
|
|
RUSTFLAGS: --deny warnings
|
|
|
|
jobs:
|
|
tests:
|
|
name: Tests CI
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
rust: [stable]
|
|
# For reference: https://github.com/actions/virtual-environments#available-environments
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
# Caching must be after toolchain selection
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Install linux deps
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
# Note that for running your Fyrox game on CI, you might need additinal deps like libxkbcommon-x11 and OpenGL
|
|
# and you might need to run it using xvfb-run even in headless mode.
|
|
run: |
|
|
sudo apt-get update # Run update first or install might start failing eventually.
|
|
sudo apt-get install --no-install-recommends -y libasound2-dev libudev-dev pkg-config xorg-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
|
|
|
|
- run: rustc --version && cargo --version
|
|
- name: Build
|
|
# Use build instead of check since it needs to be built for tests anyway
|
|
run: cargo build --verbose --workspace --all-targets --all-features --profile github-ci
|
|
- name: Test
|
|
# Currently --all-targets *disables* running doc-tests
|
|
# and none of the other targets such as examples *currently* have tests
|
|
# so we don't use it. It should be added later when the issue is fixed:
|
|
# https://github.com/rust-lang/cargo/issues/6669
|
|
run: cargo test --verbose --workspace --all-features --profile github-ci
|
|
|
|
wasm:
|
|
name: Wasm CI
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
rust: [stable]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
targets: wasm32-unknown-unknown
|
|
# Caching must be after toolchain selection
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- run: rustc --version && cargo --version
|
|
- name: Build
|
|
run: |
|
|
cargo build --verbose --target=wasm32-unknown-unknown --all-targets --all-features
|
|
|
|
format:
|
|
name: Rustfmt CI
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# Use rust-toolchain because GHA tends to still have an old version for a few days after a new Rust release.
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- run: cargo fmt --version
|
|
- run: cargo fmt -- --check
|
|
|
|
clippy:
|
|
name: Clippy CI
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# For reference: https://github.com/actions/virtual-environments#available-environments
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# Use rust-toolchain because GHA tends to still have an old version for a few days after a new Rust release.
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
# Caching must be after toolchain selection
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Install linux deps
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
run: |
|
|
sudo apt-get update # Run update first or install might start failing eventually.
|
|
sudo apt-get install --no-install-recommends -y libasound2-dev libudev-dev pkg-config xorg-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
|
|
|
|
- run: cargo clippy --version
|
|
# Using --all-targets to also check tests and examples.
|
|
# Note that technically --all-features doesn't check all code when something is *disabled* by a feature.
|
|
- run: cargo clippy --workspace --all-targets --all-features -- --deny warnings
|
|
|
|
docs:
|
|
name: Documentation CI
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# Docs.rs uses nightly https://docs.rs/about/builds
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
# Caching must be after toolchain selection
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- run: rustc --version && cargo --version
|
|
- name: Build Docs
|
|
run: cargo doc --all-features
|
|
env:
|
|
RUSTDOCFLAGS: --deny warnings
|