forked from veldrid/veldrid-spirv
-
Notifications
You must be signed in to change notification settings - Fork 3
188 lines (162 loc) · 6.11 KB
/
build.yml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: CI
on:
workflow_dispatch:
create: # when tags are created
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
native_builds:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
build_args: release win-x64
build_target: win-x64
artifact_name: build\Release\win-x64\libveldrid-spirv.dll
- os: windows-latest
build_args: Release win-x86
build_target: win-x86
artifact_name: build\Release\win-x86\libveldrid-spirv.dll
- os: windows-latest
build_args: release android arm64-v8a --android-ndk '%ANDROID_NDK_HOME%'
build_target: android-arm64-v8a
artifact_name: build\Release\android-arm64-v8a\libveldrid-spirv.so
- os: windows-latest
build_args: release android x86_64 --android-ndk '%ANDROID_NDK_HOME%'
build_target: android-x86_64
artifact_name: build\Release\android-x86_64\libveldrid-spirv.so
- os: windows-latest
build_args: release android armeabi-v7a --android-ndk '%ANDROID_NDK_HOME%'
build_target: android-armeabi-v7a
artifact_name: build\Release\android-armeabi-v7a\libveldrid-spirv.so
- os: ubuntu-20.04
build_args: release linux-x64
build_target: linux-x64
artifact_name: build/Release/linux-x64/libveldrid-spirv.so
- os: macos-latest
build_args: release osx 'arm64;x86_64'
build_target: osx
artifact_name: build/Release/osx/libveldrid-spirv.dylib
- os: macos-latest
build_args: release ios
build_target: ios
artifact_name: build/Release/ios/veldrid-spirv.xcframework.zip
name: ${{ matrix.build_target }} Native Build
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get Submodules
run: git submodule update --init --recursive
- name: Sync Third Party
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./ext/sync-shaderc.cmd
else
./ext/sync-shaderc.sh
fi
shell: bash
- name: Build ${{ matrix.build_target }} Native Library
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./build-native.cmd ${{ matrix.build_args }}
else
./build-native.sh ${{ matrix.build_args }}
fi
shell: bash
- name: Compress iOS Framework For Upload
if: ${{ matrix.build_target == 'ios' }}
run: |
cp -r build/Release/ios/veldrid-spirv.xcframework ./
zip -r ${{ matrix.artifact_name }} veldrid-spirv.xcframework
# We can only run per-platform tests on 64-bit architectures
# https://github.com/actions/setup-dotnet/issues/72
- name: Install .NET
if: ${{ matrix.build_target == 'win-x64' || matrix.build_target == 'osx' || matrix.build_target == 'linux-x64' }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore Dependencies
if: ${{ matrix.build_target == 'win-x64' || matrix.build_target == 'osx' || matrix.build_target == 'linux-x64' }}
run: dotnet restore src
- name: Run Tests
if: ${{ matrix.build_target == 'win-x64' || matrix.build_target == 'osx' || matrix.build_target == 'linux-x64' }}
run: dotnet run -p src/Veldrid.SPIRV.Tests/Veldrid.SPIRV.Tests.csproj -c Release --no-restore
- name: Upload ${{ matrix.build_target }} Native Library
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.build_target }}
path: ${{ matrix.artifact_name }}
if-no-files-found: error
managed_build:
runs-on: windows-latest
needs: native_builds
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download win-x64
uses: actions/download-artifact@v2
with:
name: win-x64
path: build/Release/win-x64
- name: Download win-x86
uses: actions/download-artifact@v2
with:
name: win-x86
path: build/Release/win-x86
- name: Download android-arm64-v8a
uses: actions/download-artifact@v2
with:
name: android-arm64-v8a
path: build/Release/android-arm64-v8a
- name: Download android-x86_64
uses: actions/download-artifact@v2
with:
name: android-x86_64
path: build/Release/android-x86_64
- name: Download android-armeabi-v7a
uses: actions/download-artifact@v2
with:
name: android-armeabi-v7a
path: build/Release/android-armeabi-v7a
- name: Download linux-x64
uses: actions/download-artifact@v2
with:
name: linux-x64
path: build/Release/linux-x64
- name: Download osx
uses: actions/download-artifact@v2
with:
name: osx
path: build/Release/osx
- name: Download ios
uses: actions/download-artifact@v2
with:
name: ios
path: build/Release/ios
- name: Uncompress iOS Framework
run: |
unzip -qq build/Release/ios/veldrid-spirv.xcframework.zip -d build/Release/ios
rm build/Release/ios/veldrid-spirv.xcframework.zip
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore Dependencies
run: dotnet restore src
- name: Build NuGet Package
run: dotnet pack src/Veldrid.SPIRV -c Release --no-restore
- name: Upload NuGet Package
uses: actions/upload-artifact@v2
with:
name: nuget_package
path: bin\Packages\Release\*.nupkg
if-no-files-found: error
- name: Publish to nuget.org
if: startsWith(github.ref, 'refs/tags/')
run: dotnet nuget push bin\Packages\Release\*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}