Skip to content

feat: create sdk launcher #1

feat: create sdk launcher

feat: create sdk launcher #1

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
# nothing here
env:
BUILD_DIR: '${{github.workspace}}/build'
QT_VERSION: '6.5.3'
QT_MODULES: 'qtimageformats'
jobs:
build-windows:
strategy:
matrix:
build_type: [Debug, Release]
compiler: [msvc]
target: [p2ce, momentum]
runs-on: windows-latest
defaults:
run:
shell: cmd
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
spectre: true
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION}}
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
dir: '${{github.workspace}}/qt'
modules: ${{env.QT_MODULES}}
cache: true
- name: Configure CMake [target:p2ce]
if: ${{matrix.target == 'p2ce'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION}}/msvc2019_64" -DSDK_LAUNCHER_USE_LTO=ON -DSDK_LAUNCHER_DEFAULT_APPID=440000
- name: Configure CMake [target:momentum]
if: ${{matrix.target == 'momentum'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION}}/msvc2019_64" -DSDK_LAUNCHER_USE_LTO=ON -DSDK_LAUNCHER_DEFAULT_APPID=1802710
- name: Build SDK Launcher
working-directory: '${{env.BUILD_DIR}}'
run: |
cmake --build . --config ${{matrix.build_type}} -t sdk_launcher -- -j%NUMBER_OF_PROCESSORS%
- name: Upload SDK Launcher
uses: actions/upload-artifact@v4
with:
name: 'SDK_Launcher-${{matrix.target}}-Windows-${{matrix.compiler}}-${{matrix.build_type}}'
path: ${{env.BUILD_DIR}}/sdk_launcher.exe
retention-days: 7
build-linux:
strategy:
matrix:
build_type: [Debug, Release]
compiler: [gcc]
target: [p2ce, momentum]
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Necessary Packages
run: sudo apt update && sudo apt install -y cmake build-essential ninja-build chrpath
- name: Install GCC [compiler:gcc]
if: ${{matrix.compiler == 'gcc'}}
uses: egor-tensin/setup-gcc@v1
with:
version: 11
platform: x64
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION}}
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
dir: '${{github.workspace}}/qt'
modules: ${{env.QT_MODULES}}
cache: true
- name: Configure CMake [target:p2ce]
if: ${{matrix.target == 'p2ce'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION}}/gcc_64" -DSDK_LAUNCHER_USE_LTO=ON -DSDK_LAUNCHER_DEFAULT_APPID=440000
- name: Configure CMake [target:momentum]
if: ${{matrix.target == 'momentum'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION}}/gcc_64" -DSDK_LAUNCHER_USE_LTO=ON -DSDK_LAUNCHER_DEFAULT_APPID=1802710
- name: Build SDK Launcher
working-directory: '${{env.BUILD_DIR}}'
run: cmake --build . --config ${{matrix.build_type}} -t sdk_launcher -- -j$(nproc)
- name: Fixup Binaries
run: |
chmod +x '${{env.BUILD_DIR}}/sdk_launcher'
# runpath cleanup for the Qt binaries. These are (mostly) wrong, leading to crashes
for f in ${{env.BUILD_DIR}}/*.so*; do
echo "Fixing $f..."
chrpath -r '$ORIGIN' "$f"
done
for f in ${{env.BUILD_DIR}}/*/*.so*; do
echo "Fixing $f..."
chrpath -r '$ORIGIN/..' "$f"
done
- name: Upload SDK Launcher
uses: actions/upload-artifact@v4
with:
name: 'SDK_Launcher-${{matrix.target}}-Linux-${{matrix.compiler}}-${{matrix.build_type}}'
path: ${{env.BUILD_DIR}}/sdk_launcher
retention-days: 7
deploy:
needs:
- build-windows
- build-linux
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/github-script@v7
with:
script: |
const artifacts = (await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.run_id}},
})).data.artifacts;
const filteredArtifacts = artifacts.filter(artifact => artifact.name.includes("Release"));
console.log(`Found ${artifacts.length} artifacts - ${filteredArtifacts.length} qualify for upload.`);
for (const artifact of filteredArtifacts) {
console.log(`Downloading "${artifact.name}.zip"...`);
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${{github.workspace}}/${artifact.name}.zip`, Buffer.from(download.data));
}
console.log("Artifact download complete!");
- name: Upload Release
uses: actions/upload-artifact@v4
with:
name: Release-Artifacts
path: |
${{github.workspace}}/*.zip
retention-days: 7