Skip to content

windows Update linux app image to use 16.11.0. #62

windows Update linux app image to use 16.11.0.

windows Update linux app image to use 16.11.0. #62

Workflow file for this run

name: Build
run-name: windows ${{ github.event.pull_request.title }} ${{ github.event.head_commit.message }}
# see https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# installer is always built with a specific version of Python
os: [windows-2019]
python-version: ["3.12"]
env:
# define environment and configuration variables here.
# product_name must be NionSwift-{version_major}.{version_minor}
# it will be the name of the installed application.
# product_identifier is only used to name the build directory
# version_overall is used to construct the installed subdirectory (NionSwift 16)
# this is seen by end users.
# version major/minor/patch are used to construct the installed file name.
# this is not typically seen by end users. patch is currently unused.
# qt_version, qt_platform specify which version of Qt to use.
# these should be regularly updated to the latest usable version.
# python_version specifies which version of Python to use.
# this should be regularly updated to the latest usable version.
product_name: NionSwift-16
product_identifier: Nion_Swift_16_11
version_overall: 16
version_major: 16
version_minor: 11
version_patch: 0
qt_version: 6.7.2
qt_platform: msvc2019_64
python_version: 3.12.4
numpy_version: 1.26.4
tool_source_version: 0.4.24
steps:
- uses: actions/checkout@v4
# first set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
# next build the installer (it's a disk image with the application).
- name: Build
run: |
# the first step in the build process is to create a virtual environment to be
# used by the installation scripts and activate it. also update pip.
mkdir venv
python -m venv venv/installer
venv\installer\Scripts\activate
python -m pip install --upgrade pip
# next, install Qt using the aqt tool. only install the required Qt modules.
# then configure the Qt6_DIR variable (used by cmake), install numpy (used by
# cmake). then git clone the tool source code. finally run cmake.
pip install aqtinstall
mkdir Qt
echo "Installing Qt ${env:qt_version} (${env:qt_platform})"
python -m aqt install-qt --outputdir Qt windows desktop ${env:qt_version} win64_${env:qt_platform}
# see https://bugreports.qt.io/browse/QTBUG-97615
$ENV:Qt6_DIR = (Get-Item -Path ".\").FullName + "\Qt\${env:qt_version}\${env:qt_platform}\lib\cmake\Qt6"
$ENV:QT_ADDITIONAL_PACKAGES_PREFIX_PATH = (Get-Item -Path ".\").FullName + "\Qt\${env:qt_version}\${env:qt_platform}"
pip install numpy==${env:numpy_version}
pip install numpy
git clone https://github.com/nion-software/nionswift-tool.git --branch ${env:tool_source_version} --single-branch
pushd nionswift-tool/launcher
$PYTHON_EXEC = python -c "import sys; print(sys.executable, end='')"
cmake CMakeLists.txt -DPython3_EXECUTABLE="$PYTHON_EXEC" -DUSE_CONSOLE=OFF
cmake --build . --config Release
popd
# now download and install a fresh Python from python.org.
# notice that the existing Python is first uninstalled. then the new one is installed. running this on a
# local system will uninstall any existing Python installation.
# next run the Python installer to install it into the application directory.
# finally, install wheel, create a new environment (python-nionswift), and activate the environment.
$PYTHON_FILE = "python-${env:python_version}-amd64"
$exePath = Join-Path (Get-Location).path "$PYTHON_FILE.exe"
(New-Object Net.WebClient).DownloadFile("https://www.python.org/ftp/python/${env:python_version}/$PYTHON_FILE.exe", $exePath)
cmd /c start /wait "$PYTHON_FILE.exe" /quiet /uninstall
$PYTHON_312_DIR = Join-Path (Get-Location).path "$PYTHON_FILE"
cmd /c start /wait "$PYTHON_FILE.exe" /quiet TargetDir=$PYTHON_312_DIR AssociateFiles=0 Shortcuts=0 Include_doc=0 Include_dev=1 Include_launcher=0 InstallLauncherAllUsers=0 Include_tcltk=1 Include_test=0 Include_tools=0
& ".\$PYTHON_FILE\python.exe" -m pip install wheel
& ".\$PYTHON_FILE\python.exe" -m venv python-nionswift
.\python-nionswift\Scripts\activate
# install latest version of nionswift (UNUSED EXCEPT FOR DEBUGGING)
# git clone https://github.com/nion-software/nionutils.git
# git clone https://github.com/nion-software/niondata.git
# git clone https://github.com/nion-software/nionui.git
# git clone https://github.com/nion-software/nionswift.git
# git clone https://github.com/nion-software/nionswift-io.git
# git clone https://github.com/nion-software/nionswift-instrumentation-kit.git
# git clone https://github.com/nion-software/eels-analysis.git nionswift-eels-analysis
# git clone https://github.com/nion-software/nionswift-usim.git
# python -m pip install ./nionutils
# python -m pip install ./niondata
# python -m pip install ./nionui
# python -m pip install ./nionswift
# python -m pip install ./nionswift-instrumentation-kit
# python -m pip install ./nionswift-eels-analysis
# python -m pip install ./nionswift-usim
# install the latest released version in the activated Python environment.
python -m pip install nionswift nionswift-eels-analysis nionswift-usim
# deactivate the environment since everything is installed.
deactivate
# configure the environment by copying the built application, the toolconfig.toml file, application icon,
# splash screen, the Python files, and site-packages to the final directory.
mkdir ".\dist\${env:product_identifier}"
Copy-Item -Recurse -Path .\nionswift-tool\launcher\build\Release\* -Destination ".\dist\${env:product_identifier}"
Copy-Item .\win_toolconfig.toml -Destination ".\dist\${env:product_identifier}\toolconfig.toml"
Copy-Item .\nionswift-tool\launcher\Artwork\splash_600x400.png -Destination ".\dist\${env:product_identifier}\splash.png"
Move-Item -Force ".\dist\${env:product_identifier}\NionSwiftLauncher.exe" ".\dist\${env:product_identifier}\${env:product_identifier}.exe"
Copy-Item -Recurse -Path "$PYTHON_312_DIR\*" -Destination ".\dist\${env:product_identifier}"
Copy-Item -Recurse -Path .\python-nionswift\Lib\site-packages -Destination ".\dist\${env:product_identifier}\python-nionswift\Lib\site-packages"
# use CMake + wix extensions to build an installer.
pushd wix
cmake .\CMakeLists.txt -DVERSION_OVERALL="${env:version_overall}" -DVERSION_MAJOR="${env:version_major}" -DVERSION_MINOR="${env:version_minor}" -DVERSION_PATCH="${env:version_patch}"
cpack
popd
Compress-Archive ".\dist\${env:product_identifier}" "${{env.product_name}}.zip"
# finally, upload the artifacts of the build so that they are available on the GitHub action page.
- name: Upload Product Zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.product_name }}.zip
path: ${{ env.product_name }}.zip
- name: Upload Product MSI
uses: actions/upload-artifact@v3
with:
name: ${{ env.product_name }}.msi
path: wix\${{ env.product_name }}.${{ env.version_minor }}.msi