116 lines
3.3 KiB
YAML
116 lines
3.3 KiB
YAML
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:
|
|
src: ${{ steps.filter.outputs.src }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
src:
|
|
- '!(web/package.json|web/package-lock.json|web/packages/**|**.md)'
|
|
|
|
build:
|
|
needs: changes
|
|
if: needs.changes.outputs.src == 'true'
|
|
name: Test Rust ${{ matrix.rust_version }} / ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.rust_version == 'nightly' || matrix.rust_version == 'beta' }}
|
|
strategy:
|
|
fail-fast: false
|
|
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:
|
|
- uses: actions/checkout@v3
|
|
|
|
- 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
|
|
sudo apt install -y libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev mesa-vulkan-drivers
|
|
|
|
- name: Cache Cargo output
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
shared-key: "desktop"
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: Lint AS3 playerglobals
|
|
if: runner.os == 'Linux' && matrix.rust_version == 'stable'
|
|
run: cargo run -p build_playerglobal -- lint
|
|
|
|
- name: Check clippy
|
|
# FIXME - run Clippy on nightly again once https://github.com/clap-rs/clap/issues/4733 is fixed
|
|
if: matrix.rust_version != 'nightly'
|
|
# 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') || '' }}
|
|
|
|
- name: Check documentation
|
|
run: cargo doc --no-deps --all-features
|
|
env:
|
|
RUSTDOCFLAGS: -D warnings
|
|
|
|
- name: Run tests with image tests
|
|
run: cargo test --locked --features imgtests
|
|
env:
|
|
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
|
|
|
|
- name: Upload images
|
|
if: failure()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: swf_images
|
|
path: |
|
|
tests*/**/actual*.png
|
|
tests*/**/difference*.png
|
|
|
|
check-required:
|
|
needs: changes
|
|
if: needs.changes.outputs.src == '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
|