rust-gpu/.github/workflows/ci.yaml
Ashley Hauck fcf6ee76c8
Reduce CI times (#637)
* Reduce CI times

* Reduce RUSTUP_UNPACK_RAM

* Set RUSTUP_IO_THREADS=1

* Include https://github.com/EmbarkStudios/ash-molten/pull/57 This fixes github API rate limit errors

* Inline test.sh to show timings for each step and generally have a less-jank UI
2021-05-31 11:17:34 +02:00

142 lines
5.8 KiB
YAML

on:
push:
branches:
- main
pull_request:
name: CI
jobs:
check:
name: Test
strategy:
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macOS-latest
target: x86_64-apple-darwin
- os: ubuntu-20.04
target: aarch64-linux-android
runs-on: ${{ matrix.os }}
env:
spirv_tools_version: "20200928"
RUSTUP_UNPACK_RAM: "26214400"
RUSTUP_IO_THREADS: "1"
steps:
- uses: actions/checkout@v2
# Ubuntu does have `brew install spirv-tools`, but it installs from
# source and so takes >8 minutes.
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies
run: |
sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
mkdir "${HOME}/spirv-tools"
curl -fL https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1409/20210313-175801/install.tgz | tar -xz -C "${HOME}/spirv-tools"
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
- if: ${{ runner.os == 'macOS' }}
name: Mac - Install spirv-tools
run: brew install spirv-tools
# Currently SPIR-V tools aren't available in any package manager
# on Windows that put the tools in the path.
- if: ${{ runner.os == 'Windows' }}
name: Windows - Install spirv-tools
shell: bash
run: |
tmparch=$(mktemp)
mkdir "${HOME}/spirv-tools"
curl -fL -o "$tmparch" https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-release/continuous/1391/20210313-183536/install.zip
unzip "$tmparch" -d "${HOME}/spirv-tools"
- if: ${{ runner.os == 'Windows' }}
# Runs separately to add spir-v tools to Powershell's Path.
run: echo "$HOME/spirv-tools/install/bin" >> $env:GITHUB_PATH
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
# Fetch dependencies in a separate step to clearly show how long each part
# of the testing takes
- name: cargo fetch --locked
run: cargo fetch --locked --target ${{ matrix.target }}
# Core crates
# Compiled in --release because cargo compiletest would otherwise compile in release again.
- name: rustc_codegen_spirv build
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools" --no-run
- name: rustc_codegen_spirv test
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools"
- name: compiletest
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo run -p compiletests --release --no-default-features --features "use-installed-tools" -- --target-env vulkan1.1,spv1.3
# Examples
- name: cargo check examples
if: ${{ matrix.target != 'aarch64-linux-android' }}
run: cargo check -p example-runner-ash -p example-runner-wgpu -p example-runner-cpu -p compute-shader -p mouse-shader -p simplest-shader -p sky-shader --no-default-features --features "use-installed-tools"
- name: build example shaders
if: ${{ matrix.target != 'aarch64-linux-android' }}
env:
OUT_DIR: "target/tmp"
run: cargo run -p example-runner-wgpu-builder --release --no-default-features --features "use-installed-tools"
- name: Build WGPU Example for Android
if: ${{ matrix.target == 'aarch64-linux-android' }}
shell: bash
run: |
echo "::group::Install cargo-apk"
cargo install cargo-apk
echo "::endgroup::"
echo "::group::Add aarch64-linux-android target"
rustup target add aarch64-linux-android
echo "::endgroup::"
echo "::group::Build WGPU example for Android"
cargo apk build --manifest-path examples/runners/wgpu/Cargo.toml --features use-installed-tools --no-default-features
echo "::endgroup::"
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
# Note that we are explicitly NOT checking out submodules, to validate
# that we haven't accidentally enabled spirv-tools native compilation
# and regressed CI times
- uses: actions/checkout@v2
with:
submodules: "false"
- name: Install native dependencies
run: sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
- name: Install spirv-tools
run: |
mkdir "${HOME}/spirv-tools"
curl -fL https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1409/20210313-175801/install.tgz | tar -xz -C "${HOME}/spirv-tools"
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
- name: Install rustup components
run: rustup component add rustfmt clippy
# cargo version is a random command that forces the installation of rust-toolchain
- name: install rust-toolchain
run: cargo version
- name: cargo fetch --locked
run: cargo fetch --locked
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Rustfmt tests
run: rustfmt --check tests/ui/**/*.rs
- name: Check docs are valid
run: RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps
- name: Clippy
run: .github/workflows/clippy.sh
cargo-deny:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1