mirror of
https://github.com/dingusdev/dingusppc.git
synced 2026-10-25 17:02:23 +00:00
288 lines
11 KiB
YAML
288 lines
11 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
|
BUILD_TYPE: Release
|
|
jobs:
|
|
build-linux:
|
|
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
|
# You can convert this to a matrix build if you need cross-platform coverage.
|
|
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
- name: Cache ccache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache/linux
|
|
key: linux-ccache-${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
|
restore-keys: linux-ccache-${{ runner.os }}-${{ env.BUILD_TYPE }}-
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update -y -qq
|
|
sudo apt-get install -y -qq libsdl2-dev ninja-build ccache
|
|
- name: Configure CMake
|
|
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
|
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
|
env:
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache/linux
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
run: cmake -S . -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
- name: Build
|
|
# Build your program with the given configuration
|
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
|
- name: ccache stats
|
|
run: ccache --show-stats || true
|
|
- name: Test
|
|
working-directory: ${{github.workspace}}/build
|
|
# Execute tests defined by the CMake configuration.
|
|
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
|
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
|
- name: Upload logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: logs-${{ github.job }}
|
|
path: |
|
|
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
|
if-no-files-found: ignore
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
- name: Upload artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: DingusPPC-LINUX
|
|
path: ${{github.workspace}}/build/bin
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
|
|
build-macos:
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runner: macos-latest
|
|
arch: arm64
|
|
brew_prefix: /opt/homebrew
|
|
- runner: macos-15-intel
|
|
arch: x86_64
|
|
brew_prefix: /usr/local
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
- name: Cache ccache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache/${{ matrix.arch }}
|
|
key: macos-${{ matrix.runner }}-${{ matrix.arch }}-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
|
restore-keys: macos-${{ matrix.runner }}-${{ matrix.arch }}-ccache-${{ env.BUILD_TYPE }}-
|
|
- name: Install dependencies
|
|
run: |
|
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
|
brew install sdl2 ccache ninja
|
|
- name: Configure CMake
|
|
env:
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache/${{ matrix.arch }}
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
run: |
|
|
export PATH="${{ matrix.brew_prefix }}/opt/ccache/libexec:$PATH"
|
|
cmake -S . -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
|
|
- name: Build
|
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
|
- name: ccache stats
|
|
run: ccache --show-stats || true
|
|
- name: Test
|
|
working-directory: ${{github.workspace}}/build
|
|
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
|
- name: Upload logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: logs-${{ github.job }}-${{ matrix.arch }}
|
|
path: |
|
|
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
|
if-no-files-found: ignore
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
- name: Upload artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: DingusPPC-macOS-${{ matrix.arch }}
|
|
path: ${{github.workspace}}/build/bin
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
|
|
build-windows-msys2:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 45
|
|
env:
|
|
MSYSTEM: MINGW64
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
- name: Cache ccache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache/msys
|
|
key: windows-msys-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
|
restore-keys: windows-msys-ccache-${{ env.BUILD_TYPE }}-
|
|
- name: Setup MSYS2
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: MINGW64
|
|
update: true
|
|
install: >-
|
|
cmake
|
|
ninja
|
|
git
|
|
mingw-w64-x86_64-cmake
|
|
mingw-w64-x86_64-gcc
|
|
mingw-w64-x86_64-binutils
|
|
mingw-w64-x86_64-ninja
|
|
mingw-w64-x86_64-pkgconf
|
|
mingw-w64-x86_64-SDL2
|
|
mingw-w64-x86_64-ccache
|
|
- name: Build
|
|
shell: msys2 {0}
|
|
run: |
|
|
echo "Running build at $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
|
export CHERE_INVOKING=yes
|
|
export MSYS=winsymlinks:native
|
|
export CCACHE_BASEDIR="${GITHUB_WORKSPACE}"
|
|
export CCACHE_DIR="${GITHUB_WORKSPACE}/.ccache/msys"
|
|
export CCACHE_DEPEND=1
|
|
ccache --zero-stats || true
|
|
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
|
|
ccache --show-stats || true
|
|
echo "Finished build at $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
|
- name: Test
|
|
shell: msys2 {0}
|
|
run: |
|
|
cd build
|
|
ctest --output-on-failure --parallel
|
|
- name: Upload logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: logs-${{ github.job }}
|
|
path: |
|
|
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
|
if-no-files-found: ignore
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
- name: Upload artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: DingusPPC-MSYS
|
|
path: ${{github.workspace}}/build/bin
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
|
|
build-windows-vsbuild:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 45
|
|
env:
|
|
VCPKG_FEATURE_FLAGS: binarycaching
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: clang
|
|
generator: Ninja
|
|
cmake_args: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
|
|
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
upload_suffix: CLANG
|
|
- name: msvc
|
|
generator: Ninja
|
|
cmake_args: ""
|
|
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
upload_suffix: MSVC
|
|
- name: msbuild
|
|
generator: Ninja
|
|
cmake_args: -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
|
|
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
upload_suffix: MSBUILD
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: recursive
|
|
- name: Setup msbuild
|
|
uses: microsoft/setup-msbuild@v3
|
|
- name: Install vcpkg packages
|
|
shell: cmd
|
|
run: '"%VCPKG_INSTALLATION_ROOT%\vcpkg.exe" install --triplet x64-windows'
|
|
- name: Install Ninja
|
|
if: matrix.generator == 'Ninja'
|
|
run: choco install ninja -y
|
|
- name: Cache ccache
|
|
if: matrix.generator == 'Ninja'
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache/vsbuild-${{ matrix.name }}
|
|
key: vsbuild-${{ matrix.name }}-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
|
restore-keys: vsbuild-${{ matrix.name }}-ccache-${{ env.BUILD_TYPE }}-
|
|
- name: Install ccache
|
|
if: matrix.generator == 'Ninja'
|
|
run: choco install ccache -y
|
|
- name: Configure & Build
|
|
shell: cmd
|
|
env:
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache/vsbuild-${{ matrix.name }}
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
run: |
|
|
mkdir build
|
|
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
|
cd build
|
|
cmake -S .. -B . -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON ${{ matrix.ccache_args }} -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake
|
|
cmake --build . --config ${{ env.BUILD_TYPE }} --parallel
|
|
cd ..
|
|
- name: ccache stats
|
|
if: matrix.generator == 'Ninja'
|
|
shell: cmd
|
|
run: |
|
|
ccache --show-stats
|
|
if %errorlevel% neq 0 echo ccache stats unavailable
|
|
- name: Test
|
|
working-directory: ${{github.workspace}}/build
|
|
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
|
- name: Upload logs on failure
|
|
if: failure()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: logs-${{ github.job }}-${{ matrix.name }}
|
|
path: |
|
|
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
|
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
|
if-no-files-found: ignore
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
|
- name: Upload artifact
|
|
if: always()
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: DingusPPC-${{ matrix.upload_suffix }}
|
|
path: ${{github.workspace}}/build/bin
|
|
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|