Jack OntheGoMac ce22eb3da5 updated CI
2021-12-23 13:02:44 -08:00

168 lines
6.3 KiB
YAML

name: ci
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 0 * * 1"
jobs:
rustfmt:
name: Check rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- run: cargo fmt --all -- --check
clippy:
name: Run linter
runs-on: ubuntu-latest
strategy:
matrix:
rust: ["1.54"]
env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
rust-version: ${{ matrix.rust }}
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-
- name: Cache cargo target dirs
uses: actions/cache@v2
with:
path: target
key: ${{ runner.os }}-target-lint-stable-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-target-lint-stable-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-target-lint-stable-
${{ runner.os }}-target-lint-
# feature testing
- name: no features
run: cargo clippy --workspace --all-targets
- name: docking feature
run: cargo clippy --workspace --all-targets --features docking
- name: freetype feature
run: cargo clippy --workspace --all-targets --features freetype
- name: freetype and docking
run: cargo clippy --workspace --all-targets --features freetype,docking
# supported winit versions (with otherwise default features)
- run: cargo doc
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22 --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23/default --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-24/default --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-25/default --all-targets
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-26/default --all-targets
test:
name: Run tests
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
strategy:
fail-fast: false
matrix:
rust:
- stable
- beta
- "1.54"
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: sudo apt install libxcb-shape0-dev libxcb-xfixes0-dev
if: runner.os == 'Linux'
# workaround for https://github.com/actions/cache/issues/403
- name: Install GNU tar
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- name: Cache cargo directories
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-
- name: Cache cargo target dirs
uses: actions/cache@v2
with:
path: target
# note `cargo test` and `cargo clippy` don't use the same build
# artifacts, so this has a different key
key: ${{ runner.os }}-target-test-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-target-test-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-target-test-${{ matrix.rust }}-
# - name: Setup vcpkg
# if: matrix.os == 'windows-latest'
# run: vcpkg integrate install; vcpkg install freetype;
# feature testing
- name: no features
run: cargo test --workspace --all-targets
- name: docking feature
run: cargo test --workspace --all-targets --features docking
- name: freetype feature
if: matrix.os != 'windows-latest'
run: cargo test --workspace --all-targets --features freetype
- name: freetype and docking
if: matrix.os != 'windows-latest'
run: cargo test --workspace --all-targets --features freetype,docking
- run: cargo test --workspace --doc
# run to check for lint problems
- run: cargo doc
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23/default
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-24/default
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-25/default
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-26/default
# Run unreasonably slow tests under release, but only the crates that have
# them, and don't bother doing this on most platforms.
- run: cargo test -p imgui --release -- --ignored
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'