ASWIFT 1.0.2 #29
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 release app | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: ${{ matrix.asset-name }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-15 | |
| asset-name: ASWIFT-Viewer-macos-arm64 | |
| dotnet-script: unix | |
| package-path: build/desktop-dist/ASWIFT Viewer.app | |
| artifact-path: ASWIFT-Viewer-macos-arm64.zip | |
| - os: macos-15-intel | |
| asset-name: ASWIFT-Viewer-macos-x64 | |
| dotnet-script: unix | |
| package-path: build/desktop-dist/ASWIFT Viewer.app | |
| artifact-path: ASWIFT-Viewer-macos-x64.zip | |
| - os: windows-latest | |
| asset-name: ASWIFT-Viewer-windows-x64 | |
| dotnet-script: windows | |
| package-path: build/desktop-dist/ASWIFT Viewer | |
| artifact-path: ASWIFT-Viewer-windows-x64.zip | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Python build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[developer]" pyinstaller | |
| - name: Run test suite | |
| shell: bash | |
| env: | |
| MPLCONFIGDIR: ${{ runner.temp }}/matplotlib | |
| NUMBA_CACHE_DIR: ${{ runner.temp }}/numba | |
| run: python -m pytest -q | |
| - name: Install app-local .NET runtime | |
| if: matrix.dotnet-script == 'unix' | |
| shell: bash | |
| run: | | |
| mkdir -p .release-dotnet | |
| curl -sSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh | |
| bash dotnet-install.sh --runtime dotnet --channel 9.0 --install-dir "$PWD/.release-dotnet" | |
| "$PWD/.release-dotnet/dotnet" --info | |
| - name: Install app-local .NET runtime | |
| if: matrix.dotnet-script == 'windows' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force .release-dotnet | Out-Null | |
| Invoke-WebRequest https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1 | |
| ./dotnet-install.ps1 -Runtime dotnet -Channel 9.0 -InstallDir "$PWD/.release-dotnet" | |
| & "$PWD/.release-dotnet/dotnet.exe" --info | |
| - name: Build frozen Streamlit app | |
| shell: bash | |
| env: | |
| DOTNET_RUNTIME_DIR: ${{ github.workspace }}/.release-dotnet | |
| run: | | |
| pyinstaller --clean --noconfirm \ | |
| --workpath build/pyinstaller \ | |
| --distpath build/desktop-dist \ | |
| packaging/desktop/aswift_viewer.spec | |
| - name: Smoke test bundled imports | |
| shell: bash | |
| env: | |
| ASWIFT_VIEWER_IMPORT_CHECK: "1" | |
| run: | | |
| if [ "$RUNNER_OS" = "Windows" ]; then | |
| "build/desktop-dist/ASWIFT Viewer/ASWIFT Viewer.exe" | |
| else | |
| "build/desktop-dist/ASWIFT Viewer.app/Contents/MacOS/ASWIFT Viewer" | |
| fi | |
| - name: Simulate a downloaded Windows ZIP | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $assemblyRoots = @( | |
| "${{ matrix.package-path }}/_internal/pythonnet/runtime", | |
| "${{ matrix.package-path }}/_internal/pypalmsens/_libpalmsens/win" | |
| ) | |
| foreach ($root in $assemblyRoots) { | |
| Get-ChildItem -LiteralPath $root -Filter *.dll -Recurse | ForEach-Object { | |
| Set-Content -LiteralPath $_.FullName -Stream Zone.Identifier -Value "[ZoneTransfer]`nZoneId=3" | |
| } | |
| } | |
| - name: Smoke test downloaded Windows bundle | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| env: | |
| ASWIFT_VIEWER_IMPORT_CHECK: "1" | |
| run: | | |
| $process = Start-Process ` | |
| -FilePath "${{ matrix.package-path }}/ASWIFT Viewer.exe" ` | |
| -Wait ` | |
| -PassThru | |
| if ($process.ExitCode -ne 0) { | |
| throw "The downloaded-bundle import check failed with exit code $($process.ExitCode)" | |
| } | |
| $blocked = Get-ChildItem -LiteralPath "${{ matrix.package-path }}/_internal/pythonnet/runtime" -Filter *.dll -Recurse | | |
| Get-Item -Stream Zone.Identifier -ErrorAction SilentlyContinue | |
| if ($blocked) { | |
| throw "ASWIFT Viewer did not remove the Internet-zone marker from Python.Runtime.dll" | |
| } | |
| - name: Prepare macOS app bundle | |
| if: runner.os == 'macOS' | |
| shell: bash | |
| run: | | |
| chmod +x "${{ matrix.package-path }}/Contents/MacOS/ASWIFT Viewer" | |
| codesign --force --deep --sign - "${{ matrix.package-path }}" | |
| - name: Zip macOS app | |
| if: runner.os == 'macOS' | |
| shell: bash | |
| run: | | |
| ditto -c -k --keepParent --sequesterRsrc --rsrc "${{ matrix.package-path }}" "${{ matrix.asset-name }}.zip" | |
| - name: Zip Windows app | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Compress-Archive ` | |
| -Path (Join-Path "${{ matrix.package-path }}" "*") ` | |
| -DestinationPath "${{ matrix.asset-name }}.zip" | |
| - name: Prepare one-unzip Windows workflow artifact | |
| if: github.event_name == 'workflow_dispatch' && runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force build/workflow-artifact | Out-Null | |
| Copy-Item -LiteralPath "${{ matrix.package-path }}" -Destination build/workflow-artifact -Recurse | |
| - name: Upload one-unzip Windows workflow artifact | |
| if: github.event_name == 'workflow_dispatch' && runner.os == 'Windows' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.asset-name }} | |
| path: build/workflow-artifact | |
| if-no-files-found: error | |
| - name: Upload release ZIP | |
| if: github.event_name == 'release' || runner.os != 'Windows' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.asset-name }} | |
| path: ${{ matrix.artifact-path }} | |
| if-no-files-found: error | |
| attach-release-assets: | |
| name: Attach desktop applications to release | |
| if: github.event_name == 'release' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: ASWIFT-Viewer-* | |
| path: release-zips | |
| merge-multiple: true | |
| - name: Attach zips to GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| fail_on_unmatched_files: true | |
| files: | | |
| release-zips/*.zip | |
| release_assets/example_data.zip |