mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
517 lines
15 KiB
YAML
517 lines
15 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
static-analysis:
|
|
name: Static analysis
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Install
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install cppcheck
|
|
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: cppcheck
|
|
run: cppcheck --std=c++17 src/
|
|
|
|
code-format:
|
|
name: Code format check
|
|
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Show clang-format version
|
|
run: |
|
|
clang-format --version
|
|
|
|
- name: clang-format
|
|
run: |
|
|
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
|
|
echo "Showing PR labels..."
|
|
gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels
|
|
echo "Checking labels on PR..."
|
|
if gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels --jq '.labels[].name' | grep -q "skip-formatting"; then
|
|
echo "skip-formatting label found - do not raise error"
|
|
echo "==============================="
|
|
find src -type f \( -name \*.cc -o -name \*.h \) | xargs clang-format --dry-run
|
|
exit 0
|
|
fi
|
|
echo "skip-formatting label not found - raise error if formatting is not correct"
|
|
else
|
|
echo "Not a PR, do not check labels"
|
|
fi
|
|
|
|
find src -type f \( -name \*.cc -o -name \*.h \) | xargs clang-format --dry-run --Werror
|
|
|
|
echo "Code is formatted correctly"
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
android:
|
|
name: Android
|
|
|
|
runs-on: ubuntu-latest
|
|
needs: [ce-dat]
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: temurin
|
|
java-version: 11
|
|
cache: gradle
|
|
|
|
- name: Cache cmake build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: os/android/app/.cxx
|
|
key: android-cmake-v101
|
|
|
|
- name: Setup signing config
|
|
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
|
|
run: |
|
|
cd os/android
|
|
echo "$KEYSTORE_FILE_BASE64" | base64 --decode > debug.keystore
|
|
echo "$KEYSTORE_PROPERTIES_FILE_BASE64" | base64 --decode > debug-keystore.properties
|
|
env:
|
|
KEYSTORE_FILE_BASE64: ${{ secrets.ANDROID_DEBUG_KEYSTORE_FILE_BASE64 }}
|
|
KEYSTORE_PROPERTIES_FILE_BASE64: ${{ secrets.ANDROID_DEBUG_KEYSTORE_PROPERTIES_FILE_BASE64 }}
|
|
|
|
- name: Build
|
|
run: |
|
|
cd os/android
|
|
./gradlew assembleDebug
|
|
|
|
- name: Download ce.dat
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ce-dat
|
|
path: out/dist
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p out/dist/fallout2-ce-android-debug
|
|
cp os/android/app/build/outputs/apk/debug/app-debug.apk out/dist/fallout2-ce-android-debug/fallout2-ce.apk
|
|
cp out/dist/ce.dat out/dist/fallout2-ce-android-debug/ce.dat
|
|
cd out/dist
|
|
zip -r fallout2-ce-android-debug.zip fallout2-ce-android-debug
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-android-debug
|
|
path: out/dist/fallout2-ce-android-debug.zip
|
|
retention-days: 7
|
|
|
|
ce-dat:
|
|
name: Build ce.dat
|
|
uses: ./.github/workflows/reusable-build-ce-dat.yml
|
|
with:
|
|
preset: linux-x64-debug
|
|
|
|
ios:
|
|
name: iOS
|
|
|
|
runs-on: macos-14
|
|
needs: [ce-dat]
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache cmake build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: out
|
|
key: ios-cmake-v101
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake --preset ios
|
|
|
|
- name: Build
|
|
run: |
|
|
cmake --build --preset ios-debug
|
|
|
|
- name: Pack
|
|
run: |
|
|
cd out/build/ios
|
|
cpack -C Debug
|
|
|
|
- name: Download ce.dat
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ce-dat
|
|
path: out/dist
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p out/dist/fallout2-ce-ios
|
|
cp out/build/ios/fallout2-ce.ipa out/dist/fallout2-ce-ios/fallout2-ce-ios.ipa
|
|
cp out/dist/ce.dat out/dist/fallout2-ce-ios/ce.dat
|
|
cd out/dist
|
|
zip -r fallout2-ce-ios.zip fallout2-ce-ios
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-ios
|
|
path: out/dist/fallout2-ce-ios.zip
|
|
retention-days: 7
|
|
|
|
linux:
|
|
name: Linux (${{ matrix.arch }})
|
|
|
|
runs-on: ubuntu-22.04
|
|
needs: [ce-dat]
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- x86
|
|
- x64
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Dependencies (x86)
|
|
if: matrix.arch == 'x86'
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt update
|
|
sudo apt install g++-multilib libsdl2-dev:i386 zlib1g-dev:i386
|
|
|
|
- name: Dependencies (x64)
|
|
if: matrix.arch == 'x64'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install libsdl2-dev zlib1g-dev
|
|
|
|
- name: Cache cmake build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: out
|
|
key: linux-${{ matrix.arch }}-cmake-v101
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake --preset linux-${{ matrix.arch }}-debug
|
|
|
|
- name: Build
|
|
run: |
|
|
cmake --build --preset linux-${{ matrix.arch }}-debug
|
|
|
|
- name: Download ce.dat
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ce-dat
|
|
path: out/dist
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p out/dist/fallout2-ce-linux-${{ matrix.arch }}
|
|
cp out/build/linux-${{ matrix.arch }}-debug/fallout2-ce out/dist/fallout2-ce-linux-${{ matrix.arch }}/fallout2-ce
|
|
cp out/dist/ce.dat out/dist/fallout2-ce-linux-${{ matrix.arch }}/ce.dat
|
|
tar -czvf out/dist/fallout2-ce-linux-${{ matrix.arch }}.tar.gz -C out/dist fallout2-ce-linux-${{ matrix.arch }}
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-linux-${{ matrix.arch }}
|
|
path: out/dist/fallout2-ce-linux-${{ matrix.arch }}.tar.gz
|
|
retention-days: 7
|
|
|
|
linux-armhf:
|
|
name: Linux (armhf)
|
|
|
|
runs-on: ubuntu-22.04-arm
|
|
needs: [ce-dat]
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Dependencies
|
|
run: |
|
|
sudo dpkg --add-architecture armhf
|
|
sudo apt update
|
|
sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libsdl2-dev:armhf zlib1g-dev:armhf
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake \
|
|
-B build \
|
|
-D CMAKE_BUILD_TYPE=Debug \
|
|
-D FALLOUT_VENDORED=OFF \
|
|
-D CMAKE_SYSTEM_PROCESSOR=arm \
|
|
-D CMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
|
|
-D CMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
|
|
# EOL
|
|
|
|
- name: Build
|
|
run: cmake --build build
|
|
|
|
- name: Download ce.dat
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ce-dat
|
|
path: out/dist
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p out/dist/fallout2-ce-linux-armhf
|
|
cp build/fallout2-ce out/dist/fallout2-ce-linux-armhf/fallout2-ce
|
|
cp out/dist/ce.dat out/dist/fallout2-ce-linux-armhf/ce.dat
|
|
tar -czvf out/dist/fallout2-ce-linux-armhf.tar.gz -C out/dist fallout2-ce-linux-armhf
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-linux-armhf
|
|
path: out/dist/fallout2-ce-linux-armhf.tar.gz
|
|
retention-days: 7
|
|
|
|
linux-arm64:
|
|
name: Linux (arm64)
|
|
|
|
runs-on: ubuntu-22.04-arm
|
|
needs: [ce-dat]
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install libsdl2-dev zlib1g-dev
|
|
|
|
- name: Configure
|
|
run: cmake -B build -D CMAKE_BUILD_TYPE=Debug -D FALLOUT_VENDORED=OFF
|
|
|
|
- name: Build
|
|
run: cmake --build build
|
|
|
|
- name: Download ce.dat
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ce-dat
|
|
path: out/dist
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p out/dist/fallout2-ce-linux-arm64
|
|
cp build/fallout2-ce out/dist/fallout2-ce-linux-arm64/fallout2-ce
|
|
cp out/dist/ce.dat out/dist/fallout2-ce-linux-arm64/ce.dat
|
|
tar -czvf out/dist/fallout2-ce-linux-arm64.tar.gz -C out/dist fallout2-ce-linux-arm64
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-linux-arm64
|
|
path: out/dist/fallout2-ce-linux-arm64.tar.gz
|
|
retention-days: 7
|
|
|
|
macos:
|
|
name: macOS
|
|
|
|
runs-on: macos-14
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache cmake build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: out
|
|
key: macos-cmake-v101
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake --preset macos
|
|
|
|
- name: Build
|
|
run: |
|
|
cmake --build --preset macos-debug
|
|
|
|
- name: Pack
|
|
run: |
|
|
cd out/build/macos
|
|
cpack -C Debug
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-macos
|
|
path: out/build/macos/Fallout II Community Edition.dmg
|
|
retention-days: 7
|
|
|
|
windows:
|
|
name: Windows (${{ matrix.arch }})
|
|
|
|
runs-on: windows-2025
|
|
needs: [ce-dat]
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- arch: x86
|
|
- arch: x64
|
|
|
|
steps:
|
|
- name: Clone
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Visual Studio 2022 Build Tools with v141_xp
|
|
shell: cmd
|
|
run: |
|
|
choco install visualstudio2022buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
|
|
|
|
- name: Cache cmake build
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: out
|
|
key: windows-${{ matrix.arch }}-cmake-v103
|
|
|
|
- name: Configure
|
|
shell: cmd
|
|
run: |
|
|
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.v141.x86.x64 Microsoft.VisualStudio.Component.VC.v141.xp -property installationPath`) do set "VS_PATH=%%i"
|
|
call "%VS_PATH%\Common7\Tools\VsDevCmd.bat" ^
|
|
&& cmake --preset windows-${{ matrix.arch }}
|
|
|
|
- name: Build
|
|
shell: cmd
|
|
run: |
|
|
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.v141.x86.x64 Microsoft.VisualStudio.Component.VC.v141.xp -property installationPath`) do set "VS_PATH=%%i"
|
|
call "%VS_PATH%\Common7\Tools\VsDevCmd.bat" ^
|
|
&& cmake --build --preset windows-${{ matrix.arch }}-release
|
|
|
|
- name: Download ce.dat
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ce-dat
|
|
path: out/dist
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p out/dist/fallout2-ce-windows-${{ matrix.arch }}
|
|
cp out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce.exe out/dist/fallout2-ce-windows-${{ matrix.arch }}/fallout2-ce.exe
|
|
cp out/dist/ce.dat out/dist/fallout2-ce-windows-${{ matrix.arch }}/ce.dat
|
|
cd out/dist
|
|
7z a fallout2-ce-windows-${{ matrix.arch }}.zip fallout2-ce-windows-${{ matrix.arch }}
|
|
|
|
- name: Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: fallout2-ce-windows-${{ matrix.arch }}
|
|
path: out/dist/fallout2-ce-windows-${{ matrix.arch }}.zip
|
|
retention-days: 7
|
|
|
|
|
|
release:
|
|
name: Release Continuous build
|
|
runs-on: ubuntu-latest
|
|
needs: [android, ios, linux, linux-armhf, linux-arm64, macos, windows]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Fetch artifacts
|
|
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
uses: actions/download-artifact@v4.1.7
|
|
with:
|
|
path: artifacts/
|
|
|
|
- name: Remove old release
|
|
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
|
with:
|
|
delete_release: true
|
|
tag_name: continious
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Move unpacked artifacts to root folder
|
|
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
run: |
|
|
rm -rf artifacts/ce-dat
|
|
ls -Rlah .
|
|
find .
|
|
cd artifacts/
|
|
for folder in *; do
|
|
if [[ -d "$folder" && "$folder" != "." ]]; then
|
|
echo "Processing $folder"
|
|
mv "$folder" "$folder.dir"
|
|
cd "$folder.dir"
|
|
for file in *; do
|
|
if [ -f "$file" ]; then
|
|
if [ -f "../$file" ]; then
|
|
echo "ERROR: Duplicate artifact file name $file"
|
|
exit 1
|
|
fi
|
|
if [ -d "../$file" ]; then
|
|
echo "ERROR: Duplicate artifact folder $file"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Moving $file"
|
|
mv "$file" "../$file"
|
|
fi
|
|
done
|
|
cd ..
|
|
rm -rf "$folder.dir"
|
|
fi
|
|
done
|
|
ls -Rlah .
|
|
find .
|
|
cd ../
|
|
|
|
- name: Allow GitHub to process removed release for few seconds
|
|
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
run: |
|
|
sleep 20s
|
|
|
|
- name: Upload new release
|
|
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
uses: softprops/action-gh-release@v0.1.15
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
files: artifacts/*
|
|
tag_name: continious
|
|
draft: false
|
|
prerelease: true
|
|
name: Fallout2-CE Continuous Build
|