-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (145 loc) · 5.04 KB
/
nuitka-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# 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