0.3a-dd90d0e #38
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: Build Packages | |
on: | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
- 'Assets/**' | |
- 'Config/**' | |
- 'Docs/**' | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
include: | |
- os: windows-latest | |
makefile: Makefile.Win32 | |
outfile_ext: .exe | |
shell: msys2 {0} | |
archive: zip | |
- os: ubuntu-latest | |
makefile: Makefile.UNIX | |
shell: bash | |
archive: tgz | |
- os: macos-latest | |
makefile: Makefile.OSX | |
shell: bash | |
archive: tgz | |
archive_files: Frameworks/ | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: ${{ matrix.shell }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Install ubuntu build dependencies | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt update | |
sudo apt install -y libsdl2-dev libsdl2-net-dev | |
- name: Install macos build dependencies | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
curl -sLo SDL2.dmg https://github.com/libsdl-org/SDL/releases/download/release-2.30.2/SDL2-2.30.2.dmg | |
curl -sLo SDL2_net.dmg https://github.com/libsdl-org/SDL_net/releases/download/release-2.2.0/SDL2_net-2.2.0.dmg | |
hdiutil attach -quiet SDL2.dmg | |
hdiutil attach -quiet SDL2_net.dmg | |
mkdir Frameworks | |
cp -r /Volumes/SDL2/SDL2.framework Frameworks/ | |
cp -r /Volumes/SDL2_net/SDL2_net.framework Frameworks/ | |
xattr -dr com.apple.quarantine Frameworks/SDL2.framework | |
xattr -dr com.apple.quarantine Frameworks/SDL2_net.framework | |
hdiutil detach -quiet /Volumes/SDL2 | |
hdiutil detach -quiet /Volumes/SDL2_net | |
- name: Install windows build dependencies | |
if: startsWith(matrix.os, 'windows') | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: >- | |
make | |
zip | |
git | |
mingw64/mingw-w64-x86_64-gcc | |
mingw64/mingw-w64-x86_64-SDL2 | |
mingw64/mingw-w64-x86_64-SDL2_net | |
- name: Build | |
run: make -f Makefiles/${{ matrix.makefile }} release NET_BOARD=1 OUTFILE=../supermodel${{ matrix.outfile_ext }} | |
- name: Validate | |
run: ./supermodel${{ matrix.outfile_ext }} -print-games | |
- name: Create Distributions | |
id: vars | |
run: | | |
ShortSHA=$(git rev-parse --short ${{ github.sha }}) | |
echo "COMMIT_SHORT_SHA=$ShortSHA" >> $GITHUB_ENV | |
- name: Package | |
run: | | |
mkdir NVRAM Saves ROMs GraphicsAnalysis | |
cp Docs/LICENSE.txt Docs/README.txt Docs/FORKINFO.txt . | |
echo "NVRAM files go here." > NVRAM/DIR.txt | |
echo "Save states go here." > Saves/DIR.txt | |
echo "Graphics Analysis go here." > GraphicsAnalysis/DIR.txt | |
echo "Recommended (but not mandatory) location for ROM sets." > ROMs/DIR.txt | |
FILES="supermodel${{ matrix.outfile_ext }} LICENSE.txt README.txt FORKINFO.txt Config/ Assets/ NVRAM/ Saves/ ROMs/ GraphicsAnalysis/ ${{ matrix.archive_files }}" | |
if [[ "${{ matrix.archive }}" == "tgz" ]] ; then | |
tar -zcvf supermodel-${{ env.COMMIT_SHORT_SHA }}.tgz $FILES | |
elif [[ "${{ matrix.archive }}" == "zip" ]] ; then | |
zip -r supermodel-${{ env.COMMIT_SHORT_SHA }}.zip $FILES | |
fi | |
- uses: actions/upload-artifact@master | |
with: | |
name: supermodel-${{ runner.os }}-${{ runner.arch }} | |
path: supermodel-${{ env.COMMIT_SHORT_SHA }}.${{ matrix.archive }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@master | |
- name: Retrieve hash | |
id: vars | |
run: | | |
ShortSHA=$(git rev-parse --short ${{ github.sha }}) | |
echo "COMMIT_SHORT_SHA=$ShortSHA" >> $GITHUB_ENV | |
- name: Download Linux Artifact | |
uses: actions/download-artifact@master | |
with: | |
name: supermodel-Linux-X64 | |
path: artifacts | |
- name: Rename | |
run: mv artifacts/supermodel-${{ env.COMMIT_SHORT_SHA }}.tgz artifacts/supermodel-Linux-${{ github.event.head_commit.message }}.tgz | |
- name: Download Mac Artifact | |
uses: actions/download-artifact@master | |
with: | |
name: supermodel-macOS-ARM64 | |
path: artifacts | |
- name: Rename | |
run: mv artifacts/supermodel-${{ env.COMMIT_SHORT_SHA }}.tgz artifacts/supermodel-macOS-${{ github.event.head_commit.message }}.tgz | |
- name: Download Windows Artifact | |
uses: actions/download-artifact@master | |
with: | |
name: supermodel-Windows-X64 | |
path: artifacts | |
- name: Rename | |
run: mv artifacts/supermodel-${{ env.COMMIT_SHORT_SHA }}.zip artifacts/supermodel-Windows-${{ github.event.head_commit.message }}.zip | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.COMMIT_SHORT_SHA }} | |
name: ${{ github.event.head_commit.message }}-dbx | |
draft: false | |
prerelease: false | |
files: artifacts/* |