-
Notifications
You must be signed in to change notification settings - Fork 52
150 lines (146 loc) · 5.51 KB
/
ppuc.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
name: ppuc
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: PPUC ${{ matrix.platform }} ${{ matrix.base_image }}
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
ppuc: ppuc.exe
type: pc
- os: macos-latest
platform: osx-x64
libpinmame: libpinmame.${{ needs.version.outputs.version }}.dylib
ppuc: ppuc
type: pc
- os: ubuntu-latest
platform: linux-x64
libpinmame: libpinmame.so.${{ needs.version.outputs.version }}
ppuc: ppuc
type: pc
- os: ubuntu-latest
platform: linux-arm64
libpinmame: libpinmame.so.${{ needs.version.outputs.version }}
ppuc: ppuc
type: pc
- os: ubuntu-latest
platform: linux-arm64
ppuc: ppuc
target: zero2_64
cpu: cortex-a53
cpu_info: raspberrypi_zero2_w_arm64
base_image: raspios_lite_arm64:latest
type: raspi
steps:
- uses: actions/checkout@v3
- if: matrix.os == 'ubuntu-latest' && matrix.type != 'raspi'
run: |
sudo apt-get update
sudo apt-get install cmake zlib1g-dev libopenal-dev libyaml-cpp-dev libusb-1.0-0-dev
- if: matrix.os == 'macos-latest'
run: |
brew install openal-soft libusb yaml-cpp
- if: matrix.os == 'windows-latest'
uses: lukka/[email protected]
with:
vcpkgArguments: yaml-cpp openal-soft libusb
vcpkgTriplet: ${{ matrix.platform-name }}-windows
vcpkgDirectory: deps/vcpkg
vcpkgGitCommitId: ce99c947b64ea3c0e274e18cc3035ca727681089
# - if: matrix.os == 'windows-latest'
# 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
- if: matrix.os == 'windows-latest'
run: |
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
- if: matrix.type == 'pc'
name: Build ppuc-${{ matrix.platform }}
run: |
cp cmake/ppuc/CMakeLists_${{ matrix.platform }}.txt CMakeLists.txt
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
cmake -G "Visual Studio 17 2022" -A ${{ matrix.platform-name }} -DCMAKE_TOOLCHAIN_FILE=./deps/vcpkg/scripts/buildsystems/vcpkg.cmake -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
- if: matrix.type == 'pc'
run: |
mkdir tmp
cp build/Release/${{ matrix.ppuc }} tmp
cp src/ppuc/README.md tmp
cp src/ppuc/LICENSE tmp
- if: matrix.type == 'raspi'
uses: pguyot/arm-runner-action@v2
id: arm_runner_make
with:
base_image: ${{ matrix.base_image }}
optimize_image: yes
image_additional_mb: 1024
cpu: ${{ matrix.cpu }}
cpu_info: cpuinfo/${{ matrix.cpu_info }}
copy_repository_path: /opt/pinmame
copy_artifact_path: tmp
commands: |
apt-get update -y --allow-releaseinfo-change
apt-get install --no-install-recommends -y libasound2-dev libsdl2.dev libsdl2-mixer-dev libi2c-dev
apt-get install --no-install-recommends -y cmake zlib1g-dev libopenal-dev libyaml-cpp-dev libusb-1.0-0-dev
cp cmake/ppuc/CMakeLists_linux-arm64.txt CMakeLists.txt
cmake -DCMAKE_BUILD_TYPE=Release -B build/Release
cmake --build build/Release
mkdir tmp
cp build/Release/${{ matrix.ppuc }} tmp
cp src/ppuc/README.md tmp
cp src/ppuc/LICENSE tmp
- uses: actions/upload-artifact@v3
with:
name: ppuc-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.type }}
path: tmp