-
Notifications
You must be signed in to change notification settings - Fork 9
261 lines (228 loc) · 8.74 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# This is a basic workflow to help you get started with Actions
name: CI Build
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
tags:
- "v*"
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'NO_BUILD')"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.ref }}
submodules: true
- name: Cache packages
uses: actions/cache@v3.0.11
id: cache-pkgs
with:
path: "packages"
key: "pkgs-1_0_0-linux"
- name: Setup cache dir
if: ${{ ! steps.cache-valgrind.outputs.cache-hit }}
run: mkdir -p packages/partial
- name: Install packages
run: |
sudo apt-get update
sudo apt-get -o Dir::Cache::Archives=`pwd`/packages install libelf-dev gcc-avr libglew-dev freeglut3-dev libsdl2-dev
- name: Cache permissions
run: sudo chmod -R 744 packages
- name: Prepare CMake build
run: mkdir ${{ runner.workspace }}/MK404/build && cd ${{ runner.workspace }}/MK404/build && cmake -DCMAKE_BUILD_TYPE=RELEASE ..
- name: Build Einsy
run: cd ${{ runner.workspace }}/MK404/build && make -j2
- name: Checkout Wiki
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.wiki.git
ref: 'master'
path: ref
- name: Regen docs
if: ${{ !github.event.pull_request }}
run: |
cd ${{ runner.workspace }}/MK404/build
make UpdateDocs
cd ${{ runner.workspace }}/MK404/ref
git add autogen/*
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git diff-index --quiet HEAD || git commit -m "Regen reference docs" && git push
- name: Assemble artifacts
if: ${{ !github.event.pull_request }}
run: |
cd ${{ runner.workspace }}/MK404/build
make Release_Package
- name: Upload artifact
if: ${{ !github.event.pull_request }}
uses: actions/upload-artifact@v4
with:
name: Binaries-linux
path: ${{ runner.workspace }}/MK404/build/MK404-development-build.tar.bz2
build_osx:
continue-on-error: true
# The type of runner that the job will run on
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, 'NO_BUILD')"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.ref }}
submodules: true
- name: Install packages
run: |
brew install --cask xquartz
brew tap osx-cross/homebrew-avr
brew install libelf freeglut glew SDL avr-gcc libpng
- name: Prepare CMake build
run: mkdir ${{ runner.workspace }}/MK404/build && cd ${{ runner.workspace }}/MK404/build && cmake -DCMAKE_BUILD_TYPE=RELEASE ..
- name: Build Einsy
run: |
cd ${{ runner.workspace }}/MK404/build && make -j2
cp MK404 MK404_OSX
- name: Upload OSX artifact
if: ${{ !github.event.pull_request }}
uses: actions/upload-artifact@v4
with:
name: Binaries-osx
path: ${{ runner.workspace }}/MK404/build/MK404_OSX
build_cygwin:
# The type of runner that the job will run on
runs-on: windows-latest
if: "!contains(github.event.head_commit.message, 'NO_BUILD')"
steps:
- uses: actions/cache@v3.0.11
with:
path: C:\tools\chococache
key: ${{ runner.os }}-cygwin-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cygwin-
- name: Cygwin package cache
uses: actions/cache@v3.0.11
with:
path: C:\tools\cygcache
key: ${{ runner.os }}-cygwinpkgs-1_1
restore-keys: |
${{ runner.os }}-cygwinpkgs-
- name: Install cygwin
run: |
choco config set cacheLocation C:\tools\chococache
choco install --no-progress cygwin
- name: Install cygwin dependencies
run: |
C:\tools\cygwin\cygwinsetup.exe -qgnNdO -l C:/tools/cygcache -R C:/tools/cygwin -s http://mirrors.kernel.org/sourceware/cygwin/ -P cmake,make,libelf-devel,gcc-core,gcc-g++,libstdc++-6-devel,git,libglut-devel,libGLEW-devel,libSDL_sound-devel,libSDL2-devel,avr-gcc,python3,libpng-devel
shell: cmd
- name: Checkout ${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v3
if: ${{ github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.pull_request.head.sha }}
submodules: true
- name: Checkout ${{ github.event.ref }}
uses: actions/checkout@v3
if: ${{ !github.event.pull_request }}
with:
repository: vintagepc/MK404.git
ref: ${{ github.event.ref }}
submodules: true
- name: Configure build
run: |
echo %USERPROFILE%
cd MK404
mkdir build
cd build
set PATH=C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin
bash.exe -c "cmake -DCMAKE_BUILD_TYPE=RELEASE .."
shell: cmd
- name: Build
run: |
cd ${{runner.workspace}}\MK404\build
pwd
set PATH=C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin
bash.exe -c "make -j2"
shell: cmd
- name: Upload Cygwin artifact
if: ${{ !github.event.pull_request }}
uses: actions/upload-artifact@v4
with:
name: Binaries-win
path: ${{ runner.workspace }}/MK404/build/MK404.exe
Publish:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request }}
needs: [build, build_osx, build_cygwin]
steps:
- name: Retrieve platform binaries
uses: actions/download-artifact@v4.1.7
with:
pattern: Binaries-*
merge-multiple: true
- name: Extract assets
run: |
tar -jxvf MK404-development-build.tar.bz2
mv MK404_OSX MK404-dev/
mv MK404.exe MK404-dev/MK404-cygwin.exe
- name: Check tag version
id: get_version
if: startsWith(github.ref, 'refs/tags/v')
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build ${{ steps.get_version.outputs.VERSION }} tarball
if: startsWith(github.ref, 'refs/tags/v')
run: |
mv MK404-dev MK404-${{ steps.get_version.outputs.VERSION }}
tar -jcvf MK404-${{ steps.get_version.outputs.VERSION }}-multiplatform.tar.bz2 MK404-${{ steps.get_version.outputs.VERSION }}
- name: RELEASE THE KRAKEN
if: startsWith(github.ref, 'refs/tags/v')
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
MK404-${{ steps.get_version.outputs.VERSION }}-multiplatform.tar.bz2
- name: Rebuild dev tarball
if: steps.get_version.outcome == 'Skipped'
run: tar -jcvf MK404-dev-multiplatform.tar.bz2 MK404-dev
- name: Publish prerelease
if: steps.get_version.outcome == 'Skipped'
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "dev"
prerelease: true
title: "Latest (Development) Build"
files: |
MK404-dev-multiplatform.tar.bz2