172 lines
5.2 KiB
YAML
172 lines
5.2 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ "*" ]
|
|
pull_request:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build-linux:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Pull and run inside your prebuilt Docker image for Linux
|
|
image: gitea.pockle.world/john/prosperon/linux:latest
|
|
|
|
steps:
|
|
- name: Check Out Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Cache SDL3 (Linux)
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
sdl3
|
|
sdl3-build
|
|
key: sdl3-linux-${{ hashFiles('sdl3/CMakeLists.txt') }}
|
|
|
|
- name: Build SDL3 (Linux)
|
|
run: |
|
|
if [ ! -d "sdl3/.git" ]; then
|
|
echo "Cloning SDL3 repository..."
|
|
git clone --depth 1 --branch main https://github.com/libsdl-org/SDL.git sdl3
|
|
else
|
|
echo "SDL3 source is already present (possibly from cache)."
|
|
fi
|
|
|
|
mkdir -p sdl3-build
|
|
cd sdl3-build
|
|
cmake ../sdl3 -GNinja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX="${PWD}/installed_sdl3" \
|
|
-DSDL_SHARED=ON \
|
|
-DSDL_STATIC=OFF
|
|
ninja
|
|
ninja install
|
|
|
|
- name: Build Prosperon (Linux)
|
|
run: |
|
|
export PKG_CONFIG_PATH="${PWD}/sdl3-build/installed_sdl3/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
meson setup build_dbg -Dbuildtype=debugoptimized
|
|
meson compile -C build_dbg
|
|
|
|
- name: Create artifact folder (Linux)
|
|
run: |
|
|
mkdir _pack
|
|
cp build_dbg/prosperon _pack/
|
|
# Adjust wildcard if there's a versioned libSDL3. e.g. libSDL3-0.600.0.so
|
|
cp sdl3-build/installed_sdl3/lib/libSDL3.so _pack/
|
|
|
|
- name: Upload Artifact (Linux)
|
|
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: prosperon-artifacts-linux
|
|
path: _pack
|
|
|
|
build-windows:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Pull and run inside your prebuilt Docker image for Windows cross-compilation
|
|
image: gitea.pockle.world/john/prosperon/mingw:latest
|
|
|
|
steps:
|
|
- name: Check Out Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Cache SDL3 (Windows cross)
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
sdl3-win
|
|
sdl3-build-win
|
|
key: sdl3-win-${{ hashFiles('sdl3-win/CMakeLists.txt') }}
|
|
|
|
- name: Build SDL3 (Windows cross)
|
|
run: |
|
|
if [ ! -d "sdl3-win/.git" ]; then
|
|
echo "Cloning SDL3 for Windows cross..."
|
|
git clone --depth 1 --branch main https://github.com/libsdl-org/SDL.git sdl3-win
|
|
else
|
|
echo "SDL3-win source already present (possibly from cache)."
|
|
fi
|
|
|
|
mkdir -p sdl3-build-win
|
|
cd sdl3-build-win
|
|
cmake ../sdl3-win -GNinja \
|
|
-DCMAKE_SYSTEM_NAME=Windows \
|
|
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
|
|
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
|
|
-DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX="${PWD}/installed_sdl3_win" \
|
|
-DSDL_SHARED=ON \
|
|
-DSDL_STATIC=OFF
|
|
ninja
|
|
ninja install
|
|
|
|
- name: Configure PKG_CONFIG_PATH (Windows cross)
|
|
run: |
|
|
echo "PKG_CONFIG_PATH=${GITHUB_WORKSPACE}/sdl3-build-win/installed_sdl3_win/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
|
|
|
|
- name: Build Prosperon (Windows cross)
|
|
run: |
|
|
meson setup -Dbuildtype=debugoptimized --cross-file mingw32.cross build_win
|
|
meson compile -C build_win
|
|
|
|
- name: Create package folder
|
|
run: |
|
|
mkdir _pack
|
|
cp build_win/prosperon.exe _pack/
|
|
cp sdl3-build-win/installed_sdl3_win/bin/SDL3.dll _pack/
|
|
|
|
- name: Upload Artifact (Windows cross)
|
|
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: prosperon-artifacts-windows
|
|
path: _pack
|
|
|
|
package-dist:
|
|
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
|
|
needs: [build-linux, build-windows]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check Out Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Linux Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: prosperon-artifacts-linux
|
|
path: linux_artifacts
|
|
|
|
- name: Download Windows Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: prosperon-artifacts-windows
|
|
path: windows_artifacts
|
|
|
|
- name: Create the Dist Folder
|
|
run: |
|
|
mkdir dist
|
|
|
|
cp README.md dist/
|
|
cp license.txt dist/
|
|
cp -r examples dist/
|
|
|
|
# Make subdirectories for each platform
|
|
mkdir dist/linux
|
|
mkdir dist/win
|
|
|
|
# Copy artifacts in
|
|
cp linux_artifacts/* dist/linux/
|
|
cp windows_artifacts/* dist/win/
|
|
|
|
- name: Upload Final Dist
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: prosperon
|
|
path: dist
|