LPub3D v2.4.8 #2
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
# Build, check and deploy LPub3D | |
# Trevor SANDY <[email protected]> | |
# Last Update: September 26, 2024 | |
# Copyright (C) 2021 - 2024 by Trevor SANDY | |
# | |
# Commit message strings with [skip ci], [ci skip], [no ci], [skip actions], or [actions skip] | |
# will skip pull request and push workflows. | |
# | |
name: builds # used for badge label | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
- '!continuous' | |
workflow_dispatch: | |
jobs: | |
build-linux: | |
# if: ${{ false }} # uncomment to disable | |
name: Build ${{ matrix.BUILD }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: # ubuntu-amd64, ubuntu-arm64, ubuntu-amd64-appimage, ubuntu-arm64-appimage, fedora-amd64, archlinux-amd64 | |
BUILD: [ ubuntu-amd64, ubuntu-arm64, ubuntu-amd64-appimage, ubuntu-arm64-appimage, fedora-amd64, archlinux-amd64 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Work Paths | |
run: | | |
echo "LP3D_3RD_PARTY_PATH=$(cd ../ && echo "$PWD/third_party")" >> ${GITHUB_ENV} | |
echo "LP3D_BUILDPKG_PATH=$(cd ../ && mkdir buildpkg && echo "$PWD/buildpkg")" >> ${GITHUB_ENV} | |
- name: Cache Third-party | |
id: cache-third-party | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LP3D_3RD_PARTY_PATH }} | |
key: third-party-${{ matrix.BUILD }}-${{ secrets.THIRD_PARTY_CACHE }} | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Build ${{ matrix.BUILD }} | |
run: bash -ex builds/utilities/ci/github/linux-build.sh | |
env: | |
BUILD: ${{ matrix.BUILD }} | |
LP3D_CPU_CORES: ${{ steps.cpu-cores.outputs.count }} | |
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }} | |
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
- name: List Artifacts | |
if: always() | |
run: test -d ${{ env.LP3D_BUILDPKG_PATH }} && ls -alFR ${{ env.LP3D_BUILDPKG_PATH }} || true | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.BUILD }}-download | |
path: ${{ env.LP3D_BUILDPKG_PATH }}/ | |
if-no-files-found: ignore | |
- name: Diagnostics | |
if: failure() || cancelled() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.BUILD }}-logs | |
path: ${{ env.LP3D_BUILDPKG_PATH }}/ | |
if-no-files-found: ignore | |
build-macos: | |
# if: ${{ false }} # uncomment to disable | |
name: Build macOS ${{ matrix.runner-version }} | |
runs-on: macos-${{ matrix.runner-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runner-version: [ 13, 14 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Work Paths | |
run: | | |
echo "LP3D_3RD_PARTY_PATH=$(cd ../ && echo "$PWD/third_party")" >> ${GITHUB_ENV} | |
echo "LP3D_BUILDPKG_PATH=$(cd ../ && mkdir buildpkg && echo "$PWD/buildpkg")" >> ${GITHUB_ENV} | |
- name: Cache Third-party | |
id: cache-third-party | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LP3D_3RD_PARTY_PATH }} | |
key: third-party-macos-${{ matrix.runner-version }}-${{ secrets.THIRD_PARTY_CACHE }} | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
id: cpu-cores | |
- name: Build macOS ${{ matrix.runner-version }} | |
run: bash -ex builds/utilities/ci/github/macos-build.sh | |
env: | |
LP3D_CPU_CORES: ${{ steps.cpu-cores.outputs.count }} | |
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }} | |
- name: List Artifacts | |
if: always() | |
run: test -d ${{ env.LP3D_BUILDPKG_PATH }} && ls -alFR ${{ env.LP3D_BUILDPKG_PATH }} || true | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-${{ matrix.runner-version }}-download | |
path: ${{ env.LP3D_BUILDPKG_PATH }}/ | |
if-no-files-found: ignore | |
- name: Diagnostics | |
if: failure() || cancelled() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-${{ matrix.runner-version }}-logs | |
path: ${{ env.LP3D_BUILDPKG_PATH }}/ | |
if-no-files-found: ignore | |
build-windows: | |
# if: ${{ false }} # uncomment to disable | |
name: Build Windows 2022 | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Work Paths | |
run: | | |
Echo "LP3D_3RD_PARTY_PATH=$(Join-Path (resolve-path ..\) 'third_party')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
Echo "LP3D_BUILDPKG_PATH=$(Join-Path (resolve-path ..\) 'buildpkg')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
Echo "LP3D_BUILD_BASE=$(resolve-path ..\)" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
New-Item -Path ..\ -Name 'buildpkg' -ItemType 'directory' | |
- name: Cache Third-party # distribution folder | |
id: cache-third-party | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LP3D_3RD_PARTY_PATH }} | |
key: third-party-windows-${{ secrets.THIRD_PARTY_CACHE }} | |
- name: Cache QtMSVC 2019 | |
id: cache-qt | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.LP3D_BUILD_BASE }}\Qt | |
key: qt-windows-${{ env.QT_CACHE }} | |
- name: VC 141 Build Tools | |
run: | | |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" | |
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" | |
$ComponentsToAdd= @("Microsoft.VisualStudio.Component.VC.v141.x86.x64") | |
[string]$WorkloadArgs = $ComponentsToAdd | ForEach-Object {" --add " + $_} # Use --remove to delete component | |
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$WorkloadArgs, '--quiet', '--norestart', '--nocache') | |
# should be run twice | |
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden | |
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden | |
shell: powershell | |
- name: Windows 8.1 SDK | |
run: | | |
Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdksetup.exe -UseBasicParsing | |
Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit" | |
shell: powershell | |
- name: Qt MSVC 2019 64bit # path: ..\Qt\5.15.2\msvc2019_64\bin | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: 5.15.2 | |
host: windows | |
arch: win64_msvc2019_64 | |
dir: ${{ env.LP3D_BUILD_BASE }} | |
cache: true | |
cache-key-prefix: install-qt-action | |
- name: Qt MSVC 2019 32bit # path: ..\Qt\5.15.2\msvc2019\bin | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: 5.15.2 | |
host: windows | |
arch: win32_msvc2019 | |
dir: ${{ env.LP3D_BUILD_BASE }} | |
cache: true | |
cache-key-prefix: install-qt-action | |
- name: Build Windows | |
run: .\builds\utilities\ci\github\windows-build.bat | .\builds\utilities\win_tee.cmd "${{ env.LP3D_BUILDPKG_PATH }}\windows_build.log" append | |
env: | |
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }} | |
shell: cmd | |
- name: List Artifacts | |
if: always() | |
run: If (Test-Path -Path ${{ env.LP3D_BUILDPKG_PATH }}) { Get-ChildItem -Path ${{ env.LP3D_BUILDPKG_PATH }} –Recurse } | |
- name: Upload Update Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: updates | |
path: ${{ env.LP3D_BUILDPKG_PATH }}\Updates\ | |
if-no-files-found: ignore | |
- name: Upload Download Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-download | |
path: ${{ env.LP3D_BUILDPKG_PATH }}\Downloads\ | |
if-no-files-found: ignore | |
- name: Diagnostics | |
if: failure() || cancelled() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-logs | |
path: ${{ env.LP3D_BUILDPKG_PATH }}/ | |
if-no-files-found: ignore | |
build-deploy: | |
# add "${{ false }} && # remove to enable" after pipe to disable | |
if: | | |
always() && | |
!contains(github.event.head_commit.message, 'SKIP_DEPLOY') && | |
(contains(github.event.head_commit.message, 'RELEASE_BUILD') || | |
contains(github.event.head_commit.message, 'BUILD_ALL') || | |
startsWith(github.event.ref, 'refs/tags/v') || | |
github.event_name == 'workflow_dispatch') | |
name: Publish Assets | |
needs: [ build-linux, build-macos, build-windows ] # build-linux, build-macos, build-windows | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Assets Path | |
run: echo "LP3D_BUILD_ASSETS=$(cd ../ && echo "$PWD/assets")" >> ${GITHUB_ENV} | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: # omit 'with: name:' to download all artifacts | |
path: ${{ env.LP3D_BUILD_ASSETS }} | |
- name: List Assets | |
run: ls -alFR | |
working-directory: ${{ env.LP3D_BUILD_ASSETS }} | |
- name: Deploy Assets | |
run: bash -ex builds/utilities/ci/github/build-deploy.sh | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
LP3D_COMMIT_MSG: ${{ github.event.head_commit.message }} | |
GPG_SIGN_KEY_ALIAS: ${{ secrets.GPG_SIGN_KEY_ALIAS }} | |
GPG_SIGN_PASSPHRASE: ${{ secrets.GPG_SIGN_PASSPHRASE }} | |
GPG_INIT_PASSPHRASE: ${{ secrets.GPG_INIT_PASSPHRASE }} | |
GPG_SIGN_KEY_BASE64: ${{ secrets.GPG_SIGN_KEY_BASE64 }} | |
SFDEPLOY_ED25519_BASE64: ${{ secrets.SFDEPLOY_ED25519_BASE64 }} | |
- name: Diagnostics | |
if: failure() || cancelled() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: publish-logs | |
path: ${{ env.LP3D_BUILDPKG_PATH }}/ | |
if-no-files-found: ignore |