-
Notifications
You must be signed in to change notification settings - Fork 52
168 lines (162 loc) · 6.5 KB
/
libpinmame.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
name: libpinmame
on:
push:
pull_request:
env:
VERSION_START_SHA: e87be0e3cfa66411976ca04a72dd29e36c483966
UPX_ARTIFACT: 345209471
defaults:
run:
shell: bash
jobs:
version:
name: Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
revision: ${{ steps.version.outputs.revision }}
sha: ${{ steps.version.outputs.sha }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: version
run: |
VERSION=$(grep -Eo "[0-9\.]+" src/version.c | head -1)
REVISION=$(git rev-list ${{ env.VERSION_START_SHA }}..HEAD --count)
SHA="${GITHUB_SHA}"
SHA7="${SHA::7}"
TAG="${VERSION}-${REVISION}-${SHA7}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "revision=${REVISION}" >> $GITHUB_OUTPUT
echo "sha=${SHA}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
name: Build libpinmame-${{ matrix.platform }}
runs-on: ${{ matrix.os }}
needs: [ version ]
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: win-x64
platform-name: x64
libpinmame: libpinmame-${{ needs.version.outputs.version }}.dll
pinmame-test: pinmame_test.exe
- os: windows-latest
platform: win-x86
platform-name: Win32
libpinmame: libpinmame-${{ needs.version.outputs.version }}.dll
pinmame-test: pinmame_test.exe
- os: windows-latest
platform: win-arm64
platform-name: ARM64
libpinmame: libpinmame-${{ needs.version.outputs.version }}.dll
pinmame-test: pinmame_test.exe
- os: macos-latest
platform: osx-x64
libpinmame: libpinmame.${{ needs.version.outputs.version }}.dylib
pinmame-test: pinmame_test
- os: macos-latest
platform: osx-arm64
libpinmame: libpinmame.${{ needs.version.outputs.version }}.dylib
pinmame-test: pinmame_test
- os: macos-latest
platform: ios-arm64
libpinmame: libpinmame.${{ needs.version.outputs.version }}.a
- os: macos-latest
platform: tvos-arm64
libpinmame: libpinmame.${{ needs.version.outputs.version }}.a
- os: ubuntu-latest
platform: linux-x64
libpinmame: libpinmame.so.${{ needs.version.outputs.version }}
pinmame-test: pinmame_test
- os: ubuntu-latest
platform: android-arm64-v8a
libpinmame: libpinmame.${{ needs.version.outputs.version }}.so
steps:
- uses: actions/checkout@v3
# - run: |
# if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
# curl -sL -H "Authorization: Token ${{ secrets.GH_PAT }}" https://api.github.com/repos/upx/upx/actions/artifacts/${{ env.UPX_ARTIFACT }}/zip -o upx.zip
# 7z x upx.zip -oupx
# rm upx.zip
# fi
- run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
curl -L https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-win64.zip -o upx.zip
7z e upx.zip -oupx
rm upx.zip
fi
- name: Build libpinmame-${{ matrix.platform }}
run: |
cp cmake/libpinmame/CMakeLists_${{ matrix.platform }}.txt CMakeLists.txt
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
cmake -G "Visual Studio 17 2022" -A ${{ matrix.platform-name }} -B build
cmake --build build --config Release
if [[ "${{ matrix.platform }}" != "win-arm64" ]]; then
./upx/upx.exe --best --lzma build/Release/${{ matrix.libpinmame }}
fi
else
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release
cmake --build build/Release
if [[ "${{ matrix.platform }}" == "linux-x64" ]]; then
upx --best --lzma build/Release/${{ matrix.libpinmame }}
fi
fi
- run: |
mkdir tmp
cp build/Release/${{ matrix.libpinmame }} tmp
if [[ "${{ matrix.platform }}" == "ios-arm64" ]]; then
cp build/Release/zlib-prefix/src/zlib-build/libz.a tmp
fi
if [[ "${{ matrix.platform }}" == "tvos-arm64" ]]; then
cp build/Release/zlib-prefix/src/zlib-build/libz.a tmp
fi
if [[ "${{ matrix.pinmame-test }}" ]]; then
cp build/Release/${{ matrix.pinmame-test }} tmp
fi
cp release/gamelist.txt tmp
cp release/license.txt tmp
cp release/pinmame.txt tmp
cp release/whatsnew.txt tmp
- uses: actions/upload-artifact@v3
with:
name: libpinmame-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp
post-build:
runs-on: macos-latest
needs: [ version, build ]
name: Build libpinmame-osx
steps:
- uses: actions/download-artifact@v3
- run: |
mkdir tmp
cp libpinmame-${{ needs.version.outputs.tag }}-osx-x64/license.txt tmp
lipo -create -output tmp/libpinmame.${{ needs.version.outputs.version }}.dylib \
libpinmame-${{ needs.version.outputs.tag }}-osx-x64/libpinmame.${{ needs.version.outputs.version }}.dylib \
libpinmame-${{ needs.version.outputs.tag }}-osx-arm64/libpinmame.${{ needs.version.outputs.version }}.dylib
lipo -create -output tmp/pinmame_test \
libpinmame-${{ needs.version.outputs.tag }}-osx-x64/pinmame_test \
libpinmame-${{ needs.version.outputs.tag }}-osx-arm64/pinmame_test
- uses: actions/upload-artifact@v3
with:
name: libpinmame-${{ needs.version.outputs.tag }}-osx
path: tmp
dispatch:
runs-on: ubuntu-latest
needs: [ version, post-build ]
if: github.repository == 'vpinball/pinmame' && github.ref == 'refs/heads/master' && github.event_name == 'push'
steps:
- uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_PAT }}
repository: vpinball/pinmame-dotnet
event-type: update-libpinmame
client-payload: '{ "run_id": "${{ github.run_id }}",
"version": "${{ needs.version.outputs.version }}",
"revision": "${{ needs.version.outputs.revision }}",
"sha": "${{ needs.version.outputs.sha }}",
"tag": "${{ needs.version.outputs.tag }}" }'