Skip to content

Commit

Permalink
CI: Back to prebuilt SDL dll
Browse files Browse the repository at this point in the history
  • Loading branch information
jorio committed Feb 11, 2023
1 parent 6f5ffce commit 9cfde20
Show file tree
Hide file tree
Showing 11 changed files with 456 additions and 196 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/metarelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Meta Release Big 3

on: [workflow_dispatch]

jobs:
appimage-x86_64:
uses: ./.github/workflows/release-appimage-x86_64.yml
mac:
uses: ./.github/workflows/release-mac.yml
secrets: inherit
windows:
uses: ./.github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: Make Release Builds (linux/aarch64)
name: Release AppImage aarch64

on: [workflow_dispatch]
on: [workflow_dispatch, workflow_call]

env:
SDL2_VERSION: "2.26.3"
APPIMAGETOOL_VERSION: "13"
GAME_SHORTNAME: "CandyCrisis"
GAME_LONGNAME: "Candy Crisis"

jobs:
build-linux-appimage-aarch64:
release-appimage-aarch64:
runs-on: ubuntu-20.04
timeout-minutes: 100 # this job may take up to an hour

Expand All @@ -27,6 +33,10 @@ jobs:
chmod +x runtime-aarch64
popd
- name: Get SDL source
run: |
git clone --depth 1 --branch release-${{env.SDL2_VERSION}} https://github.com/libsdl-org/SDL
- uses: uraimo/run-on-arch-action@v2
name: Build game via QEMU
id: buildgame
Expand Down Expand Up @@ -56,29 +66,31 @@ jobs:
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
# Build the aarch64 version under dist/, then tar it up and move it to /artifacts.
# Build the aarch64 version under dist/, then tar it up and move the tarball to /artifacts.
# (We're not building directly in /artifacts as this would cause permission issues when moving back to the x86_64 host)
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
#cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo #----- for quick testing
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SDL_FROM_SOURCE=1 -DSTATIC_SDL=1
cmake --build build
bash packaging/prepare_appimage_appdir.sh build/CandyCrisis
bash packaging/prepare_appimage_appdir.sh build/${{env.GAME_SHORTNAME}}
cd build
tar cvf /artifacts/aarch64-dist.tar ./*.AppDir
tar cvf /artifacts/aarch64-dist.tar ./*.AppDir ./version.txt
# QEMU can't run appimagetool-aarch64, so we have to build the AppImage on x86_64
- name: Create AppImage on x86_64 host
run: |
cd artifacts
tar xvf aarch64-dist.tar
APPIMAGE_INPUT=$(ls -d --indicator-style=none *.AppDir)
APPIMAGE_OUTPUT=${APPIMAGE_INPUT%.AppDir}.AppImage
echo "APPIMAGE_OUTPUT=$APPIMAGE_OUTPUT" >> $GITHUB_ENV
GAME_VERSION=$(cat version.txt)
ARTIFACT_NAME="${{env.GAME_SHORTNAME}}-$GAME_VERSION-linux-aarch64.AppImage"
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
./appimagetool-x86_64.AppImage -v --runtime-file runtime-aarch64 --no-appstream $APPIMAGE_INPUT $APPIMAGE_OUTPUT
APPIMAGE_INPUT=$(ls -d --indicator-style=none *.AppDir)
./appimagetool-x86_64.AppImage -v --runtime-file runtime-aarch64 --no-appstream $APPIMAGE_INPUT $ARTIFACT_NAME
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.APPIMAGE_OUTPUT }}
path: artifacts/${{ env.APPIMAGE_OUTPUT }}
name: ${{ env.ARTIFACT_NAME }}
path: artifacts/${{ env.ARTIFACT_NAME }}
68 changes: 68 additions & 0 deletions .github/workflows/release-appimage-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release AppImage x86_64

on: [workflow_dispatch, workflow_call]

env:
SDL2_VERSION: "2.26.3"
APPIMAGETOOL_VERSION: "13"
GAME_SHORTNAME: "CandyCrisis"
GAME_LONGNAME: "Candy Crisis"

jobs:
release-appimage-x86_64:
runs-on: ubuntu-20.04 # Use oldest distro still supported by GitHub to cover the oldest possible glibc
timeout-minutes: 20

steps:
- name: Get CPU count
run: |
NPROC=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo CPU count = $NPROC
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

# cf. https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md
- name: Get build dependencies for SDL from APT
run: |
sudo apt update
sudo apt install -y libasound2-dev libpulse-dev \
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
- name: Get SDL source
run: |
git clone --depth 1 --branch release-${{ env.SDL2_VERSION }} https://github.com/libsdl-org/SDL
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SDL_FROM_SOURCE=1 -DSTATIC_SDL=1

- name: Prepare artifact names
run: |
GAME_VERSION=$(cat build/version.txt)
ARTIFACT_NAME="${{env.GAME_SHORTNAME}}-$GAME_VERSION-linux-x86_64.AppImage"
echo "GAME_VERSION=$GAME_VERSION" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
- name: Build
run: cmake --build build -- -j ${{ env.NPROC }}

- name: Prepare AppDir
run: bash packaging/prepare_appimage_appdir.sh build/${{env.GAME_SHORTNAME}}

- name: Make AppImage
run: |
wget https://github.com/AppImage/AppImageKit/releases/download/${{env.APPIMAGETOOL_VERSION}}/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage --no-appstream build/${{env.GAME_SHORTNAME}}.AppDir build/${{env.ARTIFACT_NAME}}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME}}
path: build/${{env.ARTIFACT_NAME}}
78 changes: 78 additions & 0 deletions .github/workflows/release-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release Mac

on: [workflow_dispatch, workflow_call]

env:
SDL2_VERSION: "2.26.3"
GAME_SHORTNAME: "CandyCrisis"
GAME_LONGNAME: "Candy Crisis"

jobs:
release-mac:
runs-on: macos-11
timeout-minutes: 20

steps:
- name: Get CPU count
run: |
NPROC=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo CPU count = $NPROC
- name: Import codesigning certs
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}

- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Get SDL2.framework
run: |
curl -LO https://github.com/libsdl-org/SDL/releases/download/release-${{env.SDL2_VERSION}}/SDL2-${{env.SDL2_VERSION}}.dmg
hdiutil attach SDL2-*.dmg
cp -a /Volumes/SDL2/SDL2.framework SDL2.framework
hdiutil detach /Volumes/SDL2
- name: Configure
run: cmake -S . -B build -G Xcode -DCODE_SIGN_IDENTITY=${{ secrets.APPLE_CODE_SIGN_IDENTITY }}

- name: Prepare artifact names
run: |
GAME_VERSION=$(cat build/version.txt)
FOLDER_NAME="${{env.GAME_LONGNAME}} $GAME_VERSION"
ARTIFACT_NAME="${{env.GAME_SHORTNAME}}-$GAME_VERSION-mac.dmg"
echo "GAME_VERSION=$GAME_VERSION" >> $GITHUB_ENV
echo "FOLDER_NAME=$FOLDER_NAME" >> $GITHUB_ENV
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
- name: Build
run: cmake --build build --config RelWithDebInfo -- -j ${{ env.NPROC }}

#- name: Force codesigning (not necessary since we tell Xcode to do it for us)
# run: codesign --force --sign ${{ secrets.APPLE_DEVELOPMENT_TEAM }} --options runtime "build/RelWithDebInfo/${{env.GAME_LONGNAME}}.app"

- name: Check codesigning
run: codesign -vvv --deep --strict "build/RelWithDebInfo/${{env.GAME_LONGNAME}}.app"

- name: Create dmg
run: |
cp build/ReadMe.txt build/RelWithDebInfo
hdiutil create -fs HFS+ -srcfolder build/RelWithDebInfo -volname "${{env.FOLDER_NAME}}" build/${{env.ARTIFACT_NAME}}
- name: Notarize
run: |
xcrun notarytool store-credentials GameNotarizationProfile --apple-id ${{ secrets.APPLE_NOTARIZATION_USERNAME }} --password ${{ secrets.APPLE_NOTARIZATION_PASSWORD }} --team-id ${{ secrets.APPLE_DEVELOPMENT_TEAM }}
xcrun notarytool submit build/${{env.ARTIFACT_NAME}} --keychain-profile GameNotarizationProfile --wait
- name: Staple
run: xcrun stapler staple build/${{env.ARTIFACT_NAME}}

- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME}}
path: build/${{env.ARTIFACT_NAME}}
58 changes: 58 additions & 0 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release Windows

on: [workflow_dispatch, workflow_call]

env:
SDL2_VERSION: "2.26.3"
GAME_SHORTNAME: "CandyCrisis"
GAME_LONGNAME: "Candy Crisis"

jobs:
release-windows:
runs-on: windows-2022
timeout-minutes: 20

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Get SDL
run: |
Invoke-WebRequest -OutFile SDL2-VC.zip -Uri https://github.com/libsdl-org/SDL/releases/download/release-${{env.SDL2_VERSION}}/SDL2-devel-${{env.SDL2_VERSION}}-VC.zip
Expand-Archive SDL2-VC.zip
move SDL2-VC/SDL2-* SDL2
- name: Configure
run: cmake -S . -B build -G 'Visual Studio 17 2022'

- name: Prepare artifact names
run: |
$GAME_VERSION = Get-Content build/version.txt
$FOLDER_NAME = "${{env.GAME_LONGNAME}} $GAME_VERSION"
$ARTIFACT_NAME = "${{env.GAME_SHORTNAME}}-$GAME_VERSION-windows-x64.zip"
echo "GAME_VERSION=$GAME_VERSION" >> $env:GITHUB_ENV
echo "FOLDER_NAME=$FOLDER_NAME" >> $env:GITHUB_ENV
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $env:GITHUB_ENV
- name: Build
run: cmake --build build --config Release -- -m

# Note: if the game contains C++, you should also copy msvcp140.dll and vcruntime140_1.dll
- name: Copy extra stuff
run: |
cmake --install build --prefix build/install
copy build/ReadMe.txt build/Release
copy build/install/bin/vcruntime140.dll build/Release
- name: Zip it up
run: |
move build/Release "build/${{env.FOLDER_NAME}}"
Compress-Archive -Path "build/${{env.FOLDER_NAME}}" -DestinationPath build/${{env.ARTIFACT_NAME}} -CompressionLevel Optimal
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME}}
path: build/${{env.ARTIFACT_NAME}}
Loading

0 comments on commit 9cfde20

Please sign in to comment.