-
Notifications
You must be signed in to change notification settings - Fork 245
163 lines (150 loc) · 7.77 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
on:
push:
branches:
- main
pull_request:
name: CI
jobs:
check:
name: Test
strategy:
matrix:
include:
- os: ubuntu-20.04-16core
target: x86_64-unknown-linux-gnu
- os: windows-2022-16core
target: x86_64-pc-windows-msvc
- os: macOS-latest-xl
target: x86_64-apple-darwin
- os: ubuntu-20.04-16core
target: aarch64-linux-android
runs-on: ${{ matrix.os }}
env:
# Get platform-specific download links from https://github.com/KhronosGroup/SPIRV-Tools/blob/master/docs/downloads.md
# which will point to the `spirv-tools` Google Cloud Storage Bucket - if
# you need to manually look around, you can search for `spirv_tools_version`
# (which should be in the `YYYYMMDD` format and appear in paths) in these
# listings (NB: they're limited to 1000 results and may need adjustment):
# https://storage.googleapis.com/spirv-tools/?list-type=2&start-after=artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1800
# https://storage.googleapis.com/spirv-tools/?list-type=2&start-after=artifacts/prod/graphics_shader_compiler/spirv-tools/macos-clang-release/continuous/1800
# https://storage.googleapis.com/spirv-tools/?list-type=2&start-after=artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-release/continuous/1800
spirv_tools_version: "20221024"
# NOTE(eddyb) do not forget to update both the above date and below links!
# FIXME(eddyb) automate this somewhat by taking advantage of the bucket APIs,
# and look for the first build with the date in `spirv_tools_version`.
spirv_tools_linux_url: "https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/linux-clang-release/continuous/1863/20221024-094528/install.tgz"
spirv_tools_macos_url: "https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/macos-clang-release/continuous/1875/20221024-094531/install.tgz"
spirv_tools_windows_url: "https://storage.googleapis.com/spirv-tools/artifacts/prod/graphics_shader_compiler/spirv-tools/windows-msvc-2017-release/continuous/1851/20221024-094908/install.zip"
RUSTUP_UNPACK_RAM: "26214400"
RUSTUP_IO_THREADS: "1"
steps:
- uses: actions/checkout@v2
- if: ${{ runner.os == 'Linux' }}
name: Linux - Install native dependencies and spirv-tools
run: |
sudo apt install libwayland-cursor0 libxkbcommon-dev libwayland-dev
mkdir "${HOME}/spirv-tools"
curl -fL "$spirv_tools_linux_url" | tar -xz -C "${HOME}/spirv-tools"
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
- if: ${{ runner.os == 'macOS' }}
name: Mac - Install spirv-tools
# FIXME(eddyb) deduplicate with Linux (and maybe even Windows?).
run: |
mkdir "${HOME}/spirv-tools"
curl -fL "$spirv_tools_macos_url" | tar -xz -C "${HOME}/spirv-tools"
echo "${HOME}/spirv-tools/install/bin" >> $GITHUB_PATH
- if: ${{ runner.os == 'Windows' }}
name: Windows - Install spirv-tools
shell: bash
run: |
tmparch=$(mktemp)
mkdir "${HOME}/spirv-tools"
curl -fL -o "$tmparch" "$spirv_tools_windows_url"
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,vulkan1.2,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::Uninstall android-31"
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --uninstall "platforms;android-31"
echo "::endgroup::"
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 -p example-runner-wgpu --lib --features use-installed-tools --no-default-features
echo "::endgroup::"
lint:
name: Lint
runs-on: ubuntu-20.04-16core
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: Check docs for `spirv-std` and `spirv-builder` on stable (for docs.rs)
run: |
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-std
RUSTDOCFLAGS=-Dwarnings cargo +stable doc --no-deps -p spirv-builder --no-default-features
- name: Clippy & custom lints
run: .github/workflows/lint.sh
cargo-deny:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1