ruffle/.github/workflows/test_rust.yml

127 lines
3.7 KiB
YAML
Raw Normal View History

name: Test Rust
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Paths filter
runs-on: ubuntu-22.04
outputs:
2023-08-26 10:58:31 +00:00
should_run: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v4
2023-08-26 10:58:31 +00:00
- uses: AurorNZ/paths-filter@v3
id: filter
with:
filters: |
src:
2023-08-26 10:58:31 +00:00
- '!web/package.json'
- '!web/package-lock.json'
- '!web/packages/**'
- '!**/*.md'
build:
needs: changes
2023-08-26 10:58:31 +00:00
if: needs.changes.outputs.should_run== 'true'
name: Test Rust ${{ matrix.rust_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
2021-08-21 21:45:43 +00:00
continue-on-error: ${{ matrix.rust_version == 'nightly' || matrix.rust_version == 'beta' }}
strategy:
fail-fast: false
matrix:
2021-09-06 15:05:52 +00:00
rust_version: [stable]
os: [ubuntu-22.04, windows-latest, macos-latest]
2021-08-21 14:44:24 +00:00
include:
- rust_version: nightly
os: ubuntu-22.04
2021-09-06 15:05:52 +00:00
- rust_version: beta
os: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust_version }}
components: rustfmt, clippy
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
2023-10-17 01:12:41 +00:00
sudo apt install -y libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers libpango1.0-dev
- name: Cache Cargo output
uses: Swatinem/rust-cache@v2
with:
shared-key: "desktop"
2023-09-06 20:56:24 +00:00
save-if: ${{ github.ref == 'refs/heads/master' }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check clippy
2023-09-06 20:57:40 +00:00
# not critical on other platforms, and slows down Windows
if: runner.os == 'Linux'
# Don't fail the build for clippy on nightly, since we get a lot of false-positives
run: cargo clippy --all --all-features --tests ${{ (matrix.rust_version != 'nightly' && '-- -D warnings') || '' }}
2023-10-16 19:01:46 +00:00
- name: Check licensing and duplicates in used crates
if: ${{ runner.os == 'Linux' && matrix.rust_version == 'stable' }}
uses: EmbarkStudios/cargo-deny-action@v1
- name: Check documentation
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
2021-02-20 18:10:04 +00:00
- name: Run tests with image tests
2023-10-15 11:32:34 +00:00
if: runner.os != 'macOS'
2023-10-02 20:20:47 +00:00
run: cargo test --all --locked --features imgtests,lzma,jpegxr
env:
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
2021-02-20 18:10:04 +00:00
2023-10-15 11:32:34 +00:00
- name: Run tests without image tests
if: runner.os == 'macOS'
run: cargo test --all --locked --features lzma,jpegxr
env:
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
2021-02-20 18:10:04 +00:00
- name: Upload images
2021-08-25 19:15:02 +00:00
if: failure()
uses: actions/upload-artifact@v3
2021-02-20 18:10:04 +00:00
with:
name: swf_images
path: |
tests*/**/*.actual*.png
tests*/**/*.difference*.png
check-required:
needs: changes
2023-08-26 10:58:31 +00:00
if: needs.changes.outputs.should_run == 'false'
name: Test Rust ${{ matrix.rust_version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust_version: [stable]
os: [ubuntu-22.04, windows-latest, macos-latest]
include:
- rust_version: nightly
os: ubuntu-22.04
- rust_version: beta
os: ubuntu-22.04
steps:
- name: No-op
run: echo noop