Merge pull request #31 from TissueEngineeringLab/feature/update_confi… #10
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
# Workflow building the Windows Installer file | |
name: Build Windows Installer | |
on: | |
# Runs on pushes on the default branch | |
push: | |
branches: ["main"] | |
# Runs on pull requests targeting the default branch | |
pull_request: | |
types: [opened, edited, reopened, synchronize] | |
branches: ["main"] | |
# Runs automatically every first day of the month | |
schedule: | |
- cron: '0 12 1 * *' | |
# May also be started manually | |
workflow_dispatch: | |
jobs: | |
# Builds the Windows installer, tests it, and uploads it | |
build-windows-installer: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Set up Python 3.10 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
# Build the wheel for the latest version | |
- name: Build Wheel | |
run: | | |
python -m venv ${{ github.workspace }}\venv | |
${{ github.workspace }}\venv\Scripts\python.exe -m pip install --upgrade pip wheel build setuptools | |
${{ github.workspace }}\venv\Scripts\python.exe -m build ${{ github.workspace }} -o ${{ github.workspace }}\dist | |
# Generates the .msi file using Advanced Installer | |
- name: Generate MSI | |
uses: caphyon/[email protected] | |
with: | |
advinst-version: '20.9.1' | |
advinst-enable-automation: 'true' | |
aip-path: ${{ github.workspace }}\src\windows_installer\config.aip | |
aip-build-name: DefaultBuild | |
aip-package-name: myofinder.msi | |
aip-output-dir: ${{ github.workspace }}\setup | |
# For some reason the installation directory needs to be manually created | |
- name: Create Installation Folder | |
shell: pwsh | |
run: mkdir "$env:localappdata\MyoFInDer" | |
# Execute the .msi installer to check that it operates as expected | |
# Also, record the logs to a log file | |
- name: Run Installer | |
shell: pwsh | |
run: If ((Start-Process msiexec -Wait -PassThru -ArgumentList "/I", | |
"${{ github.workspace }}\setup\myofinder.msi", | |
"/qn", | |
"/l*vx", | |
"${{ github.workspace }}\setup\log.txt").ExitCode -ne 0) | |
{exit 1} else | |
{Write-Output "::notice ::{MSI Installation succeeded}"} | |
# If the workflow is manually started, show some debug information | |
- name: Show Debug Info | |
if: contains(fromJSON('["workflow_dispatch"]'), github.event_name) | |
run: type ${{ github.workspace }}\setup\log.txt | |
# Getting the name of the wheel, cannot do it in the Windows shell | |
- name: Get Wheel Name | |
shell: bash | |
run: echo "WHEEL_NAME=$(echo '${{ github.workspace }}\dist\')$(ls '${{ github.workspace }}\dist' | grep \.whl$ | head -n 1)" >> $GITHUB_ENV | |
# Run the startup script installed by the .msi installer in test mode | |
- name: Run Startup Script | |
shell: cmd | |
run: '%localappdata%\MyoFInDer\start_myofinder.bat -t ${{ env.WHEEL_NAME }}' | |
# If the workflow is started manually or by a push, upload the .msi installer | |
- name: Upload Artifact | |
if: contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: myofinder.msi | |
path: ${{ github.workspace }}\setup\myofinder.msi | |
if-no-files-found: error |