ci: use custom action to checkout LFS and cache results #211
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FIXME windows doesn't have tmate support | |
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- 'feature/**' | |
- 'bugfix/**' | |
env: | |
vulkan_sdk_version: '1.3.250.1' | |
vulkan_sdk_modules: 'Vulkan-Headers Vulkan-Loader SPIRV-Tools Glslang' | |
cmake_install_path: 'dist' | |
itch_io_project_url: 'xryp/neptune' | |
jobs: | |
build_ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "GCC Shared", | |
cmake_build_shared_libs: ON, | |
} | |
- { | |
name: "GCC Static", | |
cmake_build_shared_libs: OFF, | |
} | |
cmake_build_type: [Debug, Release] | |
name: "Ubuntu ${{ matrix.config.name }} ${{ matrix.cmake_build_type }}" | |
steps: | |
- name: Checkout | |
uses: nschloe/action-cached-lfs-checkout@v1 | |
with: | |
submodules: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get update # Always do this step to prevent package urls to get outdated | |
sudo apt-get install -y build-essential cmake gcc libunwind-dev libx11-xcb-dev libxcb-xkb-dev libasound2-dev | |
- name: Prepare Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
vulkan-query-version: ${{ env.vulkan_sdk_version }} | |
vulkan-components: ${{ env.vulkan_sdk_modules }} | |
vulkan-use-cache: true | |
# FIXME Enable bullet physics | |
- name: Configure CMake | |
run: | | |
cmake -H. -Bbuild \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.cmake_install_path }} \ | |
-DBUILD_SHARED_LIBS=${{ matrix.config.cmake_build_shared_libs }} \ | |
-DREAPER_BUILD_WARNINGS_AS_ERRORS=ON \ | |
-DREAPER_GIT_HOOKS_AUTO_UPDATE=OFF \ | |
-DREAPER_RUN_CLANG_TIDY=OFF \ | |
-DREAPER_HEADLESS=ON \ | |
-DREAPER_USE_TRACY=OFF \ | |
-DREAPER_USE_BULLET_PHYSICS=OFF | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
run: ctest --test-dir build --output-on-failure | |
- name: Install | |
if: ${{ matrix.cmake_build_type == 'Release' && matrix.config.cmake_build_shared_libs == 'OFF' }} | |
run: | | |
cmake --build build --target install | |
tar -cvf linux_build.tar ${{ env.cmake_install_path }} | |
- uses: actions/upload-artifact@v3 | |
if: ${{ matrix.cmake_build_type == 'Release' && matrix.config.cmake_build_shared_libs == 'OFF' }} | |
with: | |
name: linux_build | |
path: linux_build.tar | |
- name: Setup tmate session | |
if: ${{ failure() }} | |
uses: mxschmitt/action-tmate@v3 | |
timeout-minutes: 10 | |
build_windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "MSVC Static", | |
cmake_generator: "Visual Studio 17 2022", | |
cmake_build_shared_libs: OFF, | |
} | |
cmake_arch: [x64] | |
cmake_build_type: [Release] | |
name: "Windows ${{ matrix.config.name }} ${{ matrix.cmake_arch }} ${{ matrix.cmake_build_type }}" | |
steps: | |
- name: Checkout | |
uses: nschloe/action-cached-lfs-checkout@v1 | |
with: | |
submodules: true | |
- name: Prepare Vulkan SDK | |
uses: humbletim/[email protected] | |
with: | |
vulkan-query-version: ${{ env.vulkan_sdk_version }} | |
vulkan-components: ${{ env.vulkan_sdk_modules }} | |
vulkan-use-cache: true | |
# FIXME Enable bullet physics | |
- name: Configure CMake | |
run: | | |
cmake .\ -Bbuild ` | |
-G "${{ matrix.config.cmake_generator }}" ` | |
-A "${{ matrix.cmake_arch }}" ` | |
-DCMAKE_INSTALL_PREFIX=${{ env.cmake_install_path }} ` | |
-DBUILD_SHARED_LIBS=${{ matrix.config.cmake_build_shared_libs }} ` | |
-DREAPER_BUILD_WARNINGS_AS_ERRORS=ON ` | |
-DREAPER_GIT_HOOKS_AUTO_UPDATE=OFF ` | |
-DREAPER_RUN_CLANG_TIDY=OFF ` | |
-DREAPER_HEADLESS=ON ` | |
-DREAPER_USE_TRACY=OFF ` | |
-DREAPER_USE_BULLET_PHYSICS=OFF | |
- name: Build | |
run: cmake --build build --config ${{ matrix.cmake_build_type }} | |
- name: Test | |
run: ctest --test-dir build -C ${{ matrix.cmake_build_type }} --output-on-failure | |
- name: Install | |
run: | | |
cmake --build build --config ${{ matrix.cmake_build_type }} --target install | |
tar -cvf windows_build.tar ${{ env.cmake_install_path }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: windows_build | |
path: windows_build.tar | |
deploy_on_itch_io: | |
runs-on: ubuntu-latest | |
needs: | |
- build_ubuntu | |
- build_windows | |
name: "Deploy to itch.io" | |
steps: | |
- uses: actions/download-artifact@v3 | |
- name: Unpack artifacts | |
run: | | |
pushd linux_build && tar -xvf linux_build.tar && popd | |
pushd windows_build && tar -xvf windows_build.tar && popd | |
- name: Deploy | |
env: | |
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} | |
run: | | |
curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default | |
unzip butler.zip | |
chmod +x butler | |
./butler -V | |
./butler push --if-changed linux_build/dist ${{ env.itch_io_project_url }}:linux-latest | |
./butler push --if-changed windows_build/dist ${{ env.itch_io_project_url }}:windows-latest |