wgpu/.github/workflows/ci.yml

217 lines
6.0 KiB
YAML
Raw Normal View History

2020-04-22 13:03:26 +00:00
name: CI
on:
push:
2021-05-11 19:00:41 +00:00
branches: [master, staging]
tags: [v0.*]
2020-04-22 13:03:26 +00:00
pull_request:
2021-09-14 01:27:50 +00:00
env:
RUST_BACKTRACE: 1
2021-12-03 15:10:55 +00:00
RUST_VERSION: 1.53
2021-09-14 01:27:50 +00:00
2020-04-22 13:03:26 +00:00
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
2021-07-04 02:10:10 +00:00
# Windows
- name: Windows x86_64
os: windows-2019
target: x86_64-pc-windows-msvc
2021-12-03 15:37:26 +00:00
tool: clippy
2021-07-28 04:19:59 +00:00
kind: test
2021-09-14 01:27:50 +00:00
backends: dx12 # dx11
- name: Windows Nightly x86_64
os: windows-2019
target: x86_64-pc-windows-msvc
2021-12-03 15:37:26 +00:00
tool: check
2021-09-14 01:27:50 +00:00
kind: compile
2021-07-04 02:10:10 +00:00
# MacOS
# Mac has no software runners, so don't run tests
- name: MacOS x86_64
os: macos-10.15
2021-07-04 02:10:10 +00:00
target: x86_64-apple-darwin
2021-12-03 15:37:26 +00:00
tool: clippy
2021-07-04 02:10:10 +00:00
kind: compile
# IOS
- name: IOS aarch64
os: macos-10.15
2021-07-04 02:10:10 +00:00
target: aarch64-apple-ios
2021-12-03 15:37:26 +00:00
tool: clippy
2021-07-04 02:10:10 +00:00
kind: compile
# Linux
- name: Linux x86_64
2021-06-17 05:03:47 +00:00
os: ubuntu-20.04
2021-07-04 02:10:10 +00:00
target: x86_64-unknown-linux-gnu
2021-12-03 15:37:26 +00:00
tool: clippy
2021-09-16 23:22:03 +00:00
kind: test
backends: vulkan # gl
2021-07-04 02:10:10 +00:00
- name: Linux Nightly x86_64
2021-06-17 05:03:47 +00:00
os: ubuntu-20.04
2021-07-04 02:10:10 +00:00
target: x86_64-unknown-linux-gnu
2021-12-03 15:37:26 +00:00
tool: check
2021-07-04 02:10:10 +00:00
kind: compile
# Android
- name: Android aarch64
os: ubuntu-20.04
target: aarch64-linux-android
2021-12-03 15:37:26 +00:00
tool: clippy
2021-07-04 02:10:10 +00:00
kind: compile
# WebGPU/WebGL
- name: WebAssembly
os: ubuntu-20.04
target: wasm32-unknown-unknown
2021-12-03 15:37:26 +00:00
tool: clippy
kind: wasm
2021-07-04 02:10:10 +00:00
2021-09-03 17:53:10 +00:00
name: Check ${{ matrix.name }}
2021-07-04 02:10:10 +00:00
runs-on: ${{ matrix.os }}
env:
PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work
2021-09-14 01:27:50 +00:00
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
2021-07-13 03:15:47 +00:00
RUSTDOCFLAGS: -Dwarnings
2021-07-04 02:10:10 +00:00
2020-04-22 13:03:26 +00:00
steps:
2021-07-04 02:10:10 +00:00
- name: checkout repo
uses: actions/checkout@v2
2021-12-03 15:37:26 +00:00
# Only run clippy on MSRV
- name: install rust stable
if: matrix.tool == 'clippy'
2020-05-01 17:32:38 +00:00
uses: actions-rs/toolchain@v1
with:
2021-12-03 15:37:26 +00:00
toolchain: ${{ env.RUST_VERSION }}
2021-07-04 02:10:10 +00:00
target: ${{ matrix.target }}
profile: minimal
2021-12-03 15:37:26 +00:00
override: true
2021-07-04 02:10:10 +00:00
components: clippy
2021-07-03 06:24:38 +00:00
2021-12-03 15:37:26 +00:00
# Other builds can use nightly
- name: install rust nightly
if: matrix.tool != 'clippy'
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: ${{ matrix.target }}
profile: minimal
override: true
2021-09-14 01:27:50 +00:00
- name: caching
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}-a # suffix for cache busting
2021-07-04 02:10:10 +00:00
- name: add android apk to path
if: matrix.os == 'ubuntu-20.04' && matrix.target == 'aarch64-linux-android'
run: |
echo "$ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
2021-07-03 06:24:38 +00:00
2021-07-04 02:10:10 +00:00
- name: install llvmpipe and lavapipe
2021-09-16 23:22:03 +00:00
if: matrix.os == 'ubuntu-20.04' && matrix.target != 'aarch64-linux-android' && matrix.kind == 'test'
2021-07-04 02:10:10 +00:00
run: |
sudo apt-get update -y -qq
2021-09-16 23:22:03 +00:00
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
2021-07-04 02:10:10 +00:00
sudo apt-get update
2021-09-16 23:22:03 +00:00
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
2021-09-14 01:27:50 +00:00
# We enable line numbers for panics, but that's it
- name: disable debug
shell: bash
run: |
mkdir .cargo
echo """[profile.dev]
debug = 1" > .cargo/config.toml
2021-07-03 06:24:38 +00:00
2021-07-04 02:10:10 +00:00
- name: check web
2021-12-03 15:37:26 +00:00
if: matrix.kind == 'wasm'
2021-07-04 02:10:10 +00:00
run: |
2021-12-03 15:37:26 +00:00
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu
2021-07-03 06:24:38 +00:00
# Build for WebGL
2021-12-03 15:37:26 +00:00
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu --features webgl -- -D warnings
2021-07-13 03:15:47 +00:00
# build docs
cargo doc --target ${{ matrix.target }} -p wgpu --no-deps
2021-09-14 01:27:50 +00:00
- name: check native
if: matrix.kind == 'compile' || matrix.kind == 'test'
2021-07-04 02:10:10 +00:00
run: |
# check with no features
2021-12-03 15:37:26 +00:00
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player
2021-07-03 06:24:38 +00:00
2021-07-04 02:10:10 +00:00
# check with all features
# explicitly don't mention wgpu-hal so that --all-features don't apply to it
2021-12-03 15:58:53 +00:00
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --examples --tests --all-features
2021-06-22 05:38:41 +00:00
2021-07-13 03:15:47 +00:00
# build docs
cargo doc --target ${{ matrix.target }} --no-deps
cargo doc --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --all-features --no-deps
2021-07-28 04:19:59 +00:00
- name: tests
2021-09-14 01:27:50 +00:00
if: matrix.kind == 'test'
shell: bash
2021-07-28 04:19:59 +00:00
run: |
# run wgpu-info
2021-12-03 15:58:53 +00:00
cargo run --bin wgpu-info
# run player tests
cargo test -p player
2021-09-14 01:27:50 +00:00
for backend in ${{ matrix.backends }}; do
echo "======= NATIVE TESTS $backend ======";
# run player tests
WGPU_BACKEND=$backend cargo test --target ${{ matrix.target }} -p wgpu-types -p wgpu-hal -p wgpu-core --no-fail-fast -- --nocapture --test-threads=1
# run coretests
WGPU_BACKEND=$backend cargo test --target ${{ matrix.target }} -p wgpu --no-fail-fast -- --nocapture --test-threads=1
done
2021-09-03 17:53:10 +00:00
2021-07-04 02:10:10 +00:00
fmt:
name: Format
2021-03-12 17:39:04 +00:00
runs-on: ubuntu-latest
steps:
2021-07-04 02:10:10 +00:00
- name: checkout repo
uses: actions/checkout@v2
- name: install rust
uses: actions-rs/toolchain@v1
2021-03-12 17:39:04 +00:00
with:
profile: minimal
toolchain: stable
override: true
2021-07-04 02:10:10 +00:00
components: rustfmt
- name: run rustfmt
run: |
cargo fmt -- --check
2021-09-28 15:25:33 +00:00
deno:
name: Deno
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: build Deno
run: |
cargo check --manifest-path cts_runner/Cargo.toml