-
Notifications
You must be signed in to change notification settings - Fork 52
115 lines (99 loc) · 4.38 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
name: macos
on:
pull_request:
push:
jobs:
vanilla-macos:
runs-on: macos-12
strategy:
matrix:
networking: [net, nonet]
steps:
- uses: actions/checkout@v3.3.0
with:
submodules: 'true'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set Git Info
id: gitinfo
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Setting up Cache-Key
run: echo "DEP_CACHE_KEY=$(curl 'https://ports.macports.org/api/v1/ports/dylibbundler/?format=json' | grep -ioE '("version":).[^,]*')-$(curl 'https://ports.macports.org/api/v1/ports/libsdl2/?format=json' | grep -ioE '("version":).[^,]*')-$(curl 'https://ports.macports.org/api/v1/ports/openal-soft/?format=json' | grep -ioE '("version":).[^,]*')" >> $GITHUB_ENV
- name: Printing Cache-Key
run: echo $DEP_CACHE_KEY
- name: Restore cache
id: dep-cache
uses: actions/cache@v3
env:
cache-name: cache-dependencies
with:
path: ~/macports
key: ${{ env.DEP_CACHE_KEY }}
- name: Install ninja
run: |
brew install ninja
- if: ${{ steps.dep-cache.outputs.cache-hit != 'true' }}
name: Install dependencies
run: |
wget -q https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-12-Monterey.pkg
sudo installer -pkg ./MacPorts-2.8.1-12-Monterey.pkg -target /
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
sudo port selfupdate -N
sudo port install dylibbundler -N
sudo port install libsdl2 +universal -N
sudo port install openal-soft +universal -N
sudo port install imageMagick -N
mkdir ~/macports
sudo cp -R /opt/local ~/macports
sudo chown -R $USER:staff ~/macports
- if: ${{ steps.dep-cache.outputs.cache-hit == 'true' }}
name: Restore dependencies from cache
run: |
sudo cp -R ~/macports/local /opt
- name: Configure Vanilla Conquer
run: |
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
cmake --preset clang-vanilla-${{ matrix.networking }}-tests -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
- name: Build Vanilla Conquer
run: |
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
cmake --build build
dsymutil build/vanillatd.app/Contents/MacOS/vanillatd -o build/vanillatd.dSYM
dsymutil build/vanillara.app/Contents/MacOS/vanillara -o build/vanillara.dSYM
dsymutil build/vanillamix -o build/vanillamix.dSYM
strip -Sx build/vanillatd.app/Contents/MacOS/vanillatd
strip -Sx build/vanillara.app/Contents/MacOS/vanillara
strip -Sx build/vanillamix
dylibbundler --create-dir --bundle-deps --overwrite-files --dest-dir ./build/vanillatd.app/Contents/libs --fix-file build/vanillatd.app/Contents/MacOS/vanillatd
dylibbundler --create-dir --bundle-deps --overwrite-files --dest-dir ./build/vanillara.app/Contents/libs --fix-file build/vanillara.app/Contents/MacOS/vanillara
- name: Create archives
if: ${{ matrix.networking == 'net' }}
run: |
mkdir artifact
7z a artifact/vanilla-conquer-macos-clang-universal2-${{ steps.gitinfo.outputs.sha_short }}.zip ./build/vanillatd.app ./build/vanillara.app ./build/vanillamix
7z a artifact/vanilla-conquer-macos-clang-universal2-${{ steps.gitinfo.outputs.sha_short }}-debug.zip ./build/vanillatd.dSYM ./build/vanillara.dSYM ./build/vanillamix.dSYM
- name: Upload artifact
if: ${{ matrix.networking == 'net' }}
uses: actions/upload-artifact@v3.1.2
with:
name: vanilla-conquer-macos-clang-universal2
path: artifact
- name: Upload development release
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/vanilla' && matrix.networking == 'net' }}
uses: softprops/action-gh-release@v1
with:
name: Development Build
tag_name: "latest"
prerelease: true
files: |
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload tagged release
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.networking == 'net' }}
uses: softprops/action-gh-release@v1
with:
files: |
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}