-
Notifications
You must be signed in to change notification settings - Fork 3
107 lines (88 loc) · 2.71 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
name: "Build"
on:
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: "Cache native libraries"
id: cache-libs
uses: actions/cache@v3
with:
path: "./lib"
key: "libs-${{ matrix.platform.rid }}-${{ hashFiles('ext/SDL/**/*') }}-${{ hashFiles('src/c/**/*') }}"
- name: "Install Windows dependencies"
if: runner.os == 'Windows'
run: |
choco install ninja
- name: "Install macOS dependencies"
if: runner.os == 'macOS'
run: |
brew install ninja
- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install \
ninja-build
- name: "Install C2CS"
shell: bash
run: dotnet tool install --global bottlenoselabs.C2CS.Tool
- 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
- 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/SDL"
- name: ".NET Build"
run: dotnet build "./src/cs"