fix: potential dangling pointer for flora stripper #99
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
| - name: Fetch full vcpkg history | |
| shell: powershell | |
| run: | | |
| $isShallow = (git -C vendor/vcpkg rev-parse --is-shallow-repository).Trim() | |
| if ($isShallow -eq "true") { | |
| git -C vendor/vcpkg fetch --unshallow | |
| } | |
| - name: Bootstrap vcpkg | |
| run: | | |
| ./vendor/vcpkg/bootstrap-vcpkg.bat | |
| echo "VCPKG_ROOT=${{ github.workspace }}/vendor/vcpkg" >> $env:GITHUB_ENV | |
| # sc4-render-services (32-bit) - only imgui is needed for this package | |
| - name: Build sc4-render-services | |
| working-directory: vendor/sc4-render-services | |
| run: | | |
| cmake -B build -G "Visual Studio 17 2022" -A Win32 | |
| cmake --build build --config Release --target imgui | |
| # Main DLL (32-bit for SC4) | |
| - name: Build DLL | |
| run: | | |
| cmake --preset vs2022-win32-release | |
| cmake --build --preset vs2022-win32-release-build --target SC4PlopAndPaint | |
| # CL app (64-bit) | |
| - name: Build CLI | |
| run: | | |
| cmake --preset vs2022-x64-release | |
| cmake --build --preset vs2022-x64-release-build --target SC4PlopAndPaintCli | |
| - name: Package | |
| shell: bash | |
| run: | | |
| mkdir -p dist-package | |
| cp cmake-build-release-visual-studio/src/dll/Release/SC4PlopAndPaint.dll dist-package/SC4PlopAndPaint.dll | |
| cp cmake-build-release-visual-studio-x64/src/app/Release/SC4PlopAndPaintCli.exe dist-package/_SC4PlopAndPaintCacheBuilder.exe | |
| cp dist/README.txt dist-package/ | |
| cp dist/RUN_CACHE_BUILDER.ps1 dist-package/ | |
| cp LICENSE.txt dist-package/ | |
| cp dist/THIRD_PARTY_NOTICES.txt dist-package/ | |
| cp dist/SC4PlopAndPaintInstaller.nsi dist-package/ | |
| cp dist/SC4PlopAndPaint.ini dist-package/ | |
| cp dist/SC4PlopAndPaint.dat dist-package/ | |
| [ -f vendor/sc4-properties/new_properties.xml ] && cp vendor/sc4-properties/new_properties.xml dist-package/PropertyMapper.xml | |
| echo "Package contents:" | |
| find dist-package -type f | sort | |
| - name: Install NSIS | |
| run: choco install nsis -y | |
| - name: Build installer | |
| shell: powershell | |
| run: | | |
| $rootDir = "${{ github.workspace }}" | |
| $refName = "${{ github.ref_name }}" | |
| $version = if ($refName -match '^v(.+)') { $Matches[1] } else { "${{ github.sha }}".Substring(0, 7) } | |
| $minRenderServicesVersionPath = Join-Path $rootDir "dist\MIN_SC4_RENDER_SERVICES.txt" | |
| $minRenderServicesVersion = (Get-Content -Path $minRenderServicesVersionPath -Raw).Trim() | |
| if ($minRenderServicesVersion -notmatch '^v?(\d+)\.(\d+)\.(\d+)$') { | |
| throw "Invalid SC4 Render Services minimum version in ${minRenderServicesVersionPath}: '$minRenderServicesVersion'" | |
| } | |
| $minRenderServicesMajor = $Matches[1] | |
| $minRenderServicesMinor = $Matches[2] | |
| $minRenderServicesBuild = $Matches[3] | |
| Write-Host "Building installer for version: $version" | |
| Write-Host "Minimum SC4 Render Services version: $minRenderServicesMajor.$minRenderServicesMinor.$minRenderServicesBuild" | |
| Set-Location dist-package | |
| & "C:\Program Files (x86)\NSIS\makensis.exe" ` | |
| /DAPP_VERSION=$version ` | |
| /DMIN_RENDER_SERVICES_VERSION_MAJOR=$minRenderServicesMajor ` | |
| /DMIN_RENDER_SERVICES_VERSION_MINOR=$minRenderServicesMinor ` | |
| /DMIN_RENDER_SERVICES_VERSION_BUILD=$minRenderServicesBuild ` | |
| SC4PlopAndPaintInstaller.nsi | |
| if ($LASTEXITCODE -ne 0) { throw "makensis failed with exit code $LASTEXITCODE" } | |
| Write-Host "Installer contents:" | |
| Get-ChildItem -Filter "*.exe" | Select-Object Name, Length | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: SC4PlopAndPaint-${{ github.ref_name || github.sha }} | |
| path: dist-package/ | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: SC4PlopAndPaint-${{ github.ref_name }} | |
| path: dist-package | |
| - name: Create release zip | |
| run: | | |
| VERSION=${{ github.ref_name }} | |
| zip -j SC4PlopAndPaint-${VERSION}.zip \ | |
| dist-package/SC4PlopAndPaint-*.exe \ | |
| dist-package/README.txt \ | |
| dist-package/LICENSE.txt \ | |
| dist-package/THIRD_PARTY_NOTICES.txt | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: SC4PlopAndPaint-${{ github.ref_name }}.zip | |
| generate_release_notes: true |