ci: create github workflow to test on Ubuntu, Windows, Mac OS #3
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| default-build: | |
| name: Test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: actions/checkout@v5 | |
| - run: rustup component add rustfmt clippy | |
| # dependencies for wxWidgets (see installation instructions and github | |
| # workflow of https://github.com/allendang/wxdragon); only xvfb is | |
| # specific to this setup | |
| - name: Install deps | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libpng-dev libjpeg-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev libexpat1-dev libtiff-dev libwebkit2gtk-4.1-dev libxtst-dev xvfb | |
| - name: Cargo cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: build | |
| run: cargo build | |
| # skip main doc test because it opens a window | |
| - run: sed -i 's/```rust/```no_run/g' src/lib.rs | |
| - name: tests | |
| run: xvfb-run cargo test --all-features --verbose | |
| - name: clippy | |
| run: cargo clippy --all-features -- -D warnings | |
| - name: check formatting | |
| run: cargo fmt --all -- --check | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # dependencies for wxWidgets (see installation instructions and github | |
| # workflow of https://github.com/allendang/wxdragon) | |
| - name: Install deps | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libpng-dev libjpeg-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev libexpat1-dev libtiff-dev libwebkit2gtk-4.1-dev libxtst-dev | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build documentation | |
| run: cargo doc --all-features --no-deps |