102 lines
4.1 KiB
YAML

name: ci
on:
pull_request:
push:
branches:
- master
schedule:
- cron: "0 0 * * 1"
jobs:
clippy:
name: Run clippy / linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- run: cargo clippy --workspace
# excluded crates
- run: cargo clippy --manifest-path imgui-examples/Cargo.toml
- run: cargo clippy --manifest-path imgui-gfx-examples/Cargo.toml
- run: cargo clippy --manifest-path imgui-sys-bindgen/Cargo.toml
# supported winit versions
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-20
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-22
- run: cargo clippy --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-23
# Ensure we compile with all features
- run: cargo check --manifest-path imgui-winit-support/Cargo.toml --all-features
rustfmt:
name: Check rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# TODO: why not `with: {submodules: true}`
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- uses: hecrj/setup-rust-action@v1
with:
components: rustfmt
# workspace
- run: cargo fmt --all -- --check
# excluded crates
- run: cargo fmt --manifest-path imgui-examples/Cargo.toml -- --check
- run: cargo fmt --manifest-path imgui-gfx-examples/Cargo.toml -- --check
- run: cargo fmt --manifest-path imgui-sys-bindgen/Cargo.toml -- --check
test:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust:
- stable
- beta
- 1.43.0
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- 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'
- run: cargo test --all
- run: cargo test --manifest-path imgui-examples/Cargo.toml
- run: cargo test --manifest-path imgui-gfx-examples/Cargo.toml
- run: cargo test --manifest-path imgui-sys-bindgen/Cargo.toml
- run: cargo test --manifest-path imgui-gfx-examples/Cargo.toml --no-default-features --features directx
if: runner.os == 'Windows'
- 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