Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/actions/setup-ninja/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Setup ninja'
description: 'Download ninja and add it to the PATH environment variable'
inputs:
version:
description: 'Ninja version'
default: '1.13.1'
runs:
using: 'composite'
steps:
- name: 'Calculate variables'
id: calc
shell: sh
run: |
case "${{ runner.os }}-${{ runner.arch }}" in
"Linux-X86" | "Linux-X64")
archive="ninja-linux.zip"
;;
"Linux-ARM64")
archive="ninja-linux-aarch64.zip"
;;
"macOS-X86" | "macOS-X64" | "macOS-ARM64")
archive="ninja-mac.zip"
;;
"Windows-X86" | "Windows-X64")
archive="ninja-win.zip"
;;
"Windows-ARM64")
archive="ninja-winarm64.zip"
;;
*)
echo "Unsupported ${{ runner.os }}-${{ runner.arch }}"
exit 1;
;;
esac
echo "archive=${archive}" >> ${GITHUB_OUTPUT}
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Download ninja ${{ inputs.version }} for ${{ runner.os }} (${{ runner.arch }})'
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
shell: pwsh
run: |
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
uses: actions/cache/save@v4
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
- name: 'Extract ninja'
shell: pwsh
run: |
7z "-o${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" x "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Set output variables'
id: final
shell: pwsh
run: |
echo "${{ runner.temp }}/ninja-${{ inputs.version }}-${{ runner.arch }}" >> $env:GITHUB_PATH
75 changes: 57 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,67 @@ name: Build
on: [push, pull_request]

jobs:
Build:
desktop:
name: ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: sh
strategy:
fail-fast: false
matrix:
platform: # !!! FIXME: figure out an efficient way to get SDL2 on the Windows/Mac bots.
- { name: Linux, os: ubuntu-latest, flags: -GNinja }
- { name: MinGW, os: windows-latest, flags: -GNinja -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_SYSTEM_NAME=Windows }
- { name: Windows, os: windows-latest }
- { name: MacOS, os: macos-latest }
- { name: Linux, os: ubuntu-latest }
- { name: MinGW, os: windows-latest, flags: -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_SYSTEM_NAME=Windows }
- { name: Windows, os: windows-latest, msvc: true }
- { name: macOS, os: macos-latest }
steps:
- name: Setup Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Setup MinGW dependencies
if: contains(matrix.platform.name, 'MinGW')
run: choco install ninja
- name: Get PhysicsFS sources
uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B build ${{ matrix.platform.flags }}
- name: Build
run: cmake --build build/
uses: actions/checkout@v6
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ !!matrix.platform.msvc }}
with:
arch: x64
- name: Set up ninja
uses: ./.github/actions/setup-ninja
- name: Configure (CMake)
run: |
cmake -B build -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=prefix_cmake \
-DPHYSFS_INSTALL_MAN=ON \
-DPHYSFS_WERROR=ON \
${{ matrix.platform.flags }}
- name: Build (CMake)
run: |
cmake --build build/ --verbose
- name: Install (CMake)
run: |
set -eu
cmake --install build/
echo "PhysFS_ROOT=$(pwd)/prefix_cmake" >> $GITHUB_ENV
- name: Verify CMake configuration files
run: |
cmake -S cmake/test -B cmake_config_build \
-DCMAKE_BUILD_TYPE=Release \
-DTEST_SHARED=${{ matrix.platform.shared }} \
-DTEST_STATIC=${{ matrix.platform.static }}
cmake --build cmake_config_build --verbose
- name: 'Test versioning'
run: |
build-scripts/test-versioning.sh

os2:
name: OS/2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: open-watcom/setup-watcom@v0
- name: Build physfs.dll
run: |
cd src
wmake -sn -f Makefile.os2
- name: distclean
run: |
cd src
wmake -sn -f Makefile.os2 distclean
20 changes: 0 additions & 20 deletions .github/workflows/os2.yml

This file was deleted.

Loading