-
Notifications
You must be signed in to change notification settings - Fork 52
101 lines (97 loc) · 3.73 KB
/
pinmame32.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
name: pinmame32
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 }}
sha7: ${{ steps.version.outputs.sha7 }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
run: |
VERSION_MAJOR=$(grep -Eo "VERSION_MAJOR\s+[0-9]+" src/version.h | grep -Eo "[0-9]+")
VERSION_MINOR=$(grep -Eo "VERSION_MINOR\s+[0-9]+" src/version.h | grep -Eo "[0-9]+")
VERSION_REV=$(grep -Eo "VERSION_REV\s+[0-9]+" src/version.h | grep -Eo "[0-9]+")
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REV}"
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 "sha7=${SHA7}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
build:
name: Build PinMAME32${{ matrix.artifact-suffix }}-${{ matrix.platform }}
runs-on: windows-latest
needs: [ version ]
strategy:
fail-fast: false
matrix:
include:
- platform: win-x64
platform-name: x64
- platform: win-x64
platform-name: x64
artifact-suffix: -sc
extra-flags: -D CMAKE_CXX_FLAGS=//DSAM_INCLUDE_COLORED
- platform: win-x64
platform-name: x64
artifact-suffix: -md
extra-flags: -D CMAKE_CXX_FLAGS=//DMAME_DEBUG
- platform: win-x86
platform-name: Win32
- platform: win-x86
platform-name: Win32
artifact-suffix: -sc
extra-flags: -D CMAKE_CXX_FLAGS=//DSAM_INCLUDE_COLORED
- platform: win-x86
platform-name: Win32
artifact-suffix: -md
extra-flags: -D CMAKE_CXX_FLAGS=//DMAME_DEBUG
steps:
- uses: actions/checkout@v4
- uses: ilammy/setup-nasm@v1
# - run: |
# 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
- run: |
perl -i -pe"s/0/${{ needs.version.outputs.revision }}/g" src/git_version.h
perl -i -pe"s/unknown/${{ needs.version.outputs.sha7 }}/g" src/git_version.h
curl -L https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-win64.zip -o upx.zip
7z e upx.zip -oupx
rm upx.zip
- name: Build PinMAME32${{ matrix.artifact-suffix }}-${{ matrix.platform }}
run: |
cp cmake/pinmame32/CMakeLists_${{ matrix.platform }}.txt CMakeLists.txt
cmake ${{ matrix.extra-flags }} -G "Visual Studio 17 2022" -A ${{ matrix.platform-name }} -B build
cmake --build build --config Release
./upx/upx.exe --best --lzma build/Release/PinMAME32.exe
- run: |
mkdir tmp
cp build/Release/PinMAME32.exe tmp
cp release/gamelist.txt tmp
cp release/license.txt tmp
cp release/pinmame.txt tmp
cp release/whatsnew.txt tmp
- uses: actions/upload-artifact@v4
with:
name: PinMAME32${{ matrix.artifact-suffix }}-${{ needs.version.outputs.tag }}-${{ matrix.platform }}
path: tmp