Cleanup matrix and run tests in CI #211
Workflow file for this run
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: Main | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ["**"] | |
merge_group: | |
types: [checks_requested] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
Build: | |
name: ${{ format('{0} {1}', matrix.platform.target, matrix.features)}} | |
runs-on: ${{ matrix.platform.os }} | |
env: | |
RUST_BACKTRACE: 1 | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { target: aarch64-apple-darwin, os: macos-14, test: true } | |
- { target: x86_64-apple-darwin, os: macos-13, test: true } | |
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, test: true } | |
- { target: x86_64-pc-windows-msvc, os: windows-latest, test: true } | |
- { target: i686-pc-windows-msvc, os: windows-latest, test: false } | |
- { target: aarch64-pc-windows-msvc, os: windows-latest, test: false } | |
- { | |
target: aarch64-unknown-linux-ohos, | |
os: ubuntu-latest, | |
test: false, | |
} | |
- { target: arm-linux-androideabi, os: ubuntu-latest, test: false } | |
features: | |
[ | |
"", | |
"chains sm-raw-window-handle-06", | |
"chains sm-raw-window-handle-05", | |
] | |
include: | |
- features: "sm-x11 sm-wayland-default" | |
platform: | |
{ | |
target: x86_64-unknown-linux-gnu, | |
os: ubuntu-latest, | |
test: true, | |
} | |
- features: "chains sm-angle-builtin" | |
platform: | |
{ target: x86_64-pc-windows-msvc, os: windows-latest, test: true } | |
- features: "chains sm-no-wgl sm-angle-builtin" | |
platform: | |
{ target: x86_64-pc-windows-msvc, os: windows-latest, test: true } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies (Linux) | |
if: startsWith(matrix.platform.os, 'ubuntu') | |
run: | | |
sudo apt update | |
sudo apt install gcc libxxf86vm-dev libosmesa6-dev libgles2-mesa-dev xvfb weston -y | |
- name: Install rust | |
id: toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.platform.target }} | |
- name: Build | |
run: | | |
rustup target add ${{ matrix.platform.target }} | |
cargo build --features "${{ matrix.features }}" --target ${{ matrix.platform.target }} | |
- name: Test | |
if: ${{ matrix.platform.test && startsWith(matrix.platform.os, 'ubuntu') }} | |
run: | | |
weston --no-config --socket=wl-test-env --backend=headless & | |
WAYLAND_DISPLAY=wl-test-env xvfb-run cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }} | |
- name: Test | |
if: ${{ matrix.platform.test && !startsWith(matrix.platform.os, 'ubuntu') }} | |
run: | | |
cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }} | |
Format: | |
name: Run `rustfmt` | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mkroening/rust-toolchain-toml@main | |
- run: cargo fmt --check | |
build_result: | |
name: Result | |
runs-on: ubuntu-latest | |
needs: ["Build", "Format"] | |
if: always() | |
steps: | |
- name: Mark the job as successful | |
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
run: exit 0 | |
- name: Mark the job as unsuccessful | |
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
run: exit 1 |