2020-04-22 13:03:26 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-10-15 02:55:36 +00:00
|
|
|
branches: ["*"]
|
2021-05-04 01:46:01 +00:00
|
|
|
tags: [v0.*]
|
2020-04-22 13:03:26 +00:00
|
|
|
pull_request:
|
2023-02-09 00:52:25 +00:00
|
|
|
merge_group:
|
2020-04-22 13:03:26 +00:00
|
|
|
|
2021-09-14 01:27:50 +00:00
|
|
|
env:
|
2023-02-09 15:33:53 +00:00
|
|
|
CARGO_INCREMENTAL: false
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
RUST_BACKTRACE: full
|
|
|
|
MSRV: 1.64
|
2022-10-15 02:55:36 +00:00
|
|
|
PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work
|
|
|
|
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
|
|
|
|
RUSTDOCFLAGS: -Dwarnings
|
|
|
|
CACHE_SUFFIX: c # cache busting
|
2021-09-14 01:27:50 +00:00
|
|
|
|
2021-12-03 16:43:22 +00:00
|
|
|
# We distinguish the following kinds of builds:
|
2022-10-15 02:55:36 +00:00
|
|
|
# - native: build for the same target as we compile on
|
2021-12-03 16:43:22 +00:00
|
|
|
# - web: build for the Web
|
2022-01-25 10:35:45 +00:00
|
|
|
# - em: build for the Emscripten
|
2021-12-03 16:43:22 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
# For build time and size optimization we disable debug
|
|
|
|
# entirely on clippy jobs and reduce it to line-numbers
|
|
|
|
# only for ones where we run tests.
|
|
|
|
#
|
2022-11-07 18:32:41 +00:00
|
|
|
# Additionally, we disable incremental builds entirely
|
2022-10-15 02:55:36 +00:00
|
|
|
# as our caching system doesn't actually cache our crates.
|
|
|
|
# It adds overhead to the build and another point of failure.
|
|
|
|
|
2020-04-22 13:03:26 +00:00
|
|
|
jobs:
|
2022-10-15 02:55:36 +00:00
|
|
|
check-msrv:
|
2020-04-22 13:03:26 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2021-07-04 02:10:10 +00:00
|
|
|
# Windows
|
|
|
|
- name: Windows x86_64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: windows-2022
|
2021-09-14 01:27:50 +00:00
|
|
|
target: x86_64-pc-windows-msvc
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2021-07-04 02:10:10 +00:00
|
|
|
# MacOS
|
|
|
|
- name: MacOS x86_64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: macos-12
|
2021-07-04 02:10:10 +00:00
|
|
|
target: x86_64-apple-darwin
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2021-12-03 20:38:40 +00:00
|
|
|
|
|
|
|
- name: MacOS aarch64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: macos-12
|
2021-12-03 20:38:40 +00:00
|
|
|
target: aarch64-apple-darwin
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2021-07-04 02:10:10 +00:00
|
|
|
# IOS
|
|
|
|
- name: IOS aarch64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: macos-12
|
2021-07-04 02:10:10 +00:00
|
|
|
target: aarch64-apple-ios
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2021-07-04 02:10:10 +00:00
|
|
|
|
|
|
|
# Linux
|
|
|
|
- name: Linux x86_64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: ubuntu-22.04
|
2021-07-04 02:10:10 +00:00
|
|
|
target: x86_64-unknown-linux-gnu
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2021-07-04 02:10:10 +00:00
|
|
|
|
2021-12-03 20:38:40 +00:00
|
|
|
- name: Linux aarch64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: ubuntu-22.04
|
2021-12-03 20:38:40 +00:00
|
|
|
target: aarch64-unknown-linux-gnu
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2021-12-03 20:38:40 +00:00
|
|
|
|
2021-07-04 02:10:10 +00:00
|
|
|
# Android
|
|
|
|
- name: Android aarch64
|
2022-10-15 02:55:36 +00:00
|
|
|
os: ubuntu-22.04
|
2021-07-04 02:10:10 +00:00
|
|
|
target: aarch64-linux-android
|
2022-10-15 02:55:36 +00:00
|
|
|
kind: native
|
2021-07-04 02:10:10 +00:00
|
|
|
|
|
|
|
# WebGPU/WebGL
|
|
|
|
- name: WebAssembly
|
2022-10-15 02:55:36 +00:00
|
|
|
os: ubuntu-22.04
|
2021-07-04 02:10:10 +00:00
|
|
|
target: wasm32-unknown-unknown
|
2021-12-03 16:43:22 +00:00
|
|
|
kind: web
|
2021-07-04 02:10:10 +00:00
|
|
|
|
2022-01-25 10:35:45 +00:00
|
|
|
- name: Emscripten
|
2022-10-15 02:55:36 +00:00
|
|
|
os: ubuntu-22.04
|
2022-01-25 10:35:45 +00:00
|
|
|
target: wasm32-unknown-emscripten
|
|
|
|
kind: em
|
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
name: Clippy ${{ matrix.name }}
|
2021-07-04 02:10:10 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
2020-04-22 13:03:26 +00:00
|
|
|
steps:
|
2021-07-04 02:10:10 +00:00
|
|
|
- name: checkout repo
|
2022-10-15 02:55:36 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-07-04 02:10:10 +00:00
|
|
|
|
2023-02-09 15:33:53 +00:00
|
|
|
- name: Install MSRV toolchain
|
|
|
|
run: |
|
|
|
|
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }}
|
|
|
|
rustup default ${{ env.MSRV }}
|
2021-07-03 06:24:38 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
- name: disable debug
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p .cargo
|
|
|
|
echo """
|
|
|
|
[profile.dev]
|
|
|
|
debug = false" >> .cargo/config.toml
|
2021-12-03 15:37:26 +00:00
|
|
|
|
2021-09-14 01:27:50 +00:00
|
|
|
- name: caching
|
2022-10-15 02:55:36 +00:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2021-09-14 01:27:50 +00:00
|
|
|
with:
|
2022-10-15 02:55:36 +00:00
|
|
|
key: clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }}
|
2022-02-19 15:50:17 +00:00
|
|
|
|
2021-07-04 02:10:10 +00:00
|
|
|
- name: add android apk to path
|
2022-10-15 02:55:36 +00:00
|
|
|
if: matrix.target == 'aarch64-linux-android'
|
2021-07-04 02:10:10 +00:00
|
|
|
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: check web
|
2021-12-03 16:43:22 +00:00
|
|
|
if: matrix.kind == 'web'
|
2022-10-15 02:55:36 +00:00
|
|
|
shell: bash
|
2021-07-04 02:10:10 +00:00
|
|
|
run: |
|
2022-10-15 02:55:36 +00:00
|
|
|
set -e
|
2022-10-08 05:12:50 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
# build for WebGPU
|
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu --tests --features glsl,spirv
|
|
|
|
cargo doc --target ${{ matrix.target }} -p wgpu --no-deps --features glsl,spirv
|
2021-07-13 03:15:47 +00:00
|
|
|
|
2023-02-21 12:50:55 +00:00
|
|
|
# all features
|
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --tests --all-features
|
|
|
|
cargo doc --target ${{ matrix.target }} -p wgpu --no-deps --all-features
|
|
|
|
|
2022-01-25 10:35:45 +00:00
|
|
|
- name: check em
|
|
|
|
if: matrix.kind == 'em'
|
2022-10-15 02:55:36 +00:00
|
|
|
shell: bash
|
2022-01-25 10:35:45 +00:00
|
|
|
run: |
|
2022-10-15 02:55:36 +00:00
|
|
|
set -e
|
|
|
|
|
2023-02-21 12:50:55 +00:00
|
|
|
# build for Emscripten
|
2023-02-15 21:46:00 +00:00
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features
|
2022-11-30 21:46:24 +00:00
|
|
|
|
|
|
|
# build cube example
|
2023-02-15 21:46:00 +00:00
|
|
|
cargo clippy --target ${{ matrix.target }} --example cube
|
2022-01-25 10:35:45 +00:00
|
|
|
|
|
|
|
# build raw-gles example
|
2023-02-15 21:46:00 +00:00
|
|
|
cargo clippy --target ${{ matrix.target }} --example raw-gles
|
2022-01-25 10:35:45 +00:00
|
|
|
|
2023-02-21 12:50:55 +00:00
|
|
|
# all features
|
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu-hal --all-features
|
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu --all-features
|
|
|
|
|
2021-09-14 01:27:50 +00:00
|
|
|
- name: check native
|
2022-10-15 02:55:36 +00:00
|
|
|
if: matrix.kind == 'native'
|
|
|
|
shell: bash
|
2021-07-04 02:10:10 +00:00
|
|
|
run: |
|
2022-10-15 02:55:36 +00:00
|
|
|
set -e
|
|
|
|
|
2021-07-04 02:10:10 +00:00
|
|
|
# check with no features
|
2022-10-15 02:55:36 +00:00
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --no-default-features
|
2021-07-03 06:24:38 +00:00
|
|
|
|
2022-12-08 01:58:45 +00:00
|
|
|
# Check with all features.
|
2023-02-21 12:50:55 +00:00
|
|
|
cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player -p wgpu-core -p wgpu-hal --tests --all-features
|
2021-06-22 05:38:41 +00:00
|
|
|
|
2021-07-13 03:15:47 +00:00
|
|
|
# build docs
|
2023-02-21 12:50:55 +00:00
|
|
|
cargo doc --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player -p wgpu-core -p wgpu-hal --all-features --no-deps
|
2021-07-13 03:15:47 +00:00
|
|
|
|
2022-12-09 01:02:39 +00:00
|
|
|
wasm-test:
|
|
|
|
name: Test WebAssembly
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2023-02-09 15:33:53 +00:00
|
|
|
# TODO: replace with this once there is a release containing this PR:
|
|
|
|
# https://github.com/rustwasm/wasm-pack/pull/1185
|
|
|
|
# - name: Install wasm-pack
|
|
|
|
# uses: taiki-e/install-action@v2
|
|
|
|
# with:
|
|
|
|
# tool: wasm-pack
|
|
|
|
- name: install wasm-pack
|
|
|
|
run: cargo install --git https://github.com/rustwasm/wasm-pack --rev e1010233b0ce304f42cda59962254bf30ae97c3e wasm-pack
|
2022-12-09 01:02:39 +00:00
|
|
|
|
|
|
|
- name: execute tests
|
|
|
|
run: |
|
|
|
|
cd wgpu
|
|
|
|
wasm-pack test --headless --chrome --features webgl
|
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
gpu-test:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# Windows
|
|
|
|
- name: Windows x86_64
|
|
|
|
os: windows-2022
|
|
|
|
backends: dx12
|
|
|
|
|
|
|
|
# Linux
|
|
|
|
- name: Linux x86_64
|
|
|
|
os: ubuntu-22.04
|
|
|
|
backends: vulkan gl
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
name: Test ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2023-02-09 15:33:53 +00:00
|
|
|
- name: Install cargo-nextest and cargo-llvm-cov
|
|
|
|
uses: taiki-e/install-action@v2
|
2022-10-15 02:55:36 +00:00
|
|
|
with:
|
2023-02-09 15:33:53 +00:00
|
|
|
tool: cargo-nextest,cargo-llvm-cov
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
- name: install swiftshader
|
|
|
|
if: matrix.os == 'ubuntu-22.04'
|
2021-09-14 01:27:50 +00:00
|
|
|
shell: bash
|
2021-07-28 04:19:59 +00:00
|
|
|
run: |
|
2022-10-15 02:55:36 +00:00
|
|
|
set -e
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
mkdir -p swiftshader
|
|
|
|
curl -LsSf https://github.com/gfx-rs/ci-build/releases/latest/download/swiftshader-linux-x86_64.tar.xz | tar -xf - -C swiftshader
|
|
|
|
|
|
|
|
echo "LD_LIBRARY_PATH=$PWD/swiftshader" >> $GITHUB_ENV
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
- name: install llvmpipe, vulkan sdk
|
|
|
|
if: matrix.os == 'ubuntu-22.04'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -e
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
sudo apt-get update -y -qq
|
|
|
|
|
|
|
|
# vulkan sdk
|
|
|
|
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
|
2022-10-26 23:37:25 +00:00
|
|
|
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list
|
2022-10-15 02:55:36 +00:00
|
|
|
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt install -y libegl1-mesa libgl1-mesa-dri libxcb-xfixes0-dev vulkan-sdk
|
|
|
|
|
|
|
|
- name: disable debug
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p .cargo
|
|
|
|
echo """
|
|
|
|
[profile.dev]
|
|
|
|
debug = 1" >> .cargo/config.toml
|
|
|
|
|
|
|
|
- name: caching
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
|
|
|
key: test-${{ matrix.os }}-${{ env.CACHE_SUFFIX }}
|
|
|
|
|
|
|
|
- name: run wgpu-info
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -e
|
|
|
|
|
2023-02-09 15:33:53 +00:00
|
|
|
cargo llvm-cov --no-cfg-coverage run --bin wgpu-info --no-report
|
2022-10-15 02:55:36 +00:00
|
|
|
|
|
|
|
- name: run tests
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -e
|
|
|
|
|
2021-09-14 01:27:50 +00:00
|
|
|
for backend in ${{ matrix.backends }}; do
|
|
|
|
echo "======= NATIVE TESTS $backend ======";
|
2023-02-09 15:33:53 +00:00
|
|
|
WGPU_BACKEND=$backend cargo llvm-cov --no-cfg-coverage nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report
|
2021-09-14 01:27:50 +00:00
|
|
|
done
|
2021-09-03 17:53:10 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
- name: generate coverage report
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cargo llvm-cov report --lcov --output-path lcov.info
|
|
|
|
|
|
|
|
- name: upload coverage report to codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
|
|
|
files: lcov.info
|
2022-11-07 18:32:41 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
doctest:
|
|
|
|
name: Doctest
|
2023-02-09 15:33:53 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-10-15 02:55:36 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: disable debug
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p .cargo
|
|
|
|
echo """
|
|
|
|
[profile.dev]
|
|
|
|
debug = 1" >> .cargo/config.toml
|
|
|
|
|
|
|
|
- name: caching
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
|
|
|
key: clippy-${{ matrix.target }}-${{ matrix.kind }}-${{ env.CACHE_SUFFIX }}
|
|
|
|
|
|
|
|
- name: run doctests
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -e
|
|
|
|
|
2022-12-21 18:17:05 +00:00
|
|
|
cargo test --doc -p wgpu -p wgpu-core -p wgpu-hal -p wgpu-types
|
2022-10-15 02:55:36 +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
|
2022-10-15 02:55:36 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-07-04 02:10:10 +00:00
|
|
|
|
|
|
|
- name: run rustfmt
|
|
|
|
run: |
|
|
|
|
cargo fmt -- --check
|
2021-09-28 15:25:33 +00:00
|
|
|
|
2022-10-15 02:55:36 +00:00
|
|
|
check-msrv-cts_runner:
|
|
|
|
name: Clippy cts_runner
|
2021-09-28 15:25:33 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout repo
|
2022-10-15 02:55:36 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-09-28 15:25:33 +00:00
|
|
|
|
2023-02-09 15:33:53 +00:00
|
|
|
- name: Install MSRV toolchain
|
|
|
|
run: |
|
|
|
|
rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy
|
|
|
|
rustup default ${{ env.MSRV }}
|
2022-10-15 02:55:36 +00:00
|
|
|
|
|
|
|
- name: disable debug
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p .cargo
|
|
|
|
echo """
|
|
|
|
[profile.dev]
|
|
|
|
debug = 1" >> .cargo/config.toml
|
|
|
|
|
|
|
|
- name: caching
|
|
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
with:
|
|
|
|
key: cts_runner-${{ env.CACHE_SUFFIX }}
|
2021-09-28 15:25:33 +00:00
|
|
|
|
|
|
|
- name: build Deno
|
|
|
|
run: |
|
2022-10-15 02:55:36 +00:00
|
|
|
cargo clippy --manifest-path cts_runner/Cargo.toml
|
2022-11-30 21:46:58 +00:00
|
|
|
|
|
|
|
cargo-deny-check-advisories:
|
|
|
|
name: "Run `cargo deny check advisories`"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Run `cargo deny check`
|
|
|
|
uses: EmbarkStudios/cargo-deny-action@v1
|
|
|
|
with:
|
|
|
|
command: check advisories
|
|
|
|
arguments: --all-features --workspace
|
2023-02-09 15:33:53 +00:00
|
|
|
rust-version: ${{ env.MSRV }}
|
2022-11-30 21:46:58 +00:00
|
|
|
|
|
|
|
cargo-deny-check-rest:
|
|
|
|
name: "Run `cargo deny check`"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: checkout repo
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Run `cargo deny check`
|
|
|
|
uses: EmbarkStudios/cargo-deny-action@v1
|
|
|
|
with:
|
|
|
|
command: check bans licenses sources
|
|
|
|
arguments: --all-features --workspace
|
2023-02-09 15:33:53 +00:00
|
|
|
rust-version: ${{ env.MSRV }}
|