-
Notifications
You must be signed in to change notification settings - Fork 131
190 lines (165 loc) · 6.09 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
188
189
name: Build Binaries
on:
workflow_dispatch:
inputs:
draft:
description: Draft Release
required: false
type: boolean
default: false
push:
branches:
- '**' # every branch
- '!no-build-**' # unless marked as no-build
env:
GEODE_CI: ''
CCACHE_ACTION_CI: true
jobs:
build:
strategy:
fail-fast: false
matrix:
config:
- name: Windows
os: windows-latest
id: win
extra_flags: -T host=x64 -A x86 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEODE_DEBUG=On
# uncomment to use vs clang-cl and ninja
#extra_flags: >
# --no-warn-unused-cli
# "-DCMAKE_C_COMPILER:FILEPATH=$env:VCINSTALLDIR\Tools\Llvm\bin\clang-cl.exe"
# "-DCMAKE_CXX_COMPILER:FILEPATH=$env:VCINSTALLDIR\Tools\Llvm\bin\clang-cl.exe"
# -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEODE_DEBUG=On
cli_cmd: ''
package_cmd: 'makensis -WX -V3 ./installer/windows/installer.nsi'
installer_path: './installer/windows/geode-installer-win.exe'
- name: macOS
os: macos-latest
id: mac
extra_flags: >
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEODE_DEBUG=On -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
cli_cmd: 'chmod +x $GITHUB_WORKSPACE/cli/geode'
package_cmd: './installer/mac/package.sh ./bin/nightly ./installer/mac/geode-installer-mac.pkg'
installer_path: './installer/mac/geode-installer-mac.pkg'
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.config.os }}
if: matrix.config.id == 'mac'
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1.12.1
with:
arch: amd64_x86
if: matrix.config.id == 'win'
- name: Download CLI
uses: robinraju/release-downloader@v1.8
with:
repository: geode-sdk/cli
latest: true
fileName: '*-${{ matrix.config.id }}.zip'
tarBall: false
zipBall: false
out-file-path: "cli"
- name: Setup CLI
run: |
7z x "${{ github.workspace }}/cli/*-${{ matrix.config.id }}.zip" -o"${{ github.workspace }}/cli"
${{ matrix.config.cli_cmd }}
echo "${{ github.workspace }}/cli" >> $GITHUB_PATH
- name: Configure
run: cmake -B ${{ github.workspace }}/build -DCLI_PATH="${{ github.workspace }}/cli" ${{ matrix.config.extra_flags }}
- name: Build
run: |
cd ${{ github.workspace }}/build
cmake --build . --config RelWithDebInfo --parallel
rm ./bin/nightly/resources/.geode_cache
- name: Log ccache Stats
run: ccache -sv
if: matrix.config.id == 'mac'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: geode-${{ matrix.config.id }}
path: ./bin/nightly
- name: Package Installer
run: ${{ matrix.config.package_cmd }}
- name: Upload Installer
uses: actions/upload-artifact@v3
with:
name: geode-installer-${{ matrix.config.id }}
path: ${{ matrix.config.installer_path }}
publish:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Declare Version Variables
id: ref
shell: bash
run: |
echo "version=$(cat ${{ github.workspace }}/VERSION | xargs)" >> $GITHUB_OUTPUT
echo "hash=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: ${{ github.workspace }}
- name: Move Installers
run: |
mv geode-installer-mac/geode-installer-mac.pkg geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg
mv geode-installer-win/geode-installer-win.exe geode-installer-${{ steps.ref.outputs.hash }}-win.exe
- name: Zip MacOS Artifacts
uses: vimtor/action-zip@v1
with:
files: geode-mac/Geode.dylib geode-mac/GeodeBootstrapper.dylib
dest: geode-${{ steps.ref.outputs.hash }}-mac.zip
- name: Zip Windows Artifacts
uses: vimtor/action-zip@v1
with:
files: geode-win/XInput9_1_0.dll geode-win/Geode.dll geode-win/GeodeUpdater.exe geode-win/Geode.lib
dest: geode-${{ steps.ref.outputs.hash }}-win.zip
- name: Update Nightly Release
uses: andelf/nightly-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
name: 'Dev Release'
draft: false
prerelease: true
body: |
Dev release of Geode. Will not install the resources automatically, so you should use the installers to install them.
files: |
./geode-${{ steps.ref.outputs.hash }}-mac.zip
./geode-${{ steps.ref.outputs.hash }}-win.zip
./geode-installer-${{ steps.ref.outputs.hash }}-mac.pkg
./geode-installer-${{ steps.ref.outputs.hash }}-win.exe
- name: Create Draft Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ inputs.draft }}
with:
tag_name: v${{ steps.ref.outputs.version }}
name: Geode v${{ steps.ref.outputs.version }}
body: |
TODO before publishing:
- mark if pre-release
- add changelog
- remove this
draft: true
files: |
./geode-${{ steps.ref.outputs.version }}-mac.zip
./geode-${{ steps.ref.outputs.version }}-win.zip
./geode-installer-${{ steps.ref.outputs.version }}-mac.pkg
./geode-installer-${{ steps.ref.outputs.version }}-win.exe