Skip to content

CI: Enable CI packages for all branches and PRs in main and developme… #1911

CI: Enable CI packages for all branches and PRs in main and developme…

CI: Enable CI packages for all branches and PRs in main and developme… #1911

name: Continuous Integration
on:
push:
branches: ["*"]
tags-ignore: ["*"]
pull_request:
branches: ["*"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Windows:
name: ${{ matrix.config.display_name }}
runs-on: ${{ matrix.config.runner }}
strategy:
fail-fast: false
matrix:
config:
-
display_name: "Windows | x86"
runner: "windows-2025"
cmake_preset: 'ci-windows-86-dev'
build_suffix: "x86"
msvc_triplet_path: 'cmake/triplets/x86-windows.cmake'
-
display_name: "Windows | x64"
runner: "windows-2025"
cmake_preset: 'ci-windows-64-dev'
build_suffix: "x64"
msvc_triplet_path: 'cmake/triplets/x64-windows.cmake'
-
display_name: "Windows | AArch64"
runner: "windows-11-arm"
cmake_preset: 'ci-windows-arm64-dev'
build_suffix: "aarch64"
# msvc_triplet_path: '${{ VCPKG_INSTALLATION_ROOT }}/triplets/arm64-windows.cmake'
msvc_triplet_path: 'C:/vcpkg/triplets/arm64-windows.cmake'
permissions:
actions: write
defaults:
run:
shell: bash
env:
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
steps:
- name: Restore MSVC cache
if: matrix.config.build_suffix == 'x86'
id: msvc_cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/choco_cache
key: vs-${{ matrix.config.build_suffix }}
- name: Install MSVC 2019
if: matrix.config.build_suffix == 'x86'
run: |
choco config set cacheLocation "${{ github.workspace }}/choco_cache"
choco install visualstudio2019buildtools --package-parameters " \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.VisualStudio.Component.WinXP \
--add Microsoft.VisualStudio.Component.VC.v141.x86.x64"
cd "${{ github.workspace }}/choco_cache" && rm **.log **log.txt
# Delete the old cache on hit to emulate a cache update.
# The actions/cache@v4 action doesn't update cache on hit,
# and we don't have a way to add a toolset version to key before it is installed.
- name: Delete MSVC cache
if: matrix.config.build_suffix == 'x86' && steps.msvc_cache.outputs.cache-hit
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: gh cache delete --repo ${{ github.repository }} ${{ steps.msvc_cache.outputs.cache-primary-key }}
- name: Save MSVC cache
if: matrix.config.build_suffix == 'x86'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/choco_cache
key: ${{ steps.msvc_cache.outputs.cache-primary-key }}
- name: Bootstrap VCPKG
run: |
cd $VCPKG_INSTALLATION_ROOT
echo "vcpkg revision: $(git rev-parse HEAD)"
./bootstrap-vcpkg.sh -disableMetrics
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore VCPKG dependencies cache
id: vcpkg_cache
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ matrix.config.build_suffix }}-${{ hashFiles('vcpkg.json', matrix.config.msvc_triplet_path) }}
restore-keys: vcpkg-${{ matrix.config.build_suffix }}-
- name: Configure & Build & Test
id: configure
env:
CC: cl
run: |
cmake --workflow --preset "${{ matrix.config.cmake_preset }}"
git_version=$(cmake -P ./cmake/scripts/UpdateRevision.cmake "git" 2>&1)
echo "version=$git_version" >> $GITHUB_OUTPUT
# Delete the old cache on hit to emulate a cache update.
# The actions/cache@v4 action doesn't update cache on hit,
# and we don't have a way to add package versions to key before they are installed.
- name: Delete VCPKG dependencies cache
if: steps.vcpkg_cache.outputs.cache-hit
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
run: gh cache delete --repo ${{ github.repository }} ${{ steps.vcpkg_cache.outputs.cache-primary-key }}
- name: Save VCPKG dependencies cache
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: ${{ steps.vcpkg_cache.outputs.cache-primary-key }}
- name: Install
if: |
github.repository == 'Russian-Doom/russian-doom' ||
github.repository == 'Dasperal/russian-doom'
run: |
cmake --install build --config RelWithDebInfo --prefix "./build/install"
- name: Package Zip
if: |
github.repository == 'Russian-Doom/russian-doom' ||
github.repository == 'Dasperal/russian-doom'
uses: actions/upload-artifact@v4
with:
name: russian-doom-${{ steps.configure.outputs.version }}-windows-${{ matrix.config.build_suffix }}
path: ./build/install/
Linux:
name: Linux | ${{ matrix.distro.display_name }} | ${{ matrix.platform.arch }}
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
distro:
-
display_name: Debian
distro: debian
package: deb
dockerfile: '.devcontainer/Debian.dockerfile'
preset_suffix: deb
-
display_name: Fedora
distro: fedora
package: rpm
dockerfile: '.devcontainer/Fedora.dockerfile'
preset_suffix: fedora-rpm
platform:
-
runner: 'ubuntu-24.04'
arch: "x64"
-
runner: 'ubuntu-24.04-arm'
arch: "arm64"
defaults:
run:
shell: bash
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver: docker
# Invalidate cache for docker toolchain images every month to update dependencies
- name: Get build month for Docker cache
id: date
run: echo "date=$(date +'%Y%m')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Docker images
uses: AndreKurait/docker-cache@0.6.0
with:
key: docker-${{ matrix.platform.arch }}-${{ hashFiles(matrix.distro.dockerfile) }}-${{ steps.date.outputs.date }}
- name: Toolchain & Configure & Build & Test & Package
id: configure
run: |
chmod 777 .
./crosscompile_linux_packages.sh "ci-linux-dev-${{ matrix.distro.preset_suffix }}" ${{ matrix.distro.distro }}
git_version=$(cmake -P ./cmake/scripts/UpdateRevision.cmake "git" 2>&1)
echo "version=$git_version" >> $GITHUB_OUTPUT
- name: Upload package
if: |
github.repository == 'Russian-Doom/russian-doom' ||
github.repository == 'Dasperal/russian-doom'
uses: actions/upload-artifact@v4
with:
name: russian-doom-${{ steps.configure.outputs.version }}-linux-${{ matrix.distro.package }}-${{ matrix.platform.arch }}
path: ./build/*.${{ matrix.distro.package }}