github: continuous integration script #40
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 the OpenSalamander project" | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Project files expect this variable to be defined. | |
OPENSAL_BUILD_DIR: c:\\OpenSalamander\\ | |
# Directory with installation that will be packed and uploaded as an artifact. | |
OPENSAL_INSTALL_DIR: c:\\install\\OpenSalamander\\ | |
# Configuration type to build. | |
BUILD_CONFIGURATION: Release | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
targetplatform: [x86, x64] # arm64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create version file | |
run: | | |
mkdir ${{ env.OPENSAL_INSTALL_DIR }} | |
git describe --tags --always > ${{ env.OPENSAL_INSTALL_DIR }}version.txt | |
type ${{ env.OPENSAL_INSTALL_DIR }}version.txt | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
with: | |
msbuild-architecture: ${{ matrix.targetplatform }} | |
- name: Setup .NET Framework SDK | |
if: false | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: '6.0.x' # required for pe-viewer | |
- name: Setup vcpkg | |
run: | | |
bootstrap-vcpkg | |
vcpkg integrate install | |
- name: Build the project | |
if: false | |
run: | | |
$platform = "${{ matrix.targetplatform }}" | |
if ("${{ matrix.targetplatform }}" -eq "x86") { | |
$platform = "Win32" | |
} | |
msbuild src\vcxproj\salamand.sln /t:Build /p:Configuration=Release /p:platform=$platform | |
msbuild src\vcxproj\salamand.sln /t:Build /p:Configuration="Utils (Release)" /p:platform=$platform | |
- name: Compose installation directory | |
if: false | |
run: | | |
pushd ${{ env.OPENSAL_BUILD_DIR }}salamander\\${{ env.BUILD_CONFIGURATION }}_${{ matrix.targetplatform }} | |
robocopy . ${{ env.OPENSAL_INSTALL_DIR }} *.exe *.dll *.spl *.slg /S | |
popd | |
xcopy /E /I /Y ${{ github.workspace }}\\convert ${{ env.OPENSAL_INSTALL_DIR }}convert | |
xcopy /E /I /Y ${{ github.workspace }}\\doc ${{ env.OPENSAL_INSTALL_DIR }}doc | |
xcopy /E /I /Y ${{ github.workspace }}\\src\\res\\toolbars ${{ env.OPENSAL_INSTALL_DIR }}toolbars | |
xcopy /E /I /Y ${{ github.workspace }}\\src\\plugins\\automation\\sample-scripts ${{ env.OPENSAL_INSTALL_DIR }}plugins\\automation\\scripts | |
xcopy /E /I /Y ${{ github.workspace }}\\src\\plugins\\ieviewer\\cmark-gfm\\css ${{ env.OPENSAL_INSTALL_DIR }}plugins\\ieviewer\\css | |
xcopy /I /Y ${{ github.workspace }}\\src\\plugins\\zip\\zip2sfx\\*.txt ${{ env.OPENSAL_INSTALL_DIR }}plugins\\zip\\zip2sfx | |
xcopy /I /Y ${{ github.workspace }}\\src\\plugins\\zip\\zip2sfx\\*.set ${{ env.OPENSAL_INSTALL_DIR }}plugins\\zip\\zip2sfx | |
- name: Install redistributable files | |
shell: pwsh | |
run: | | |
Set-PSDebug -Trace 2 | |
# find Visual Studio install path with vswhere tool | |
$vswhere_path = "${env:ProgramFiles(x86)}\\Microsoft Visual Studio\\Installer\\vswhere.exe" | |
$vs_install_path = & $vswhere_path -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | |
# find out VC toolset version | |
$vs_vctoolset_path = "$vs_install_path\\VC\\Auxiliary\\Build" | |
dir $vs_vctoolset_path | |
$vctoolset_file = Get-ChildItem -Path $vs_vctoolset_path -Filter "Microsoft.VCRedistVersion.v???.default.props" | Select-Object -ExpandProperty Name | |
echo $vctoolset_file | |
if ($vctoolset_file -match "Microsoft.VCRedistVersion\.v(\d+)\.default\.props") { | |
$vctoolset = $matches[1] | |
$vctoolsver = (Get-Content -Path "$vs_vctoolset_path\\Microsoft.VCRedistVersion.default.txt" -Raw).Trim() | |
# copy redistributable files to the installation directory | |
$vc_redist_path = "$vs_install_path\\VC\\Redist\\MSVC\\$vctoolsver\\${{ matrix.targetplatform }}\\Microsoft.VC${vctoolset}.CRT" | |
Copy-Item -Path "$vc_redist_path\\concrt???.dll" -Destination "${env:OPENSAL_INSTALL_DIR}" -Force | |
Copy-Item -Path "$vc_redist_path\\msvcp???.dll" -Destination "${env:OPENSAL_INSTALL_DIR}" -Force | |
Copy-Item -Path "$vc_redist_path\\vcruntime???.dll" -Destination "${env:OPENSAL_INSTALL_DIR}" -Force | |
} | |
#- name: Build language files | |
#- name: Build help files | |
#- name: Build setup.exe package | |
- name: Finalize installation package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: OpenSalamander-${{ matrix.targetplatform }} | |
path: ${{ env.OPENSAL_INSTALL_DIR }} | |
retention-days: 10 |