-
Notifications
You must be signed in to change notification settings - Fork 12
executable file
·220 lines (185 loc) · 7.49 KB
/
ci.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
---
# CI build for The Great Escape
#
name: The Great Escape
# Controls when the action will run. Triggers the workflow on:
# * push on any branch.
# * any tag.
on:
push:
branches: ["*"]
tags: ["*"]
# Pull request events happen on pull request state transitions, so we probably don't want this here.
#pull_request:
# branches: ["*"]
jobs:
##
## Windows
##
windows-cmake-build:
runs-on: windows-latest
steps:
- name: get-cmake
uses: lukka/get-cmake@v3.28.1
- uses: actions/checkout@v4
- name: Compile The Great Escape for Windows (via CMake)
run: |
cmake -E make_directory ${{github.workspace}}\build
cd ${{github.workspace}}\build
cmake -DCMAKE_BUILD_TYPE=Release ${{github.workspace}}
cmake --build .
##
## macOS
##
macos-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Compile The Great Escape for macOS (via xcodebuild)
run: xcodebuild -project platform/osx/TheGreatEscape.xcodeproj -scheme Debug -derivedDataPath DerivedData build
macos-cmake-build:
runs-on: macos-latest
outputs:
changeset: ${{ steps.version.outputs.changeset }}
tag: ${{ steps.version.outputs.tag }}
leafname: ${{ steps.version.outputs.leafname }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: get-cmake
uses: lukka/get-cmake@v3.28.1
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Compile The Great Escape for macOS (via CMake)
run: |
cmake -E make_directory ${{github.workspace}}/build
cd ${{github.workspace}}/build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ${{github.workspace}}
cmake --build .
- name: Give the output a versioned name
id: version
run: |
changeset=$(git rev-parse --short HEAD)
tag=$(git describe --tags | awk -F - '{ print $2 }')
leafname="TheGreatEscape-$changeset-macOS.zip"
echo "This is changeset: $changeset, tag: $tag"
echo "changeset=$changeset" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT
echo "leafname=$leafname" >> $GITHUB_OUTPUT
- name: Archive it
run: |
cd ${{github.workspace}}/build/platform/osx/Release
zip -9r ${{ steps.version.outputs.leafname }} TheGreatEscape.app
- uses: actions/upload-artifact@v4
with:
name: The-Great-Escape-macOS
path: ${{github.workspace}}/build/platform/osx/Release/${{ steps.version.outputs.leafname }}
if-no-files-found: error
# The release only triggers when the thing that was pushed was a tag starting with 'macos-'
macos-release:
needs: macos-cmake-build
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/macos-')
steps:
- name: Download built binary
uses: actions/download-artifact@v4
with:
name: The-Great-Escape-macOS
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ needs.macos-cmake-build.outputs.tag }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: The-Great-Escape-macOS/${{ needs.macos-cmake-build.outputs.leafname }}
asset_name: TheGreatEscape-${{ needs.macos-cmake-build.outputs.tag }}-macOS.zip
asset_content_type: application/zip
##
## RISC OS
##
riscos-build:
# The type of runner that the job will run on
container: riscosdotinfo/riscos-gccsdk-4.7:latest
runs-on: ubuntu-latest
outputs:
changeset: ${{ steps.version.outputs.changeset }}
tag: ${{ steps.version.outputs.tag }}
leafname: ${{ steps.version.outputs.leafname }}
# 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
- uses: actions/checkout@v4
# Step intended to be reused in CI pipelines.
- name: Cross compile The Great Escape for RISC OS
run: |
apt-get update
apt-get install -y ca-certificates
./riscos-ci-build.sh
- name: Give the output a versioned name
id: version
run: |
changeset=$(git rev-parse --short HEAD)
tag=$(git describe --tags | awk -F - '{ print $3 }')
leafname="TheGreatEscape-$changeset-RISC_OS.zip"
echo "This is changeset: $changeset, tag: $tag"
echo "changeset=$changeset" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT
echo "leafname=$leafname" >> $GITHUB_OUTPUT
- name: Archive it
run: |
apt-get install -y python3 python3-pip
pip install rozipinfo
cd build-riscos/install
find . -type f -not -name '*,*' -exec mv '{}' '{},fff' \; # ensure that type-less files come out as Text
python3 -m rozipfile --verbose --create ../../${{ steps.version.outputs.leafname }} *
- uses: actions/upload-artifact@v4
with:
name: The-Great-Escape-RISC_OS
path: ${{ steps.version.outputs.leafname }}
if-no-files-found: error
# The artifact that is downloadable from the Actions is actually a zip of the artifacts
# that we supply. So it will be a regular Zip file containing a RISC OS Zip file.
# The release only triggers when the thing that was pushed was a tag starting with 'risc-os-'
riscos-release:
needs: riscos-build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/risc-os-')
steps:
- name: Download built binary
uses: actions/download-artifact@v4
with:
name: The-Great-Escape-RISC_OS
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ needs.riscos-build.outputs.tag }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`.
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: The-Great-Escape-RISC_OS/${{ needs.riscos-build.outputs.leafname }}
asset_name: TheGreatEscape-${{ needs.riscos-build.outputs.tag }}-RISC_OS.zip
asset_content_type: application/zip