Dev #224
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
name: Build | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
VULKAN_VERSION: 1.3.261.1 | |
LLVM_VERSION: 19 | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { runner: windows-latest, os: windows, arch: x64, toolchain: msvc, runtime: MT } | |
- { runner: windows-latest, os: windows, arch: x64, toolchain: clang-cl, runtime: c++_static } | |
- { runner: ubuntu-latest, os: linux, arch: x86_64, toolchain: clang-19, runtime: c++_static } | |
- { runner: ubuntu-latest, os: linux, arch: x86_64, toolchain: gcc-14, runtime: stdc++_static } | |
mode: [ debug, release ] | |
runs-on: ${{ matrix.platform.runner }} | |
steps: | |
- name: Get current date as package key | |
id: cache_key | |
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: "Set OUTPUT_FILE variable" | |
run: echo "OUTPUT_FILE=${{ matrix.platform.os }}_${{ matrix.platform.arch }}_${{ matrix.mode }}_${{ matrix.platform.toolchain }}_${{ matrix.platform.runtime }}${{ matrix.platform.archive_ext }}" >> $GITHUB_ENV | |
shell: bash | |
# Force xmake to a specific folder (for cache) | |
- name: Set xmake env | |
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Linux dependencies | |
if: ${{ matrix.platform.os == 'linux' }} | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_VERSION }} main" | |
sudo add-apt-repository -y "deb-src http://apt.llvm.org/noble/ llvm-toolchain-noble-${{ env.LLVM_VERSION }} main" | |
sudo apt update -y | |
sudo apt install -y clang-${{ env.LLVM_VERSION }} lld-${{ env.LLVM_VERSION }} llvm-${{ env.LLVM_VERSION }} libllvm${{ env.LLVM_VERSION }} llvm-${{ env.LLVM_VERSION }}-runtime libclang-common-${{ env.LLVM_VERSION }}-dev libclang-${{ env.LLVM_VERSION }}-dev libclang1-${{ env.LLVM_VERSION }} libclang-rt-${{ env.LLVM_VERSION }}-dev libc++-${{ env.LLVM_VERSION }}-dev libc++abi-${{ env.LLVM_VERSION }}-dev libunwind-${{ env.LLVM_VERSION }}-dev libllvmlibc-${{ env.LLVM_VERSION }}-dev | |
sudo apt install libx11-dev libxext-dev libxrandr-dev libxrender-dev libxfixes-dev libxi-dev libxinerama-dev libxkbcommon-dev | |
# Install xmake | |
- name: Setup xmake | |
uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: branch@dev | |
actions-cache-folder: .xmake-cache-W${{ steps.cache_key.outputs.key }} | |
# Update xmake repository (in order to have the file that will be cached) | |
- name: Update xmake repository | |
run: xmake repo --update -vD | |
# Fetch xmake dephash | |
- name: Retrieve dependencies hash | |
id: dep_hash | |
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT | |
shell: bash | |
# Retrieve xmake dependencies | |
- name: Restore cached xmake dependencies | |
id: restore-depcache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | |
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.mode }}-${{ matrix.platform.runtime }}-${{ matrix.platform.toolchain }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }} | |
- name: Configure xmake and install dependencies | |
run: xmake config -vD --toolchain=${{ matrix.platform.toolchain }} --arch=${{ matrix.platform.arch }} --mode=${{ matrix.mode }} --runtimes=${{ matrix.platform.runtime }} --yes --policies=package.precompiled:n | |
# Save dependencies | |
- name: Save cached xmake dependencies | |
if: ${{ !steps.restore-depcache.outputs.cache-hit }} | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages | |
key: ${{ steps.restore-depcache.outputs.cache-primary-key }} | |
- name: Build all targets | |
run: xmake build -vD -a | |
- name: Install | |
run: xmake install -vDo dest/ | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.mode }}-${{ matrix.platform.toolchain }}-${{ matrix.platform.runtime }} | |
path: | | |
dest | |