mirror of
https://github.com/rt64/rt64.git
synced 2024-11-19 14:14:37 +00:00
cb631739b0
* chore(ci): Run workflow with clang on windows * fix compilation issue
75 lines
2.9 KiB
YAML
75 lines
2.9 KiB
YAML
name: validate
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
type: [ Debug, Release ]
|
|
os: [ ubuntu-latest, windows-latest]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
- name: ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
key: ${{ runner.os }}-rt64-ccache-${{ matrix.type }}
|
|
- name: Install Windows Dependencies
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
choco install ninja
|
|
Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue
|
|
- name: Install Linux Dependencies
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y ninja-build libsdl2-dev libgtk-3-dev
|
|
|
|
# Install SDL2
|
|
echo ::group::install SDL2
|
|
|
|
# Enable ccache
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
|
|
wget https://www.libsdl.org/release/SDL2-2.26.1.tar.gz
|
|
tar -xzf SDL2-2.26.1.tar.gz
|
|
cd SDL2-2.26.1
|
|
./configure
|
|
make -j 10
|
|
sudo make install
|
|
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
|
|
echo ::endgroup::
|
|
- name: Configure Developer Command Prompt
|
|
if: runner.os == 'Windows'
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
- name: Build RT64 (Unix)
|
|
if: runner.os != 'Windows'
|
|
run: |-
|
|
# enable ccache
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
|
cmake --build cmake-build --config ${{ matrix.type }} --target rt64 -j $(nproc)
|
|
- name: Build RT64 (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |-
|
|
# enable ccache
|
|
set $env:PATH="$env:USERPROFILE/.cargo/bin;$env:PATH"
|
|
$cpuCores = (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors
|
|
|
|
# remove LLVM from PATH so it doesn't overshadow the one provided by VS
|
|
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' }) -join ';'
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build
|
|
cmake --build cmake-build --config ${{ matrix.type }} --target rt64 -j $cpuCores
|