ruffle/.github/workflows/test_rust.yml

134 lines
3.6 KiB
YAML

name: Test Rust
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
changes:
name: Paths filter
runs-on: ubuntu-22.04
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v2
- 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@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust_version }}
override: true
components: rustfmt, clippy
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo add-apt-repository ppa:kisak/kisak-mesa -y
sudo apt-get update
sudo apt-get dist-upgrade
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@90429b3dea365e9a1b0cb82d7f98aabf3089dc63
with:
shared-key: "desktop"
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Lint AS3 playerglobals
if: runner.os == 'Linux' && matrix.rust_version == 'stable'
uses: actions-rs/cargo@v1
with:
command: run
args: -p build_playerglobal -- lint
- name: Check clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --all-features --tests -- -D warnings
- name: Check documentation
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
- name: Run tests with image tests
if: runner.os == 'Linux' || runner.os == 'Windows'
uses: actions-rs/cargo@v1
env:
XDG_RUNTIME_DIR: '' # dummy value, just to silence warnings about it missing
with:
command: test
args: --locked --features imgtests
- name: Run tests without image tests
if: ${{ !(runner.os == 'Linux' || runner.os == 'Windows') }}
uses: actions-rs/cargo@v1
with:
command: test
args: --locked
- name: Upload images
if: failure()
uses: actions/upload-artifact@v2
with:
name: swf_images
path: tests*/**/actual*.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