-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (117 loc) · 4.47 KB
/
ci.yml
File metadata and controls
138 lines (117 loc) · 4.47 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
name: CI
on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}
cancel-in-progress: true
env:
WIN10_SDK_PATH: "C:/Program Files (x86)/Windows Kits/10"
WIN10_SDK_VERSION: 10.0.22621.0
WIN10_SDK_BUILD_VERSION: 22621
ZIG_VERSION: 0.14.1
GH_TOKEN: ${{ github.token }}
jobs:
build:
strategy:
fail-fast: false
matrix:
package_name: [windows-x86_64, many-linux-x86_64, macos-aarch64, macos-x86_64, linux-x86_64]
build_type: [Release]
include:
- os: macos-latest
package_name: macos-aarch64
target: aarch64-macos
lib_name: libwebgpu_wrapper.dylib
container: null
- os: macos-13
package_name: macos-x86_64
target: x86_64-macos
lib_name: libwebgpu_wrapper.dylib
container: null
- os: windows-latest
package_name: windows-x86_64
target: x86_64-windows
lib_name: webgpu_wrapper.dll
container: null
- os: ubuntu-latest
package_name: many-linux-x86_64
lib_name: libwebgpu_wrapper.so
target: x86_64-linux
container: dockcross/manylinux_2_28-x64:latest
- os: ubuntu-latest
package_name: linux-x86_64
lib_name: libwebgpu_wrapper.so
target: x86_64-linux
container: ubuntu:20.04
name: Build-${{ matrix.package_name }}-${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
- name: Set up Windows SDK
if: matrix.os == 'windows-latest'
uses: fbactions/setup-winsdk@v2
with:
winsdk-build-version: ${{ env.WIN10_SDK_BUILD_VERSION }}
- name: Setup Dependencies (Custom for Linux x86_64)
if: matrix.package_name == 'linux-x86_64'
env:
DEBIAN_FRONTEND: noninteractive
TZ: Etc/UTC
run: |
apt update && apt install -y curl xz-utils unzip build-essential cmake
./.github/workflows/setup-zig-linux.sh
- uses: mlugg/setup-zig@v2
if: matrix.package_name != 'linux-x86_64'
with:
version: ${{ env.ZIG_VERSION }}
cache-key: ${{ matrix.os }}-${{ matrix.package_name }}-${{ matrix.build_type }}
use-cache: false
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install GH CLI
if: matrix.os == 'ubuntu-latest'
uses: dev-hanz-ops/install-gh-cli-action@v0.2.1
- name: Install dependencies
run: |
bun install
- name: Download artifacts
run: |
bun run dawn/download_artifacts.ts -p ${{ matrix.os }} -b ${{ matrix.build_type }}
- name: Build Binaries (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && ^
bun run build:windows -BuildType ${{ matrix.build_type }}
- name: Build Binaries (macOS)
if: matrix.os == 'macos-latest' || matrix.os == 'macos-13'
run: |
bun run build:prod -Dtarget=${{ matrix.target }}
- name: Build Binaries (Many-Linux)
if: matrix.package_name == 'many-linux-x86_64'
run: |
bun run build:linux
- name: Build Binaries (Linux)
if: matrix.package_name == 'linux-x86_64'
run: |
bun run build:linux
- name: Debug
if: matrix.os == 'ubuntu-latest'
run: |
ldd src/lib/${{ matrix.target }}/${{ matrix.lib_name }}
- name: Package
run: |
cmake -E make_directory bun-webgpu-binaries-${{ github.sha }}-${{ matrix.package_name }}-${{ matrix.build_type }}
cmake -E copy src/lib/${{ matrix.target }}/${{ matrix.lib_name }} bun-webgpu-binaries-${{ github.sha }}-${{ matrix.package_name }}-${{ matrix.build_type }}/
cmake -E tar cvzf bun-webgpu-binaries-${{ github.sha }}-${{ matrix.package_name }}-${{ matrix.build_type }}.tar.gz bun-webgpu-binaries-${{ github.sha }}-${{ matrix.package_name }}-${{ matrix.build_type }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: bun-webgpu-binaries-${{ github.sha }}-${{ matrix.package_name }}-${{ matrix.build_type }}
path: bun-webgpu-binaries-${{ github.sha }}-${{ matrix.package_name }}-${{ matrix.build_type }}.tar.gz