build-winxp #8
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-winxp | |
# runs every 4 months | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 1 */4 *" | |
release: | |
types: [published] | |
jobs: | |
msvc-xp: | |
name: WinXP ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable }}) | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
arch: [x86, x86_64] | |
build_type: [Release] | |
portable: [Non-Portable] | |
include: | |
- arch: x86 | |
platform: Win32 | |
- arch: x86_64 | |
platform: x64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Windows XP Support for Visual Studio | |
run: | | |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" | |
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" | |
$componentsToAdd = @( | |
"Microsoft.VisualStudio.Component.WinXP" | |
) | |
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_} | |
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') | |
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden | |
if ($process.ExitCode -eq 0) | |
{ | |
Write-Host "components have been successfully added" | |
Get-ChildItem C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.Windows.XPSupport.* | |
} | |
else | |
{ | |
Write-Host "components were not installed" | |
exit 1 | |
} | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Create Build Environment | |
run: cmake -E make_directory ${{ github.workspace }}/build | |
- name: Configure CMake | |
shell: bash | |
working-directory: ${{ github.workspace }}/build | |
run: | | |
OPTIONS="-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=bin" | |
if [ "${{ matrix.portable }}" == "Portable" ]; then | |
OPTIONS+=" -DBuildPortableVersion=ON" | |
else | |
OPTIONS+=" -DBuildPortableVersion=OFF" | |
fi | |
cmake $GITHUB_WORKSPACE -T v141_xp -A ${{ matrix.platform }} $OPTIONS | |
- name: Build | |
working-directory: ${{ github.workspace }}/build | |
shell: bash | |
run: cmake --build . --config ${{ matrix.build_type }} -j $NUMBER_OF_PROCESSORS | |
- name: Install | |
if: ${{ matrix.build_type == 'Release' }} | |
working-directory: ${{ github.workspace }}/build | |
shell: bash | |
run: cmake --install . --config ${{ matrix.build_type }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.build_type == 'Release' }} | |
with: | |
name: TaystJK-windowsxp-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }} | |
path: ${{ github.workspace }}/build/bin/JediAcademy | |
if-no-files-found: error | |
create-winxp: | |
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' | |
needs: [msvc-xp] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create binary archives | |
run: | | |
7z a -r TaystJK-windowsxp-x86.zip ./TaystJK-windowsxp-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' | |
7z a -r TaystJK-windowsxp-x86_64.zip ./TaystJK-windowsxp-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' | |
- name: Create latest beta build | |
uses: crowbarmaster/GH-Automatic-Releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: "winxp" | |
prerelease: false | |
title: Latest WinXP Build | |
files: | | |
*.zip | |
create-release-winxp: | |
if: github.event_name == 'release' | |
needs: [msvc-xp] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- artifact_dir: TaystJK-windowsxp-x86.zip | |
artifact_name: TaystJK-windowsxp-x86.zip | |
zip: true | |
- artifact_dir: TaystJK-windowsxp-x86_64.zip | |
artifact_name: TaystJK-windowsxp-x86_64.zip | |
zip: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
- name: Create archive | |
run: | | |
if [ "${{ matrix.zip }}" == "true" ]; then | |
7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*' | |
else | |
mv ./${{ matrix.artifact_dir }}/* ${{ matrix.artifact_name }} | |
fi | |
- name: Upload archives | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
file: ${{ matrix.artifact_name }} |