simplified repository down #47
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
rustfmt: | |
name: Check rustfmt | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- run: cargo fmt --all -- --check | |
clippy: | |
name: Run linter | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
env: | |
RUSTFLAGS: -D warnings | |
RUSTDOCFLAGS: -D warnings | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: hecrj/setup-rust-action@v1 | |
with: | |
components: clippy | |
- 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 | |
- name: all features | |
run: cargo clippy --workspace --all-targets --features docking,freetype | |
test: | |
name: Run tests | |
runs-on: ${{ matrix.os }} | |
env: | |
RUSTFLAGS: -D warnings | |
RUST_BACKTRACE: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: | |
- "1.70" | |
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:x64-windows-static-md | |
# 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 (non-Windows, pkg-config) | |
if: matrix.os != 'windows-latest' | |
run: cargo test --workspace --all-targets --features freetype | |
- name: freetype and docking (non-Windows, pkg-config) | |
if: matrix.os != 'windows-latest' | |
run: cargo test --workspace --all-targets --features freetype,docking | |
- name: freetype feature (Windows, vcpkg) | |
if: matrix.os == 'windows-latest' | |
run: cargo test --workspace --all-targets --features freetype,use-vcpkg | |
- name: freetype and docking (Windows, vcpkg) | |
if: matrix.os == 'windows-latest' | |
run: cargo test --workspace --all-targets --features freetype,docking,use-vcpkg | |
- run: cargo test --workspace --doc | |
# run to check for lint problems | |
- name: build documentation | |
run: cargo doc | |
# 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' |