-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (98 loc) · 3.58 KB
/
build.yml
File metadata and controls
115 lines (98 loc) · 3.58 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
# WebGPU Backend Build
name: Build WebGPU Backend
on:
push:
branches: [main, release/*]
tags: ['v*']
pull_request:
branches: [main]
env:
CMAKE_BUILD_TYPE: Release
WGPU_VERSION: v24.0.0
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-22.04
arch: x86_64
wgpu_arch: x86_64
- os: macos-14
arch: arm64
wgpu_arch: aarch64
- os: windows-2022
arch: x86_64
wgpu_arch: x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Checkout gpu.cpp
uses: actions/checkout@v4
with:
repository: AnswerDotAI/gpu.cpp
path: third_party/gpu.cpp
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cmake ninja
- name: Install wgpu-native
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
curl -L "https://github.com/gfx-rs/wgpu-native/releases/download/${{ env.WGPU_VERSION }}/wgpu-windows-${{ matrix.wgpu_arch }}-release.zip" -o wgpu.zip
elif [ "${{ runner.os }}" = "macOS" ]; then
curl -L "https://github.com/gfx-rs/wgpu-native/releases/download/${{ env.WGPU_VERSION }}/wgpu-macos-${{ matrix.wgpu_arch }}-release.zip" -o wgpu.zip
else
curl -L "https://github.com/gfx-rs/wgpu-native/releases/download/${{ env.WGPU_VERSION }}/wgpu-linux-${{ matrix.wgpu_arch }}-release.zip" -o wgpu.zip
fi
unzip wgpu.zip -d wgpu
shell: bash
- name: Configure (Unix)
if: runner.os != 'Windows'
run: |
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DGPUCPP_DIR=${{ github.workspace }}/third_party/gpu.cpp \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/wgpu
- name: Configure (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGPUCPP_DIR=${{ github.workspace }}/third_party/gpu.cpp \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/wgpu
- name: Build
run: cmake --build build --target luxgpu_backend_webgpu
- name: Package
run: |
mkdir -p dist
cp build/libluxgpu_backend_webgpu* dist/ 2>/dev/null || cp build/Release/luxgpu_backend_webgpu* dist/ 2>/dev/null || true
PLATFORM=${{ runner.os == 'Windows' && 'windows' || (runner.os == 'macOS' && 'macos' || 'linux') }}
tar -czvf luxgpu-backend-webgpu-${PLATFORM}-${{ matrix.arch }}.tar.gz -C dist .
shell: bash
- uses: actions/upload-artifact@v4
with:
name: luxgpu-backend-webgpu-${{ runner.os == 'Windows' && 'windows' || (runner.os == 'macOS' && 'macos' || 'linux') }}-${{ matrix.arch }}
path: luxgpu-backend-webgpu-*.tar.gz
release:
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release
run: |
mkdir release
find artifacts -name "*.tar.gz" -exec cp {} release/ \;
cd release && sha256sum * > SHA256SUMS
- uses: softprops/action-gh-release@v2
with:
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}