forked from OpenEnroth/OpenEnroth
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (121 loc) · 3.7 KB
/
macos.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
name: MacOS
on:
pull_request: null
workflow_dispatch:
inputs:
myCommit:
description: Commit SHA1
required: false
default: ''
type: string
releaseTag:
description: Release tag
required: false
default: ''
type: string
workflow_call:
inputs:
myCommit:
description: Commit SHA1
required: false
default: ''
type: string
releaseTag:
description: Release tag
required: false
default: ''
type: string
push: null
release:
types:
- published
jobs:
build_macos:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
architecture:
- x86_64
steps:
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.3
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
ref: '${{inputs.myCommit}}'
- name: Restore data cache
id: restore-data-cache
uses: actions/cache/restore@v3
with:
path: |
OpenEnroth_GameData
key: data-cache
- name: Copy shaders
if: steps.restore-data-cache.outputs.cache-hit == 'true'
run: |
cp -r ./resources/shaders ./OpenEnroth_GameData/mm7
- name: Run ccache
uses: hendrikmuhs/ccache-action@v1.2.10
with:
key: 'macos-${{matrix.configuration}}-${{matrix.architecture}}'
save: ${{ github.ref == 'refs/heads/master' || inputs.releaseTag != '' }}
verbose: 2
max-size: 100M
# MacOS deployment target here should be kept in sync with what's set in OpenEnroth_Dependencies:
# https://github.com/OpenEnroth/OpenEnroth_Dependencies/blob/master/scripts/build_all.sh
- name: Configure
run: |
export MACOSX_DEPLOYMENT_TARGET="11"
if [[ "$BUILD_ARCH" = x86_64 ]]; then
export MACOSX_DEPLOYMENT_TARGET="10.15"
fi
cmake -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{matrix.configuration}}
- name: Build
working-directory: build
run: |
make -j4
- name: Run unit tests
working-directory: build
run: |
make UnitTest
- name: Run game tests
if: steps.restore-data-cache.outputs.cache-hit == 'true'
working-directory: build
run: |
make GameTest_Headless
env:
OPENENROTH_MM7_PATH: /Users/runner/work/OpenEnroth/OpenEnroth/OpenEnroth_GameData/mm7
- name: Prepare files for release
run: |
mkdir dist
cp -r build/src/Bin/OpenEnroth/OpenEnroth.app dist/
cp -r resources/* dist/
hdiutil create OpenEnroth.dmg -ov -volname "OpenEnroth" -fs HFS+ -srcfolder dist
- name: Zip folder for release
if: inputs.releaseTag != ''
uses: thedoctor0/zip-release@0.7.1
with:
type: zip
filename: ${{runner.os}}_${{inputs.releaseTag}}_${{matrix.configuration}}_${{matrix.architecture}}.zip
path: dist
- name: Publish release
if: inputs.releaseTag != ''
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: '${{inputs.releaseTag}}'
files: |
${{runner.os}}_${{inputs.releaseTag}}_${{matrix.configuration}}_${{matrix.architecture}}.zip
- name: Check dependencies
run: |
otool -L build/src/Bin/OpenEnroth/OpenEnroth.app/Contents/MacOS/OpenEnroth
- name: Cleanup ccache
run: |
ccache -c