using containers
All checks were successful
Build / build-linux (push) Successful in 1m2s
Build / build-windows (push) Successful in 1m4s
Build / package-dist (push) Has been skipped

This commit is contained in:
2025-02-17 08:27:01 -06:00
parent 8ced43c389
commit 7bafa906cc
5 changed files with 116 additions and 90 deletions

39
.github/docker/Dockerfile.alpine vendored Normal file
View File

@@ -0,0 +1,39 @@
# Dockerfile.alpine
FROM alpine:edge
# Enable the edge and edge/community repositories.
# If you already have those in your base image, you might not need these echo lines.
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
# Update indexes and install packages
RUN apk update && \
apk add --no-cache \
# Basic dev tools
build-base \
binutils \
mold \
meson \
cmake \
ninja \
git \
pkgconf \
ccache \
# Node.js + npm
nodejs \
npm \
# Misc
zip \
# Audio/Video dev libs
alsa-lib-dev \
pulseaudio-dev \
libudev-zero-dev \
# Wayland dev libs
wayland-dev \
wayland-protocols \
mesa-dev \
# Finally, the new SDL3 dev package on Alpine edge
sdl3
# (Optional) If you want a default working directory:
WORKDIR /workspace

31
.github/docker/Dockerfile.linux vendored Normal file
View File

@@ -0,0 +1,31 @@
# Dockerfile.linux
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libasound2-dev \
libpulse-dev \
libudev-dev \
libwayland-dev \
wayland-protocols \
libxkbcommon-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxss-dev \
libegl1-mesa-dev \
libgl1-mesa-dev \
cmake \
ninja-build \
git \
build-essential \
binutils \
mold \
meson \
pkg-config \
npm nodejs zip \
ccache && \
rm -rf /var/lib/apt/lists/*

17
.github/docker/Dockerfile.mingw vendored Normal file
View File

@@ -0,0 +1,17 @@
# Dockerfile.windows-cross
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
mingw-w64 \
cmake \
ninja-build \
git \
build-essential \
binutils \
pkg-config \
meson \
zip \
npm nodejs \
ccache && \
rm -rf /var/lib/apt/lists/*

View File

@@ -2,54 +2,35 @@ name: Build
on:
push:
branches: [ "master" ]
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: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libasound2-dev libpulse-dev libudev-dev \
libwayland-dev wayland-protocols libxkbcommon-dev \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev \
libxi-dev libxinerama-dev libxss-dev \
libegl1-mesa-dev libgl1-mesa-dev \
cmake ninja-build git build-essential binutils mold meson pkg-config \
ccache
- name: Configure ccache
run: |
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
- name: Cache ccache
uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-linux-${{ hashFiles('**/*.c', '**/*.cpp', '**/*.h', '**/CMakeLists.txt', '**/meson.build') }}
restore-keys: |
ccache-linux-
- name: Cache SDL3 (Linux)
uses: actions/cache@v3
with:
path: |
sdl3
sdl3-build
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 release-3.2.4 https://github.com/libsdl-org/SDL.git sdl3
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
@@ -62,12 +43,12 @@ jobs:
-DSDL_SHARED=ON \
-DSDL_STATIC=OFF
ninja
ninja install
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=release -Db_lto=true -Db_ndebug=true
meson setup build_dbg -Dbuildtype=debugoptimized
meson compile -C build_dbg
- name: Create artifact folder (Linux)
@@ -75,9 +56,10 @@ jobs:
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/
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
@@ -85,43 +67,27 @@ jobs:
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: Install Dependencies (Windows Cross)
run: |
sudo apt-get update
sudo apt-get install -y \
mingw-w64 cmake ninja-build git build-essential \
binutils pkg-config meson ccache
- name: Configure ccache
run: |
echo "CMAKE_C_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER_LAUNCHER=ccache" >> $GITHUB_ENV
- name: Cache ccache
uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-win-${{ hashFiles('**/*.c', '**/*.cpp', '**/*.h', '**/CMakeLists.txt', '**/meson.build') }}
restore-keys: |
ccache-win-
- name: Cache SDL3 (Windows cross)
uses: actions/cache@v3
with:
path: |
sdl3-win
sdl3-build-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 release-3.2.4 https://github.com/libsdl-org/SDL.git sdl3-win
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
@@ -139,36 +105,37 @@ jobs:
-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
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=release -Db_lto=true -Db_ndebug=true --cross-file mingw32.cross build_win
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/
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 repository
- name: Check Out Code
uses: actions/checkout@v3
- name: Download Linux Artifacts
uses: actions/download-artifact@v3
with:
@@ -193,14 +160,12 @@ jobs:
mkdir dist/linux
mkdir dist/win
# -------------------
# Copy artifacts in
# -------------------
cp linux_artifacts/* dist/linux/
cp windows_artifacts/* dist/win/
cp windows_artifacts/* dist/win/
- name: Upload Final Dist
uses: actions/upload-artifact@v3
with:
name: prosperon
path: dist
path: dist

View File

@@ -1,26 +0,0 @@
name: CI
on:
push:
branches: [ "master" ]
pull_request:
jobs:
# Example #1: Build Linux, run tests, but don't package
build-test-linux:
uses: ./.github/workflows/build.yml
with:
platform: linux
run-tests: false
package-dist: false
# Example #2: Build Windows, no tests, but package artifacts
build-package-windows:
uses: ./.github/workflows/build.yml
with:
platform: windows
run-tests: false
package-dist: false
# You can add more calls here for different combos of
# (run-tests, package-dist), or do matrix expansions, etc.