Skip to content

fix(cli): make naming more consistent #622

fix(cli): make naming more consistent

fix(cli): make naming more consistent #622

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_VPKEDIT: '6.6.3'
QT_VERSION_STRATASOURCE: '6.5.3'
QT_MODULES: 'qtimageformats'
jobs:
build-windows:
strategy:
matrix:
build_type: [Debug, Release]
compiler: [msvc]
target: [VPKEdit, StrataSource]
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 [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION_VPKEDIT}}
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
dir: '${{github.workspace}}/qt'
modules: ${{env.QT_MODULES}}
cache: true
- name: Install Qt [target:StrataSource]
if: ${{matrix.target == 'StrataSource'}}
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION_STRATASOURCE}}
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
dir: '${{github.workspace}}/qt'
modules: ${{env.QT_MODULES}}
cache: true
- name: Configure CMake [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION_VPKEDIT}}/msvc2019_64" -DVPKEDIT_USE_LTO=ON
- name: Configure CMake [target:StrataSource]
if: ${{matrix.target == 'StrataSource'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION_STRATASOURCE}}/msvc2019_64" -DVPKEDIT_BUILD_FOR_STRATA_SOURCE=ON -DVPKEDIT_USE_LTO=ON
- name: Build Binaries
working-directory: '${{env.BUILD_DIR}}'
run: |
cmake --build . --config ${{matrix.build_type}} -t vpkeditcli -- -j%NUMBER_OF_PROCESSORS%
cmake --build . --config ${{matrix.build_type}} -t vpkedit -- -j%NUMBER_OF_PROCESSORS%
- name: Upload Standalone CLI [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Windows-Standalone-CLI-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/CREDITS.md
${{env.BUILD_DIR}}/LICENSE
${{env.BUILD_DIR}}/vpkeditcli.exe
retention-days: 7
- name: Upload Standalone GUI [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Windows-Standalone-GUI-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/CREDITS.md
${{env.BUILD_DIR}}/LICENSE
${{env.BUILD_DIR}}/vpkedit.exe
${{env.BUILD_DIR}}/*.dll
${{env.BUILD_DIR}}/imageformats/*.dll
${{env.BUILD_DIR}}/platforms/*.dll
${{env.BUILD_DIR}}/styles/*.dll
${{env.BUILD_DIR}}/tls/*.dll
retention-days: 7
- name: Upload Standalone CLI/GUI [target:StrataSource]
if: ${{matrix.target == 'StrataSource'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Windows-Binaries-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/vpkeditcli.exe
${{env.BUILD_DIR}}/vpkedit.exe
retention-days: 7
- name: Create Installer [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
working-directory: ${{env.BUILD_DIR}}
run: cpack
- name: Upload Installer [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Windows-Installer-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/VPKEdit-*-win64.exe
retention-days: 7
- name: Build C Wrapper Library [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
run: |
cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION_VPKEDIT}}/msvc2019_64" -DVPKEDIT_BUILD_LIBC=ON -DVPKEDIT_BUILD_CLI=OFF -DVPKEDIT_BUILD_GUI=OFF -DVPKEDIT_BUILD_INSTALLER=OFF
cmake --build "${{env.BUILD_DIR}}" --config ${{matrix.build_type}} -t libvpkeditc -- -j%NUMBER_OF_PROCESSORS%
- name: Upload C Wrapper Library [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Windows-C-Wrapper-Library-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/libvpkeditc.dll
${{github.workspace}}/include/vpkeditc/
retention-days: 7
- name: Upload Standalone PDBs [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Windows-PDBs-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/libvpkeditc.pdb
${{env.BUILD_DIR}}/vpkeditcli.pdb
${{env.BUILD_DIR}}/vpkedit.pdb
retention-days: 7
build-linux:
strategy:
matrix:
build_type: [Debug, Release]
compiler: [gcc]
target: [VPKEdit, StrataSource]
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 [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION_VPKEDIT}}
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
dir: '${{github.workspace}}/qt'
modules: ${{env.QT_MODULES}}
cache: true
- name: Install Qt [target:StrataSource]
if: ${{matrix.target == 'StrataSource'}}
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{env.QT_VERSION_STRATASOURCE}}
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
dir: '${{github.workspace}}/qt'
modules: ${{env.QT_MODULES}}
cache: true
- name: Configure CMake [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION_VPKEDIT}}/gcc_64" -DVPKEDIT_USE_LTO=ON
- name: Configure CMake [target:StrataSource]
if: ${{matrix.target == 'StrataSource'}}
run: cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION_STRATASOURCE}}/gcc_64" -DVPKEDIT_BUILD_FOR_STRATA_SOURCE=ON -DVPKEDIT_USE_LTO=ON
- name: Build Binaries
working-directory: '${{env.BUILD_DIR}}'
run: |
cmake --build . --config ${{matrix.build_type}} -t vpkeditcli -- -j$(nproc)
cmake --build . --config ${{matrix.build_type}} -t vpkedit -- -j$(nproc)
- name: Fixup Binaries
run: |
chmod +x '${{env.BUILD_DIR}}/vpkedit'
# 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 Standalone CLI [compiler:gcc][target:VPKEdit]
if: ${{matrix.compiler == 'gcc' && matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Linux-Standalone-CLI-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/CREDITS.md
${{env.BUILD_DIR}}/LICENSE
${{env.BUILD_DIR}}/vpkeditcli
retention-days: 7
- name: Upload Standalone GUI [compiler:gcc][target:VPKEdit]
if: ${{matrix.compiler == 'gcc' && matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Linux-Standalone-GUI-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/CREDITS.md
${{env.BUILD_DIR}}/LICENSE
${{env.BUILD_DIR}}/vpkedit
${{env.BUILD_DIR}}/*.so*
${{env.BUILD_DIR}}/egldeviceintegrations/*.so*
${{env.BUILD_DIR}}/imageformats/*.so*
${{env.BUILD_DIR}}/platforminputcontexts/*.so*
${{env.BUILD_DIR}}/platforms/*.so*
${{env.BUILD_DIR}}/platformthemes/*.so*
${{env.BUILD_DIR}}/tls/*.so*
${{env.BUILD_DIR}}/wayland-decoration-client/*.so*
${{env.BUILD_DIR}}/wayland-graphics-integration-client/*.so*
${{env.BUILD_DIR}}/wayland-shell-integration/*.so*
${{env.BUILD_DIR}}/xcbglintegrations/*.so*
retention-days: 7
- name: Upload Standalone CLI/GUI [compiler:gcc][target:StrataSource]
if: ${{matrix.compiler == 'gcc' && matrix.target == 'StrataSource'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Linux-Binaries-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/vpkeditcli
${{env.BUILD_DIR}}/vpkedit
retention-days: 7
- name: Create Installer [compiler:gcc][target:VPKEdit]
if: ${{matrix.compiler == 'gcc' && matrix.target == 'VPKEdit'}}
working-directory: ${{env.BUILD_DIR}}
run: cpack
- name: Upload Installer [compiler:gcc][target:VPKEdit]
if: ${{matrix.compiler == 'gcc' && matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Linux-Installer-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/VPKEdit-*-Linux.deb
retention-days: 7
- name: Build C Wrapper Library [target:VPKEdit]
if: ${{matrix.target == 'VPKEdit'}}
run: |
cmake -G "Ninja" -B "${{env.BUILD_DIR}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DQT_BASEDIR="${{github.workspace}}/qt/Qt/${{env.QT_VERSION_VPKEDIT}}/gcc_64" -DVPKEDIT_BUILD_LIBC=ON -DVPKEDIT_BUILD_CLI=OFF -DVPKEDIT_BUILD_GUI=OFF -DVPKEDIT_BUILD_INSTALLER=OFF
cmake --build "${{env.BUILD_DIR}}" --config ${{matrix.build_type}} -t libvpkeditc -- -j$(nproc)
- name: Upload C Wrapper Library [compiler:gcc][target:VPKEdit]
if: ${{matrix.compiler == 'gcc' && matrix.target == 'VPKEdit'}}
uses: actions/upload-artifact@v4
with:
name: '${{matrix.target}}-Linux-C-Wrapper-Library-${{matrix.compiler}}-${{matrix.build_type}}'
path: |
${{env.BUILD_DIR}}/libvpkeditc.so*
${{github.workspace}}/include/vpkeditc/
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