Add data exchange through a global shared state block #1399
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: libpinmame | |
on: | |
push: | |
pull_request: | |
env: | |
VERSION_START_SHA: 79345956d1807e3188f0e895379466c7c4caae72 | |
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 libpinmame-${{ matrix.platform }}-${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
needs: [ version ] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: windows-latest, platform: win, arch: x64 } | |
- { os: windows-latest, platform: win, arch: x86 } | |
- { os: windows-latest, platform: win, arch: arm64 } | |
- { os: macos-latest, platform: macos, arch: x64 } | |
- { os: macos-latest, platform: macos, arch: arm64 } | |
- { os: ubuntu-latest, platform: linux, arch: x64 } | |
- { os: ubuntu-24.04-arm, platform: linux, arch: aarch64 } | |
- { os: ubuntu-latest, platform: android, arch: arm64-v8a } | |
- { os: macos-latest, platform: ios, arch: arm64 } | |
- { os: macos-latest, platform: ios-simulator, arch: arm64 } | |
- { os: macos-latest, platform: tvos, arch: arm64 } | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build libpinmame-${{ matrix.platform }}-${{ matrix.arch }} | |
run: | | |
cp cmake/libpinmame/CMakeLists.txt . | |
if [[ "${{ matrix.platform }}" == "win" ]]; then | |
if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
cmake -G "Visual Studio 17 2022" -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | |
elif [[ "${{ matrix.arch }}" == "x86" ]]; then | |
cmake -G "Visual Studio 17 2022" -A Win32 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
cmake -G "Visual Studio 17 2022" -A ARM64 -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | |
fi | |
cmake --build build --config Release | |
else | |
if [[ "$(uname)" == "Darwin" ]]; then | |
NUM_PROCS=$(sysctl -n hw.ncpu) | |
else | |
NUM_PROCS=$(nproc) | |
fi | |
cmake -DCMAKE_BUILD_TYPE=Release -DPLATFORM=${{ matrix.platform }} -DARCH=${{ matrix.arch }} -B build | |
cmake --build build -- -j${NUM_PROCS} | |
fi | |
- name: Prepare artifacts | |
id: artifacts | |
run: | | |
mkdir tmp | |
if [[ "${{ matrix.platform }}" == "win" ]]; then | |
ARTIFACT_PATH="tmp" | |
if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
cp build/Release/*64.lib tmp | |
cp build/Release/*64.dll tmp | |
else | |
cp build/Release/*.lib tmp | |
cp build/Release/*.dll tmp | |
fi | |
cp build/Release/pinmame_static.lib tmp | |
cp build/Release/pinmame_test_s.exe tmp | |
cp build/Release/pinmame_test.exe tmp | |
else | |
ARTIFACT_PATH="libpinmame-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" | |
if [[ "${{ matrix.platform }}" == "macos" ]]; then | |
cp build/libpinmame.a tmp | |
cp -a build/*.dylib tmp | |
cp build/pinmame_test_s tmp | |
cp build/pinmame_test tmp | |
elif [[ "${{ matrix.platform }}" == "linux" ]]; then | |
cp build/libpinmame.a tmp | |
cp -a build/*.{so,so.*} tmp | |
cp build/pinmame_test_s tmp | |
cp build/pinmame_test tmp | |
elif [[ "${{ matrix.platform }}" == "ios" || "${{ matrix.platform }}" == "ios-simulator" || "${{ matrix.platform }}" == "tvos" ]]; then | |
cp build/libpinmame.a tmp | |
cp -a build/*.dylib tmp | |
elif [[ "${{ matrix.platform }}" == "android" ]]; then | |
cp build/libpinmame.a tmp | |
cp build/libpinmame.so tmp | |
fi | |
cp release/gamelist.txt tmp | |
cp release/license.txt tmp | |
cp release/pinmame.txt tmp | |
cp release/whatsnew.txt tmp | |
cd tmp | |
tar -czvf ../${ARTIFACT_PATH} * | |
fi | |
echo "artifact_path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libpinmame-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }} | |
path: ${{ steps.artifacts.outputs.artifact_path }} | |
post-build: | |
runs-on: macos-latest | |
needs: [ version, build ] | |
name: Build libpinmame-macos | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Unpack artifacts | |
run: | | |
cd libpinmame-${{ needs.version.outputs.tag }}-macos-x64 | |
tar -xzvf libpinmame-${{ needs.version.outputs.tag }}-macos-x64.tar.gz | |
cd .. | |
cd libpinmame-${{ needs.version.outputs.tag }}-macos-arm64 | |
tar -xzvf libpinmame-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz | |
- name: Combine macos architectures | |
run: | | |
mkdir tmp | |
find "libpinmame-${{ needs.version.outputs.tag }}-macos-arm64" -name "*.dylib" | while read -r file; do | |
if [ -L "$file" ]; then | |
cp -a "$file" "tmp/" | |
elif [ -f "$file" ]; then | |
filename=$(basename "$file") | |
lipo -create -output "tmp/$filename" \ | |
"libpinmame-${{ needs.version.outputs.tag }}-macos-arm64/$filename" \ | |
"libpinmame-${{ needs.version.outputs.tag }}-macos-x64/$filename" | |
fi | |
done | |
for filename in pinmame_test_s pinmame_test; do | |
lipo -create -output "tmp/$filename" \ | |
"libpinmame-${{ needs.version.outputs.tag }}-macos-arm64/$filename" \ | |
"libpinmame-${{ needs.version.outputs.tag }}-macos-x64/$filename" | |
done | |
- name: Prepare artifacts | |
run: | | |
cd tmp | |
tar -czvf ../libpinmame-${{ needs.version.outputs.tag }}-macos.tar.gz * | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libpinmame-${{ needs.version.outputs.tag }}-macos | |
path: libpinmame-${{ needs.version.outputs.tag }}-macos.tar.gz |