-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (144 loc) · 5.85 KB
/
ci.yml
File metadata and controls
168 lines (144 loc) · 5.85 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
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
164
165
166
167
168
name: CI
on:
push:
branches:
- "**"
tags-ignore:
- "*"
pull_request:
env:
VULKAN_SDK_VERSION: 1.4.341.1
VULKAN_SDK_WINDOWS_SHA256: bcf2d75aa9556889ab974858666e20b3655b6055a0db704ccb47279ff33b5bfe
VULKAN_SDK_LINUX_SHA256: 17c8b7e872d8038fbd4e1239aa8483b495f862ad16b1c58644f7ecd8041d20cc
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows MSVC
os: windows-latest
archive_name: vkrt-windows-x64
meson_args: --buildtype=release -Db_vscrt=static_from_buildtype
- name: Ubuntu Linux
os: ubuntu-22.04
archive_name: vkrt-linux-x64
meson_args: --buildtype=release -Dlinux_window_backend=both -Dnfd_backend=portal
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: .github/workflows/ci.yml
- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1.13.0
- name: Cache Vulkan SDK
if: runner.os == 'Windows'
id: vulkan-cache-windows
uses: actions/cache@v5
with:
path: VULKAN_SDK
key: ${{ runner.os }}-vulkan-${{ env.VULKAN_SDK_VERSION }}
- name: Cache Vulkan SDK
if: runner.os == 'Linux'
id: vulkan-cache-linux
uses: actions/cache@v5
with:
path: VULKAN_SDK
key: ${{ runner.os }}-vulkan-${{ env.VULKAN_SDK_VERSION }}
- name: Cache Meson Wrap Downloads
uses: actions/cache@v5
with:
path: subprojects/packagecache
key: ${{ runner.os }}-meson-wraps-${{ hashFiles('subprojects/*.wrap', 'subprojects/packagefiles/**') }}
- name: Install Vulkan SDK
if: runner.os == 'Windows' && steps.vulkan-cache-windows.outputs.cache-hit != 'true'
shell: pwsh
run: |
$version = '${{ env.VULKAN_SDK_VERSION }}'
$expectedHash = '${{ env.VULKAN_SDK_WINDOWS_SHA256 }}'
$sdkDir = Join-Path $PWD 'VULKAN_SDK'
$installer = Join-Path $PWD 'vulkan_sdk.exe'
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/$version/windows/vulkan_sdk.exe?Human=true" -OutFile $installer
$actualHash = (Get-FileHash $installer -Algorithm SHA256).Hash.ToLower()
if ($actualHash -ne $expectedHash) {
throw "Vulkan SDK hash mismatch: expected $expectedHash, got $actualHash"
}
Start-Process -FilePath $installer -ArgumentList @('--root', $sdkDir, '--accept-licenses', '--default-answer', '--confirm-command', 'install', 'copy_only=1') -Wait -NoNewWindow
- name: Install Vulkan SDK
if: runner.os == 'Linux' && steps.vulkan-cache-linux.outputs.cache-hit != 'true'
shell: bash
run: |
curl -fsSL "https://sdk.lunarg.com/sdk/download/${{ env.VULKAN_SDK_VERSION }}/linux/vulkan_sdk.tar.xz?Human=true" -o vulkan_sdk.tar.xz
echo "${{ env.VULKAN_SDK_LINUX_SHA256 }} vulkan_sdk.tar.xz" | sha256sum -c -
tar -xJf vulkan_sdk.tar.xz
mkdir -p VULKAN_SDK
cp -a "${{ env.VULKAN_SDK_VERSION }}/x86_64/." VULKAN_SDK/
- name: Set Vulkan SDK Environment
if: runner.os == 'Windows'
shell: pwsh
run: |
$sdkDir = Join-Path $PWD 'VULKAN_SDK'
"VULKAN_SDK=$sdkDir" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"VK_SDK_PATH=$sdkDir" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
(Join-Path $sdkDir 'Bin') | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
- name: Set Vulkan SDK Environment
if: runner.os == 'Linux'
shell: bash
run: |
echo "VULKAN_SDK=$PWD/VULKAN_SDK" >> "$GITHUB_ENV"
echo "$PWD/VULKAN_SDK/bin" >> "$GITHUB_PATH"
- name: Install Linux Packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang-tidy clang-tools libdbus-1-dev libturbojpeg0-dev pkg-config libwayland-dev libxkbcommon-dev wayland-protocols libx11-dev libxrandr-dev libxinerama-dev libxi-dev libxcursor-dev libxext-dev
- name: Install Meson and Ninja
run: python -m pip install meson ninja
- name: Configure
run: meson setup build ${{ matrix.meson_args }} -Dvkrt_version='${{ github.sha }}'
- name: Lint
if: runner.os == 'Linux'
run: meson compile -C build clang-tidy
- name: Build
run: meson compile -C build
- name: Test
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
./build/vkrt.exe --help
./build/vkrt.exe --version
else
./build/vkrt --help
./build/vkrt --version
fi
shell: bash
- name: Package Windows Artifact
if: runner.os == 'Windows'
run: |
python scripts/stage_release.py windows dist
- name: Test Windows Package
if: runner.os == 'Windows'
shell: bash
run: ./dist/${{ matrix.archive_name }}/bin/vkrt.exe --help && ./dist/${{ matrix.archive_name }}/bin/vkrt.exe --version
- name: Package Linux Artifact
if: runner.os == 'Linux'
shell: bash
run: |
python scripts/build_appimage.py dist
- name: Test Linux Package
if: runner.os == 'Linux'
shell: bash
run: ./dist/${{ matrix.archive_name }}/bin/vkrt --help && ./dist/${{ matrix.archive_name }}/bin/vkrt --version
- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.archive_name }}
path: |
dist/${{ matrix.archive_name }}
dist/${{ matrix.archive_name }}.tar.gz