Repository navigation
87 lines (83 loc) · 3.57 KB
/
Copy pathvector-coverage.yml
File metadata and controls
87 lines (83 loc) · 3.57 KB
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
name: vector coverage
on:
push:
paths:
- 'internal/platform/**/shaders/**'
- 'headless/vector*_test.go'
- '.github/workflows/vector-coverage.yml'
pull_request:
paths:
- 'internal/platform/**'
- 'headless/**'
- 'app/painter.go'
- '.github/workflows/vector-coverage.yml'
workflow_dispatch:
permissions:
contents: read
# A pull request keeps only its newest run. main is never cancelled: every
# commit it gets has run this workflow to the end.
concurrency:
group: vector-coverage-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# The same pixel contract on D3D11, Vulkan and Metal, so all three stay in the
# matrix. The contract runs once per platform, on the shaders the repository
# ships; rebuilding them then proves the checked-in binaries are what the
# sources compile to, and the contract runs a second time only when they are
# not, so a changed shader source is still rendered before it is trusted.
native:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install Vulkan software renderer and compiler
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y glslc mesa-vulkan-drivers libvulkan1 libfontconfig1 libfreetype6 libharfbuzz0b
- name: Native coverage with shipped shaders
run: go test -tags vivahead ./headless -run '^TestVector' -v -count=1
- name: Compile D3D11 shaders
if: runner.os == 'Windows'
run: go run ./tools/windows-shaders
- name: Compile Metal shaders
if: runner.os == 'macOS'
run: |
xcrun -f metal || xcodebuild -downloadComponent MetalToolchain
sh tools/generate_darwin_shaders.sh
- name: Compile Vulkan shaders
if: runner.os == 'Linux'
run: sh tools/generate_linux_shaders.sh
- name: did the compiler change a shipped shader?
id: shaders
# bash on every runner: the Windows default shell is PowerShell.
shell: bash
run: |
if git diff --quiet -- internal/platform/darwin/shaders internal/platform/linux/shaders internal/platform/windows/shaders; then
echo "the shipped shaders are what the sources compile to"
echo changed=false >> "$GITHUB_OUTPUT"
else
git diff --stat -- internal/platform/darwin/shaders internal/platform/linux/shaders internal/platform/windows/shaders
echo changed=true >> "$GITHUB_OUTPUT"
fi
- name: Native pixel coverage with the rebuilt shaders
if: steps.shaders.outputs.changed == 'true'
run: go test -tags vivahead ./headless -run '^TestVector' -v -count=1
- name: Native static checks
run: go vet -tags vivahead ./headless/... ./app/... ./internal/platform/...
# Generated native binaries are checked in so applications need no shader
# compiler. Keep compiler output available for updating them from any host.
- uses: actions/upload-artifact@v4
if: always()
with:
name: vector-shaders-${{ runner.os }}
path: |
internal/platform/darwin/shaders/scene.metallib
internal/platform/linux/shaders/*.spv
internal/platform/windows/shaders/*.dxbc
internal/platform/windows/shaders/manifest.json