Nuitka build #159
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python, then build with nuitka | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Nuitka build | |
on: | |
# RELEASE BUILD | |
release: | |
types: [ published ] | |
# MANUAL BUILD | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
# NIGHTLY BUILD | |
schedule: | |
- cron: "0 0 * * *" | |
permissions: | |
contents: read | |
jobs: | |
compute_update_channel: | |
outputs: | |
update_channel: ${{ steps.set_update_channel.outputs.update_channel }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set update channel | |
id: set_update_channel | |
env: | |
EVENT_NAME: ${{ github.event_name }} | |
PRERELEASE: ${{ github.event.release.prerelease || 'false' }} | |
run: | | |
if [[ "${{ env.EVENT_NAME }}" == "workflow_dispatch" || "${{ env.EVENT_NAME }}" == "schedule" ]]; then | |
echo "update_channel=dev" >> $GITHUB_OUTPUT | |
elif [[ "${{ env.EVENT_NAME }}" == "release" && "${{ env.PRERELEASE }}" == "true" ]]; then | |
echo "update_channel=beta" >> $GITHUB_OUTPUT | |
elif [[ "${{ env.EVENT_NAME }}" == "release" && "${{ env.PRERELEASE }}" == "false" ]]; then | |
echo "update_channel=stable" >> $GITHUB_OUTPUT | |
else | |
exit 1 | |
fi | |
build: | |
needs: [ 'compute_update_channel' ] | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
artifact_name: hector.bin | |
asset_name: hector-linux-amd64.bin | |
disable_console: false | |
- os: windows-latest | |
artifact_name: hector.exe | |
asset_name: hector-windows-amd64.exe | |
disable_console: true | |
- os: windows-latest | |
artifact_name: hector.exe | |
asset_name: hector-windows-amd64-debug.exe | |
disable_console: false | |
# - os: macos-latest | |
# artifact_name: hector.bin | |
# asset_name: hector-macos-arm64.bin | |
# - os: macos-13 | |
# artifact_name: hector.bin | |
# asset_name: hector-macos-amd64.bin | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup hector enviroment | |
id: setup-hector-enviroment | |
uses: ./.github/actions/setup-hector-enviroment | |
with: | |
python_version: "3.12" | |
- name: Install additional dependencies | |
run: | | |
pip install imageio | |
- name: Update build.json | |
uses: restackio/[email protected] | |
with: | |
file: data_files/build_info.json | |
fields: "{\"platform\": \"${{ runner.os }}\", \"asset_name\": \"${{matrix.asset_name}}\", \"channel\": \"${{needs.compute_update_channel.outputs.update_channel}}\"}" | |
- name: Build Executable | |
uses: Nuitka/Nuitka-Action@main | |
with: | |
nuitka-version: develop | |
script-name: hector.py | |
mode: onefile | |
enable-plugins: tk-inter | |
include-package: | | |
ttkthemes | |
cacheman | |
hunspell | |
include-package-data: | | |
ttkthemes | |
hunspell | |
include-module: | | |
fsspec.implementations.github | |
spacy.lexeme | |
include-data-dir: | | |
images=images | |
fonts=fonts | |
data_files=data_files | |
disable-console: ${{ matrix.disable_console }} | |
windows-icon-from-ico: images/hector-icon-white-edge.png | |
macos-app-icon: images/hector-icon-white-edge.png | |
#TODO #1: macos-create-app-bundle: true | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.asset_name }}.zip | |
path: | | |
build/*.bin | |
build/*.exe | |
build/*.app/**/* | |
compression-level: 0 #NUITKA ALREADY COMPRESSES | |
- name: Test binary | |
id: test-binary | |
uses: ./.github/actions/test-binary | |
with: | |
os: ${{matrix.os}} | |
path: build/${{matrix.artifact_name}} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload binary to release | |
if: | | |
github.event_name == 'release' | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: build/${{matrix.artifact_name}} | |
asset_name: ${{ matrix.asset_name }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
update_readme: | |
permissions: write-all | |
runs-on: 'ubuntu-latest' | |
needs: [ 'build' ] | |
if: | | |
github.event_name == 'release' | |
steps: | |
- name: Update download links | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
event-type: update-download-links |