Skip to content

Build Python Executable #16

Build Python Executable

Build Python Executable #16

Workflow file for this run

# This workflow builds a standalone Python executable for Windows using Nuitka
# and attaches it to a new GitHub Release.
name: Build Python Executable with Nuitka
on:
release:
types: [created] # This workflow runs automatically whenever a new release is published.
jobs:
build:
runs-on: windows-latest
permissions:
contents: write # Required to write the release asset.
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install Dependencies
run: pip install -r requirements.txt
- name: Build with Nuitka
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
# --- CORRECTED AND OPTIMIZED CONFIGURATION ---
# 1. EXPLICITLY SET THE C COMPILER
# This is the most critical fix. It ensures Nuitka finds and uses the MSVC compiler.
msvc-version: 'latest'
# 2. ENABLE PLUGINS
# Instrument control apps often use Qt and NumPy. These plugins are essential
# for Nuitka to find all necessary files and hidden imports.
enable-plugins: "qt-binding,numpy"
# Pass Nuitka command-line arguments directly with the script name.
script-name: PICA_Launcher_V4.py --onefile
# 'disable-console' is the correct input for the action to hide the command window.
disable-console: true
# This is a valid action input. Ensure the path is correct from the repo root.
windows-icon-from-ico: _assets/LOGO/UGC_DAE_CSR.ico
# For including data directories, the format is source=destination.
include-data-dir: |
_assets=_assets
Delta_mode=Delta_mode
Keithley_2400=Keithley_2400
Keithley_2400_Keithley_2182=Keithley_2400_Keithley_2182
Keithley_6517B=Keithley_6517B
LCR_Keysight_E4980A=LCR_Keysight_E4980A
Lakeshore_350_340=Lakeshore_350_340
Lock_in_amplifier=Lock_in_amplifier
Utilities=Utilities
- name: Upload Executable to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
# Nuitka automatically puts the onefile executable in a '.dist' folder
# e.g., PICA_Launcher_V4.dist/PICA_Launcher_V4.exe
file: PICA_Launcher_V4.dist/PICA_Launcher_V4.exe
asset_name: PICA_Launcher-Windows-${{ github.ref_name }}.exe
tag: ${{ github.ref }}
overwrite: true