Skip to content

Update ci.yml

Update ci.yml #49

Workflow file for this run

name: "CI"
on: [ push ]
jobs:
macos:
runs-on: macos-latest
if: contains(github.event.head_commit.message, '[skip-ci]') == false
strategy:
fail-fast: false
matrix:
CPP_VERSION: [ 20 ]
env:
VCPKG_ROOT: ${{github.workspace}}/vcpkg
VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/vcpkg/bincache
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install system dependencies
run: |
brew install cmake
brew install ninja
- name: Restore assets
id: restore-assets
uses: actions/cache@v3
with:
path: "assets"
key: centurion-macos-download-assets-${{hashFiles('scripts/download_assets.py')}}
- name: Download assets
working-directory: ./scripts
if: steps.restore-assets.outputs.cache-hit != 'true'
run: python download_assets.py
- name: Restore Vcpkg artifacts
id: restore-vcpkg-artifacts
uses: actions/cache@v3
with:
path: |
${{env.VCPKG_ROOT}}
!${{env.VCPKG_ROOT}}/buildtrees
!${{env.VCPKG_ROOT}}/packages
!${{env.VCPKG_ROOT}}/downloads
!${{env.VCPKG_ROOT}}/installed
key: centurion-macos-vcpkg-${{hashFiles('vcpkg.json')}}
- name: Install Vcpkg
if: steps.restore-vcpkg-artifacts.outputs.cache-hit != 'true'
run: |
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
sudo ./vcpkg/vcpkg integrate install
mkdir ${{env.VCPKG_DEFAULT_BINARY_CACHE}}
- name: Generate build files
run: |
mkdir build && cd build
cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=${{matrix.CPP_VERSION}} \
-DCEN_USE_SYSTEM_SDL=OFF \
-DCEN_USE_SDL_IMAGE=ON \
-DCEN_USE_SDL_MIXER=ON \
-DCEN_USE_SDL_TTF=ON \
-DCEN_BUILD_UNIT_TESTS=ON \
-DCEN_BUILD_DEMO_TESTS=ON \
-DCEN_WARNINGS_AS_ERRORS=OFF
- name: Compile
run: ninja -C build
- name: Install
run: ninja install -C build
- name: Run unit tests
working-directory: ./build/test/unit
run: ./centurion-unit-tests
ubuntu:
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[skip-ci]') == false
strategy:
fail-fast: false
matrix:
CPP_VERSION: [ 20 ]
env:
VCPKG_ROOT: ${{github.workspace}}/vcpkg
VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/vcpkg/bincache
SDL_VIDEODRIVER: x11
DISPLAY: :99.0
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install system dependencies
run: |
sudo apt install cmake \
ninja-build \
xvfb \
gnome-desktop-testing \
libasound2-dev \
libpulse-dev \
libaudio-dev \
libjack-dev \
libsndio-dev \
libsamplerate0-dev \
libx11-dev \
libxext-dev \
libxrandr-dev \
libxcursor-dev \
libxfixes-dev \
libxi-dev \
libxss-dev \
libwayland-dev \
libxkbcommon-dev \
libdrm-dev \
libgbm-dev \
libgl1-mesa-dev \
libgles2-mesa-dev \
libegl1-mesa-dev \
libdbus-1-dev \
libibus-1.0-dev \
libudev-dev \
fcitx-libs-dev \
libpipewire-0.3-dev \
libdecor-0-dev \
libfreetype-dev \
fonts-dejavu-core \
libharfbuzz-dev
- name: Restore assets
id: restore-assets
uses: actions/cache@v3
with:
path: "assets"
key: centurion-ubuntu-download-assets-${{hashFiles('scripts/download_assets.py')}}
- name: Download assets
working-directory: ./scripts
if: steps.restore-assets.outputs.cache-hit != 'true'
run: python download_assets.py
- name: Restore Vcpkg
id: restore-vcpkg-artifacts
uses: actions/cache@v3
with:
path: |
${{env.VCPKG_ROOT}}
!${{env.VCPKG_ROOT}}/buildtrees
!${{env.VCPKG_ROOT}}/packages
!${{env.VCPKG_ROOT}}/downloads
!${{env.VCPKG_ROOT}}/installed
key: centurion-ubuntu-vcpkg-${{hashFiles('vcpkg.json')}}
- name: Install Vcpkg
if: steps.restore-vcpkg-artifacts.outputs.cache-hit != 'true'
run: |
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh -disableMetrics
sudo ./vcpkg/vcpkg integrate install
mkdir ${{env.VCPKG_DEFAULT_BINARY_CACHE}}
- name: Emulate video device
run: |
/sbin/start-stop-daemon --start \
--pidfile /tmp/custom_xvfb_99.pid \
--make-pidfile \
--background \
--exec /usr/bin/Xvfb -- :99 -screen 0 800x600x24 -ac +extension GLX;
sleep 3
- name: Generate build files
run: |
mkdir build
cd build
cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=${{matrix.CPP_VERSION}} \
-DCEN_USE_SYSTEM_SDL=OFF \
-DCEN_USE_SDL_IMAGE=ON \
-DCEN_USE_SDL_MIXER=ON \
-DCEN_USE_SDL_TTF=ON \
-DCEN_BUILD_UNIT_TESTS=ON \
-DCEN_BUILD_DEMO_TESTS=ON \
-DCEN_WARNINGS_AS_ERRORS=OFF
- name: Compile
run: ninja -C build
- name: Install
run: ninja install -C build
- name: Run unit tests
working-directory: ./build/test/unit
run: ./centurion-unit-tests
windows:
runs-on: windows-latest
if: contains(github.event.head_commit.message, '[skip-ci]') == false
env:
VCPKG_ROOT: ${{github.workspace}}/vcpkg
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ilammy/[email protected]
- uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.1
- name: Restore assets
id: restore-assets
uses: actions/cache@v3
with:
path: "assets"
key: centurion-windows-download-assets-${{hashFiles('scripts/download_assets.py')}}
- name: Download assets
working-directory: ./scripts
if: steps.restore-assets.outputs.cache-hit != 'true'
run: python download_assets.py
- name: Restore Vcpkg
id: restore-vcpkg-artifacts
uses: actions/cache@v3
with:
path: |
${{env.VCPKG_ROOT}}
!${{env.VCPKG_ROOT}}\buildtrees
!${{env.VCPKG_ROOT}}\packages
!${{env.VCPKG_ROOT}}\downloads
!${{env.VCPKG_ROOT}}\installed
key: centurion-windows-vcpkg-${{hashFiles('vcpkg.json')}}
- name: Install Vcpkg
if: steps.restore-vcpkg-artifacts.outputs.cache-hit != 'true'
run: |
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
.\vcpkg\vcpkg integrate install
- name: Generate build files
run: |
mkdir build
cd build
cmake .. -GNinja `
-DCMAKE_BUILD_TYPE=Debug `
-DCMAKE_CXX_STANDARD=${{matrix.CPP_VERSION}} `
-DCEN_USE_SYSTEM_SDL=OFF `
-DCEN_USE_SDL_IMAGE=ON `
-DCEN_USE_SDL_MIXER=ON `
-DCEN_USE_SDL_TTF=ON `
-DCEN_BUILD_UNIT_TESTS=ON `
-DCEN_BUILD_DEMO_TESTS=ON `
-DCEN_WARNINGS_AS_ERRORS=OFF
- name: Compile
run: ninja -C build
- name: Install
run: ninja install -C build