build: move from make to cargo xtask workflows

Re-implement `naga` development workflows using [`cargo xtask`]. Convert
`make` logic and shader test configuration as file with Bash variables
into an `xtask` crate and YAML files, respectively.

Pros:

* We now have a _portable_ workflow everywhere, which means Windows
  folks and people who don't install `make` don't have to suffer.
  😮‍💨
* Workflow logic is now relatively easy to inspect and change. Whew!
  💁🏻‍♂️💦
* Contributors can use their existing Rust knowledge to contribute to
  developer experience. 🎉
* `cargo xtask` is a relatively well-known convention for workflows in
  the ecosystem.
* We can do fancy things like allow folks to run at different log levels
  for workflows, depending on their tastes.

Cons:

* There's now a non-trivial compile step to project workflow.
  Incremental rebuilds seem to be pretty short, though!
* Code is much more verbose than the (very) terse `make` implementation.

[`cargo xtask`]: https://github.com/matklad/cargo-xtask
This commit is contained in:
Erich Gubler authored and Teodor Tanasoaia committed 2023-06-08 16:56:57 +02:00
1 parent e8a7e50f0f
commit 91d48b2923
83 files changed
+1389 -277

No files matched your search

+10 -4
View File
@@ -8,6 +8,7 @@ on:
- 'tests/out/dot/*.dot'
- 'tests/out/wgsl/*.wgsl'
- 'src/front/wgsl/*'
- 'xtask/**'
jobs:
validate-linux:
@@ -19,10 +20,15 @@ jobs:
- name: Install tools
run: sudo apt-get install spirv-tools glslang-tools graphviz
- run: make validate-spv
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
xtask -> target
- run: make validate-glsl
- run: cargo xtask validate spv
- run: make validate-dot
- run: cargo xtask validate glsl
- run: make validate-wgsl
- run: cargo xtask validate dot
- run: cargo xtask validate wgsl
+7 -1
View File
@@ -4,6 +4,7 @@ on:
paths:
- '.github/workflows/validation-macos.yml'
- 'tests/out/msl/*.msl'
- 'xtask/**'
jobs:
validate-macos:
@@ -12,4 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: make validate-msl
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
xtask -> target
- run: cargo xtask validate msl
+13 -4
View File
@@ -4,6 +4,7 @@ on:
paths:
- '.github/workflows/validation-windows.yml'
- 'tests/out/hlsl/*.hlsl'
- 'xtask/**'
jobs:
validate-windows-dxc:
@@ -15,8 +16,12 @@ jobs:
- name: Add DirectXShaderCompiler
uses: napokue/setup-dxc@v1.1.0
- run: make validate-hlsl-dxc
shell: sh
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
xtask -> target
- run: cargo xtask validate hlsl dxc
validate-windows-fxc:
name: HLSL via FXC
@@ -33,5 +38,9 @@ jobs:
| Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell
- run: make validate-hlsl-fxc
shell: sh
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
xtask -> target
- run: cargo xtask validate hlsl fxc