Skip to content
name: "MSBuild, VS 2022, & Windows. Build installer and test it."
on:
workflow_dispatch:
push:
branches: [ "main", "Cross_platform" ]
pull_request:
branches: [ "main", "Cross_platform" ]
env:
CONFIGURATION: Release
PLATFORM: x64
BOOST_VERSION: '1.8.3'
jobs:
build_and_upload_installer:
name: "MSBuild, VS 2022, & Windows. Build installer"
runs-on: windows-2022
outputs:
installer_file_name: ${{ steps.output_installer_file_name.outputs.name }}
steps:
- uses: actions/checkout@v4
- name: 'Add "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\bin" to path'
shell: bash
run: echo "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\bin" >> $GITHUB_PATH
- name: Deploy Advinst
uses: caphyon/advinst-github-action@v2.0
with:
# advinst-version: '21.3'
advinst-version: '21.7.1'
# advinst-license: ${{ secrets.ADVINST_LICENSE_KEY }}
# " advinst-license
# Advanced Installer license ID. This parameter is optional if you are using a simple project type.
# "
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Integrate vcpkg with Visual Studio
run: vcpkg integrate install
- name: Restore vcpkg Deps
id: cache-vcpkg-deps-restore
uses: actions/cache/restore@v4
with:
path: |
C:\vcpkg\
D:\a\sdna_plus\sdna_plus\vcpkg_installed\
D:\a\sdna_plus\sdna_plus\sDNA\sdna_vs2008\vcpkg_installed\
C:\Users\runneradmin\AppData\Local\vcpkg\
key: ${{ runner.os }}-${{ hashFiles('sDNA/sdna_vs2008/vcpkg.json', 'sDNA/sdna_vs2008/vcpkg-configuration.json') }}
- name: Install Boost from vcpkg.json
if: steps.cache-vcpkg-deps-restore.outputs.cache-hit != 'true'
run: vcpkg install
- name: Build sDNA
run: >
msbuild build_installer.proj
/t:rebuild
/p:Platform=${{ env.PLATFORM }}
/p:Configuration=${{ env.CONFIGURATION }}
/p:VcpkgEnableManifest=true
- name: Cache vcpkg Deps
if: steps.cache-vcpkg-deps-restore.outputs.cache-hit != 'true'
id: cache-deps-save
uses: actions/cache/save@v4
with:
path: |
C:\vcpkg\
D:\a\sdna_plus\sdna_plus\vcpkg_installed\
D:\a\sdna_plus\sdna_plus\sDNA\sdna_vs2008\vcpkg_installed\
C:\Users\runneradmin\AppData\Local\vcpkg\
key: ${{ steps.cache-vcpkg-deps-restore.outputs.cache-primary-key }}
- name: Output the name of the .msi installer file
id: output_installer_file_name
shell: bash
run: echo "name=$(ls sDNA_setup_win_v*.msi)" >> "$GITHUB_OUTPUT"
- name: upload output dir
id: installer-upload-step
uses: actions/upload-artifact@v4
with:
name: installer_file
# this file name pattern is defined in installerbits\rename_version.py
# outfilename = os.path.join(outputdir, "sDNA_setup_win_v%s.msi" % filename_friendly_version)
path: sDNA_setup_win_v*.msi
test_installer:
needs: build_and_upload_installer
strategy:
fail-fast: false
matrix:
python_version: ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
name: "Download and run sDNA installer, and run diff tests on it. "
runs-on: windows-2022
# Note: The Windows server 2022 Github runner image already includes
# Python (currently 6 versions from 3.7 to 3.12) and a couple of
# VC++ redistributables. Desktop users may need to install these
# themselves, in addition to sDNA.
#
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
#
env:
installer_file_name: ${{ needs.build_and_upload_installer.outputs.installer_file_name }}
steps:
- uses: actions/checkout@v4
- name: Download installer built in previous job
uses: actions/download-artifact@v4
with:
name: installer_file
- shell: cmd
run: dir .
- name: Allow the .msi to be executed
run: Set-ItemProperty -Path ${{ env.installer_file_name }} -Name IsReadOnly -Value $false
- name: Run sDNA installer using powershell script.
# This is based on @Simran-B's powershell script (from Github Community forum),
# according to GuiFalourd on Stack Overflow
# https://stackoverflow.com/a/72291019/20785734
run: |
$file = "${{ env.installer_file_name }}"
$log = "install.log"
$procMain = Start-Process "msiexec" "/i `"$file`" /qn /l*! `"$log`"" -NoNewWindow -PassThru
$procLog = Start-Process "powershell" "Get-Content -Path `"$log`" -Wait" -NoNewWindow -PassThru
$procMain.WaitForExit()
$procLog.Kill()
Remove-Item $file
- name: Run regression tests
uses: ./.github/actions/run_regression_tests
with:
python_version: ${{ matrix.python_version }}
DONT_TEST_N_LINK_SUBSYSTEMS_ORDER: 1
ALLOW_NEGATIVE_FORMULA_ERROR_ON_ANY_LINK_PRESENT: 1
sdnadll: 'c:\Program Files (x86)\sDNA\x64\sdna_vs2008.dll'
sdna_debug: ""