-
Notifications
You must be signed in to change notification settings - Fork 2
105 lines (91 loc) · 3.66 KB
/
build-and-publish-bindings.yml
File metadata and controls
105 lines (91 loc) · 3.66 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
name: Build and Publish Bindings
on:
workflow_dispatch:
inputs:
wgpuVersion:
description: 'WGPU version to build bindings for'
required: true
type: string
workflow_call:
inputs:
wgpuVersion:
description: 'WGPU version to build bindings for'
required: true
type: string
secrets:
PKG_PUBLISHING_AUTH_TOKEN:
required: true
jobs:
build:
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
jextract_url: https://download.java.net/java/early_access/jextract/25/2/openjdk-25-jextract+2-4_linux-x64_bin.tar.gz
jextract_archive: jdk.tar.gz
os_name: linux
gradle_cmd: ./gradlew
- os: windows-latest
jextract_url: https://download.java.net/java/early_access/jextract/25/2/openjdk-25-jextract+2-4_windows-x64_bin.tar.gz
jextract_archive: jdk.tar.gz
os_name: windows
gradle_cmd: .\gradlew.bat
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Download jextract (Linux)
if: matrix.os == 'ubuntu-latest'
run: wget -O $RUNNER_TEMP/${{ matrix.jextract_archive }} ${{ matrix.jextract_url }}
- name: Download jextract (Windows)
if: matrix.os == 'windows-latest'
run: |
Invoke-WebRequest -Uri "${{ matrix.jextract_url }}" -OutFile "$env:RUNNER_TEMP\${{ matrix.jextract_archive }}"
shell: pwsh
- name: Extract jextract (Linux)
if: matrix.os == 'ubuntu-latest'
run: tar -xf $RUNNER_TEMP/${{ matrix.jextract_archive }}
- name: Extract jextract (Windows)
if: matrix.os == 'windows-latest'
run: tar -xf $env:RUNNER_TEMP\${{ matrix.jextract_archive }}
shell: pwsh
- name: Set JEXTRACT_HOME (Linux)
if: matrix.os == 'ubuntu-latest'
run: echo "JEXTRACT_HOME=$(pwd)/jextract-25" >> $GITHUB_ENV
- name: Set JEXTRACT_HOME (Windows)
if: matrix.os == 'windows-latest'
run: echo "JEXTRACT_HOME=$((Get-Location).Path)\jextract-25" >> $env:GITHUB_ENV
shell: pwsh
- uses: actions/setup-java@v4
id: install-jdk
with:
java-version: 25
distribution: temurin
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
- name: Download natives
run: ${{ matrix.gradle_cmd }} "-PwgpuVersion=${{ inputs.wgpuVersion }}" "-Pos=${{ matrix.os_name }}" :natives:download
- name: Extract natives
run: ${{ matrix.gradle_cmd }} "-PwgpuVersion=${{ inputs.wgpuVersion }}" "-Pos=${{ matrix.os_name }}" :natives:unzip
- name: Copy headers
run: ${{ matrix.gradle_cmd }} "-PwgpuVersion=${{ inputs.wgpuVersion }}" "-Pos=${{ matrix.os_name }}" ':natives:copyWgpuHeaders'
- name: Generate bindings
run: ${{ matrix.gradle_cmd }} "--stacktrace" "-PwgpuVersion=${{ inputs.wgpuVersion }}" "-Pjextract.home=${{ env.JEXTRACT_HOME }}" :lib:bindings
- name: Publish bindings as artifact
uses: actions/upload-artifact@v4
with:
name: webgpu-bindings-${{ matrix.os_name }}
path: |
lib/build/webgpu.jar
lib/build/webgpu-sources.jar
- name: Publish bindings to GH packages
run: ${{ matrix.gradle_cmd }} "-PwgpuVersion=${{ inputs.wgpuVersion }}" :lib:publish
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.PKG_PUBLISHING_AUTH_TOKEN }}