Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 215 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
name: Build and test

permissions:
contents: write

on:
pull_request:
push:
paths-ignore:
- '.github/workflows/coverage.yml'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'README.md'

jobs:
build:
strategy:
fail-fast: false
matrix:
confs:
- { name: Windows, runner: windows-latest, shell: bash, plat: windows, arch: x86, mode: debug, package: true, test: true, }
- { name: Windows, runner: windows-latest, shell: bash, plat: windows, arch: x86, mode: releasedbg, package: true, test: true, }
- { name: Windows, runner: windows-latest, shell: bash, plat: windows, arch: x64, mode: debug, package: true, test: true, }
- { name: Windows, runner: windows-latest, shell: bash, plat: windows, arch: x64, mode: releasedbg, package: true, test: true, }
- { name: Windows, runner: windows-latest, shell: bash, plat: windows, arch: arm64, mode: debug, package: true, test: false, }
- { name: Windows, runner: windows-latest, shell: bash, plat: windows, arch: arm64, mode: releasedbg, package: true, test: false, }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: i686, mode: debug, package: true, test: true, msystem: mingw32 }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: i686, mode: releasedbg, package: true, test: true, msystem: mingw32 }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: x86_64, mode: debug, package: true, test: true, msystem: mingw64 }
- { name: MinGW, runner: windows-latest, shell: 'msys2 {0}', plat: mingw, arch: x86_64, mode: releasedbg, package: true, test: true, msystem: mingw64 }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, package: true, test: true, }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, package: false, test: true, config: --asan=y }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, package: false, test: true, config: --lsan=y }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: debug, package: false, test: true, config: --tsan=y }
- { name: Linux, runner: ubuntu-latest, shell: bash, plat: linux, arch: x86_64, mode: releasedbg, package: true, test: true, }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: debug, package: false, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: releasedbg, package: false, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: debug, package: false, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 25c, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: releasedbg, package: false, test: false, ndk_ver: 25c, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: debug, package: true, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: armeabi-v7a, mode: releasedbg, package: true, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: debug, package: true, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: Android NDK 26b, runner: ubuntu-latest, shell: bash, plat: android, arch: arm64-v8a, mode: releasedbg, package: true, test: false, ndk_ver: 26b, ndk_sdkver: 28 }
- { name: macOS, runner: macos-latest, shell: bash, plat: macosx, arch: x86_64, mode: debug, package: true, test: true, }
- { name: macOS, runner: macos-latest, shell: bash, plat: macosx, arch: x86_64, mode: releasedbg, package: true, test: true, }
- { name: macOS, runner: macos-14, shell: bash, plat: macosx, arch: arm64, mode: debug, package: true, test: true, }
- { name: macOS, runner: macos-14, shell: bash, plat: macosx, arch: arm64, mode: releasedbg, package: true, test: true, }
- { name: iOS, runner: macos-latest, shell: bash, plat: iphoneos, arch: arm64, mode: debug, package: true, test: false, }
- { name: iOS, runner: macos-latest, shell: bash, plat: iphoneos, arch: arm64, mode: releasedbg, package: true, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm32, mode: debug, package: true, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm32, mode: releasedbg, package: true, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm64, mode: debug, package: true, test: false, }
- { name: Emscripten, runner: ubuntu-latest, shell: bash, plat: wasm, arch: wasm64, mode: releasedbg, package: true, test: false, }
kind: [shared, static]
exclude:
- confs: { name: Emscripten }
kind: shared

defaults:
run:
shell: ${{ matrix.confs.shell }}

name: ${{ matrix.confs.name }} ${{ matrix.confs.arch }} (${{ matrix.kind }} ${{ matrix.confs.mode }})
runs-on: ${{ matrix.confs.runner }}
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}

steps:
- name: Checkout repository
uses: actions/checkout@v6

# Install system dependencies
- name: Setup Linux
if: ${{ matrix.confs.plat == 'linux' }}
run: |
sudo apt-get update
sudo apt-get -y install mesa-common-dev

# Setup Emsdk
- name: Setup Emscripten
if: ${{ matrix.confs.plat == 'wasm' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: 4.0.15
actions-cache-folder: emsdk-cache-${{ matrix.confs.mode }}

# Setup MSYS2
- name: Setup MSYS2
if: ${{ matrix.confs.plat == 'mingw' }}
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.confs.msystem }}
install: base-devel git unzip p7zip mingw-w64-${{ matrix.confs.arch }}-toolchain mingw-w64-${{ matrix.confs.arch }}-xmake
update: true

# Setup NDK
- name: Setup Android NDK (${{ matrix.confs.ndk_ver }})
if: ${{ matrix.confs.plat == 'android' }}
run: |
wget -q https://dl.google.com/android/repository/android-ndk-r${{ matrix.confs.ndk_ver }}-linux.zip
unzip -q -o ./android-ndk-r${{ matrix.confs.ndk_ver }}-linux.zip
echo "ADDITIONAL_CONF=--ndk=`pwd`/android-ndk-r${{ matrix.confs.ndk_ver }} --ndk_sdkver=${{ matrix.confs.ndk_sdkver }}" >> $GITHUB_ENV

- name: Get current date as package key
id: cache_key
run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT
shell: bash

# Force xmake to a specific folder (for cache)
- name: Set xmake global dir
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV

# Install xmake
- name: Setup xmake
if: ${{ matrix.confs.plat != 'mingw' }}
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
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

# Fetch xmake dephash
- name: Retrieve dependencies hash
id: dep_hash
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT

# Restore xmake dependencies
- name: Restore cached xmake dependencies
id: restore-depcache
uses: actions/cache/restore@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ matrix.confs.plat }}-${{ matrix.confs.arch }}-${{ matrix.confs.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}

# Setup platform configs
- name: Setup platform config
run: |
PLATFORM_CONF=""
if [ "${{ matrix.confs.test }}" == "true" ]; then
PLATFORM_CONF="${PLATFORM_CONF} --tests=y" >> $GITHUB_ENV
fi
echo "ADDITIONAL_CONF=${{ env.ADDITIONAL_CONF }} $PLATFORM_CONF" >> $GITHUB_ENV
FILENAME="concerto-reflection_${{ matrix.confs.plat }}_${{ matrix.confs.arch }}_${{ matrix.kind }}"
if [ "${{ startsWith(github.event.ref, 'refs/tags/') }}" == "false" ]; then
FILENAME="${FILENAME}_${{ matrix.confs.mode }}"
fi
if [ "${{ matrix.confs.plat }}" == "windows" ]; then
FILENAME="${FILENAME}.zip"
else
FILENAME="${FILENAME}.tgz"
fi
echo "OUTPUT_FILE=$FILENAME" >> $GITHUB_ENV

# Setup compilation mode and install project dependencies
- name: Configure xmake and install dependencies
run: xmake config --plat=${{ matrix.confs.plat }} --arch=${{ matrix.confs.arch }} --kind=${{ matrix.kind }} --mode=${{ matrix.confs.mode }} ${{ env.ADDITIONAL_CONF }} --ccache=n --yes

# 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 }}

# Build library and tests
- name: Build library
run: xmake

# Run unit tests
- name: Run unit tests
if: ${{ matrix.confs.test }}
run: xmake run concerto-reflection-tests

- name: Install
run: xmake install -vo concerto-reflection

# For some reason macOS-14 doesn't seem to have Python
- uses: actions/setup-python@v6
if: ${{ matrix.platform.runner == 'macos-14' }}
with:
python-version: "3.11"

- name: Archive result
uses: ihiroky/archive-action@v1
with:
root_dir: concerto-reflection
file_path: ${{ env.OUTPUT_FILE }}
verbose: true

# Nightly tags (for commits to main branch)
- name: Upload binaries to release (Main)
uses: svenstaro/upload-release-action@v2
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.package }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_FILE }}
asset_name: ${{ env.OUTPUT_FILE }}
tag: "0.0.0-nightly"
overwrite: true
prerelease: true

# Release tags (for tags)
- name: Upload binaries to release (Tag)
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.event.ref, 'refs/tags/') && matrix.confs.mode == 'releasedbg' && matrix.confs.package }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_FILE }}
asset_name: ${{ env.OUTPUT_FILE }}
tag: ${{ github.ref }}
overwrite: true
71 changes: 0 additions & 71 deletions .github/workflows/macos.yml

This file was deleted.

74 changes: 0 additions & 74 deletions .github/workflows/ubuntu24.yml

This file was deleted.

Loading
Loading