CI Build #67
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
# Cross-platform and multi-configuration build of Methane Asteroids | |
name: 'CI Build' | |
on: | |
push: | |
branches: [ main, develop ] | |
paths: | |
- '.github/**/*.yml' | |
- 'Apps/**' | |
- 'Modules/**' | |
- 'Externals/**' | |
- 'CMake/**' | |
- 'CMakeLists.txt' | |
- 'CMakePresets.json' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- '.github/**/*.yml' | |
- 'Apps/**' | |
- 'Modules/**' | |
- 'Externals/**' | |
- 'CMake/**' | |
- 'CMakeLists.txt' | |
- 'CMakePresets.json' | |
schedule: | |
- cron: '20 23 * * 3' | |
env: | |
product_ver_major: 0 | |
product_ver_minor: 7 | |
product_ver_patch: 2 | |
product_ver_build: ${{ github.run_number }} | |
tracy_release_version: "0.9.1" | |
jobs: | |
build-asteroids: | |
name: Build ${{ matrix.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
os_name: Windows | |
name: "Win64_DX_Release" | |
config_preset: "VS2022-Win64-DX-Default" | |
build_preset: "VS2022-Win64-DX-Release" | |
add_tracy_app: false | |
- os: windows-latest | |
os_name: Windows | |
name: "Win64_VK_Release" | |
config_preset: "VS2022-Win64-VK-Default" | |
build_preset: "VS2022-Win64-VK-Release" | |
add_tracy_app: false | |
- os: windows-latest | |
os_name: Windows | |
name: "Win64_DX_Profile" | |
config_preset: "VS2022-Win64-DX-Profile" | |
build_preset: "VS2022-Win64-DX-Profile" | |
add_tracy_app: true | |
- os: windows-latest | |
os_name: Windows | |
name: "Win64_VK_Profile" | |
config_preset: "VS2022-Win64-VK-Profile" | |
build_preset: "VS2022-Win64-VK-Profile" | |
add_tracy_app: true | |
- os: windows-latest | |
os_name: Windows | |
name: "Win32_DX_Release" | |
config_preset: "VS2022-Win32-DX-Default" | |
build_preset: "VS2022-Win32-DX-Release" | |
add_tracy_app: false | |
- os: windows-latest | |
os_name: Windows | |
name: "Win32_VK_Release" | |
config_preset: "VS2022-Win32-VK-Default" | |
build_preset: "VS2022-Win32-VK-Release" | |
add_tracy_app: false | |
- os: windows-latest | |
os_name: Windows | |
name: "Win32_DX_Profile" | |
config_preset: "VS2022-Win32-DX-Profile" | |
build_preset: "VS2022-Win32-DX-Profile" | |
add_tracy_app: true | |
- os: windows-latest | |
os_name: Windows | |
name: "Win32_VK_Profile" | |
config_preset: "VS2022-Win32-VK-Profile" | |
build_preset: "VS2022-Win32-VK-Profile" | |
add_tracy_app: true | |
- os: ubuntu-latest | |
os_name: Ubuntu | |
name: "Ubuntu_VK_Release" | |
config_preset: "Make-Lin-VK-Release" | |
build_preset: "Make-Lin-VK-Release" | |
add_tracy_app: false | |
- os: ubuntu-latest | |
os_name: Ubuntu | |
name: "Ubuntu_VK_Profile" | |
config_preset: "Make-Lin-VK-Profile" | |
build_preset: "Make-Lin-VK-Profile" | |
add_tracy_app: true | |
- os: macos-latest | |
os_name: MacOS | |
name: "MacOS_Arm64_MTL_Release" | |
config_preset: "Xcode-Mac-Arm64-MTL-Default" | |
build_preset: "Xcode-Mac-Arm64-MTL-Release" | |
add_tracy_app: false | |
- os: macos-latest | |
os_name: MacOS | |
name: "MacOS_Arm64_MTL_Profile" | |
config_preset: "Xcode-Mac-Arm64-MTL-Profile" | |
build_preset: "Xcode-Mac-Arm64-MTL-Profile" | |
add_tracy_app: true | |
- os: macos-latest | |
os_name: MacOS | |
name: "MacOS_x86-64_MTL_Release" | |
config_preset: "Xcode-Mac-x86-64-MTL-Default" | |
build_preset: "Xcode-Mac-x86-64-MTL-Release" | |
add_tracy_app: false | |
- os: macos-latest | |
os_name: MacOS | |
name: "MacOS_x86-64_MTL_Profile" | |
config_preset: "Xcode-Mac-x86-64-MTL-Profile" | |
build_preset: "Xcode-Mac-x86-64-MTL-Profile" | |
add_tracy_app: true | |
- os: macos-latest | |
os_name: MacOS | |
name: "iOS_Sim_MTL_Release" | |
config_preset: "Xcode-iOS-Sim-MTL-Default" | |
build_preset: "Xcode-iOS-Sim-MTL-Release" | |
add_tracy_app: false | |
- os: macos-latest | |
os_name: MacOS | |
name: "tvOS_Sim_MTL_Release" | |
config_preset: "Xcode-tvOS-Sim-MTL-Default" | |
build_preset: "Xcode-tvOS-Sim-MTL-Release" | |
add_tracy_app: false | |
runs-on: ${{ matrix.os }} | |
env: | |
INSTALL_DIR: Build/Output/${{ matrix.config_preset }}/Install | |
BUILD_LOG_FILE: Build/Output/${{ matrix.config_preset }}/Install/Build.log | |
steps: | |
- name: Install Linux prerequisites | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt install xcb libx11-dev libx11-xcb-dev libxcb-sync-dev libxcb-randr0-dev p7zip | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Initialize Externals Cache | |
id: cache-externals | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-externals | |
with: | |
path: Build/Output/ExternalsCache | |
key: ExternalsCache-${{ matrix.config_preset }}-${{ hashFiles('Externals/*.cmake') }} | |
- name: CMake Configure Preset ${{ matrix.config_preset }} | |
shell: bash | |
run: | | |
set -o pipefail | |
mkdir -p "$INSTALL_DIR" | |
cmake --preset ${{ matrix.config_preset }} -DASTEROIDS_VERSION_MAJOR=${{ env.product_ver_major }} -DASTEROIDS_VERSION_MINOR=${{ env.product_ver_minor }} -DASTEROIDS_VERSION_PATCH=${{ env.product_ver_patch }} -DASTEROIDS_VERSION_BUILD=${{ env.product_ver_build }} 2>&1 | tee $BUILD_LOG_FILE | |
- name: CMake Build Preset ${{ matrix.build_preset }} | |
shell: bash | |
run: | | |
set -o pipefail | |
cmake --build --preset ${{ matrix.build_preset }} --target install --parallel 4 2>&1 | tee -a $BUILD_LOG_FILE | |
- name: Add README and BUILD files | |
shell: bash | |
run: | | |
cp README.md $INSTALL_DIR/README.md | |
echo Methane Asteroids v.${{ env.product_ver_major }}.${{ env.product_ver_minor }}.${{ env.product_ver_patch }}.${{ env.product_ver_build }} https://github.com/${{ github.repository }} > $INSTALL_DIR/Build-Info.txt | |
echo - Git repository: ${{ github.repositoryUrl }}, branch: ${{ github.ref_name }}, commit SHA: ${{ github.sha }} >> $INSTALL_DIR/Build-Info.txt | |
echo - GitHub Actions build url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} >> $INSTALL_DIR/Build-Info.txt | |
echo - Built with CMake configure preset ${{ matrix.config_preset }} and build preset ${{ matrix.build_preset }} >> $INSTALL_DIR/Build-Info.txt | |
echo - Built on agent ${{ runner.name }}, ${{ runner.os }}, ${{ runner.arch }}: >> $INSTALL_DIR/Build-Info.txt | |
echo - Builder agent ${{ matrix.os }} system information: >> $INSTALL_DIR/Build-Info.txt | |
- name: Add Windows System Information to BUILD file | |
if: ${{ matrix.os_name == 'Windows' }} | |
run: systeminfo >> ${{ env.INSTALL_DIR }}\Build-Info.txt | |
- name: Add Unix System Information to BUILD file | |
if: ${{ matrix.os_name != 'Windows' }} | |
run: uname -a >>$INSTALL_DIR/Build-Info.txt | |
- name: Download Tracy release | |
if: ${{ matrix.add_tracy_app }} | |
shell: bash | |
run: | | |
curl -sSLo Tracy.7z https://github.com/MethanePowered/Tracy/releases/download/v${{ env.tracy_release_version }}/Tracy-${{ matrix.os_name }}-v${{ env.tracy_release_version }}.7z | |
7z x Tracy.7z -o$INSTALL_DIR/Apps | |
- name: Archive Build Artifacts | |
shell: bash | |
working-directory: ${{ env.INSTALL_DIR }} | |
run: 7z a -t7z -mx=9 MethaneAsteroids_${{ matrix.name }}.7z -r- ./*.* Apps/* | |
- name: Upload Archived Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MethaneAsteroids_${{ matrix.name }}_${{ env.product_ver_major }}.${{ env.product_ver_minor }}.${{ env.product_ver_patch }}.${{ env.product_ver_build }} | |
path: ${{ env.INSTALL_DIR }}/MethaneAsteroids_${{ matrix.name }}.7z |