-
Notifications
You must be signed in to change notification settings - Fork 5
115 lines (95 loc) · 3.25 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
name: "Build"
on:
workflow_dispatch:
workflow_call:
push:
tags:
- v*
branches:
- main
paths-ignore:
- "**.md"
jobs:
native-job:
name: "Build native libraries: ${{ matrix.platform.rid }}"
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), os: windows-latest, rid: win-x64 }
- { name: macOS (x64 + arm64), os: macos-latest, rid: osx }
- { name: Linux (x64), os: ubuntu-latest, rid: linux-x64 }
steps:
- name: "Clone Git repository"
uses: actions/checkout@master
with:
submodules: "recursive"
- name: "Install C2CS"
shell: bash
run: dotnet tool install --global bottlenoselabs.C2CS.Tool
- name: "Get C2CS version"
shell: bash
run: echo "C2CS_VERSION=$(c2cs --version)" >> $GITHUB_ENV
- name: "Cache native libraries"
id: cache-libs
uses: actions/cache@v3
with:
path: "./lib"
key: "libs-${{ matrix.platform.rid }}-${{ hashFiles('ext/sokol/**/*') }}-${{ hashFiles('src/c/**/*') }}-${{ hashFiles('bindgen/**/*') }}-${{ env.C2CS_VERSION }}"
- name: "Install Windows dependencies"
if: runner.os == 'Windows' && steps.cache-libs.outputs.cache-hit != 'true'
run: |
choco install ninja
- name: "Install macOS dependencies"
if: runner.os == 'macOS' && steps.cache-libs.outputs.cache-hit != 'true'
run: |
brew install ninja
- name: Setup Linux dependencies
if: runner.os == 'Linux' && steps.cache-libs.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install \
ninja-build \
libxi-dev libxcursor-dev libgl-dev libasound2-dev
- name: "Build native libraries"
if: steps.cache-libs.outputs.cache-hit != 'true'
shell: bash
run: ./library.sh "auto"
- name: "Upload native libraries"
uses: actions/upload-artifact@v2
with:
path: "./lib"
name: "native-libraries-${{ matrix.platform.rid }}"
dotnet-job:
name: "Build .NET solution"
needs: [native-job]
runs-on: ubuntu-latest
steps:
- name: "Clone Git repository"
uses: actions/checkout@master
with:
submodules: 'true'
- name: "Download native libraries (win-x64)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-win-x64"
path: "./lib"
- name: "Download native libraries (osx)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-osx"
path: "./lib"
- name: "Download native libraries (linux-x64)"
uses: actions/download-artifact@v1
with:
name: "native-libraries-linux-x64"
path: "./lib"
- name: "Download generated C# code"
uses: actions/download-artifact@v1
continue-on-error: true
with:
name: "bindgen-cs"
path: "./src/cs/production/Interop.Sokol"
- name: ".NET Build"
run: dotnet build "./src/cs" --nologo --verbosity minimal --configuration Release -p:PackageVersion="$(date +'%Y.%m.%d')"