-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (183 loc) · 7 KB
/
release.yml
File metadata and controls
208 lines (183 loc) · 7 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Create Release (multi-platform)
on:
push:
tags:
- 'v*' # e.g. v1.8.10
permissions:
contents: write # needed for gh-release upload
jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
py: '3.12.10'
sep: ';'
icon_arg: '--icon src/assets/logo-icon.ico --windowed'
artifact: telemetry-windows.zip
- os: macos-latest
py: '3.12.10'
sep: ':'
icon_arg: '--windowed' # or: --icon src/assets/app.icns --windowed
artifact: telemetry-macos.zip
- os: ubuntu-latest
py: '3.12.10'
sep: ':'
icon_arg: ''
artifact: telemetry-linux.zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Install dependencies
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; else pip install -r requirement.txt; fi
pip install pyinstaller==6.16.0 tufup
- name: Build executable (PyInstaller --onedir)
shell: bash
run: |
set -euo pipefail
COLLECT_FLAGS=(
--collect-binaries sklearn
--collect-binaries scipy
--collect-binaries numpy
--copy-metadata scikit-learn
--copy-metadata scipy
--copy-metadata numpy
--exclude-module sklearn.externals.array_api_compat.torch
--exclude-module pyqtgraph.opengl
)
pyinstaller src/main_app.py \
--name telemetry \
--noconfirm \
--onedir --noupx \
--distpath dist \
${{ matrix.icon_arg }} \
--additional-hooks-dir src/hooks \
--hidden-import pyqtgraph \
--add-data "src/gui_files${{ matrix.sep }}gui_files/" \
--add-data "src/learning_datasets${{ matrix.sep }}learning_datasets/" \
--add-data "src/updater${{ matrix.sep }}updater/" \
--add-data "src/updater/metadata${{ matrix.sep }}updater/metadata/" \
--add-data "src/__init__.py${{ matrix.sep }}." \
--add-data "src/buffer_data.py${{ matrix.sep }}." \
--add-data "src/central_logger.py${{ matrix.sep }}." \
--add-data "src/csv_handler.py${{ matrix.sep }}." \
--add-data "src/data_display.py${{ matrix.sep }}." \
--add-data "src/data_processor.py${{ matrix.sep }}." \
--add-data "src/extra_calculations.py${{ matrix.sep }}." \
--add-data "src/key_name_definitions.py${{ matrix.sep }}." \
--add-data "src/serial_reader.py${{ matrix.sep }}." \
--add-data "src/telemetry_application.py${{ matrix.sep }}." \
--add-data "src/unit_conversion.py${{ matrix.sep }}." \
--add-data "src/Version.py${{ matrix.sep }}." \
--add-data "src/simulation.py${{ matrix.sep }}." \
"${COLLECT_FLAGS[@]}"
- name: Package onedir as zip
shell: bash
run: |
set -euo pipefail
mkdir -p out
# dist/telemetry/ exists on all OS with --onedir
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a -tzip "out/${{ matrix.artifact }}" "./dist/telemetry/*" >/dev/null
else
(cd dist && zip -qr "../out/${{ matrix.artifact }}" telemetry)
fi
ls -la out
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: built-${{ matrix.os }}
path: out/*
if-no-files-found: error
tuf_release:
name: Sign & Release (TUF + assets)
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout (keys, scripts, build_tuf_repo.py)
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12.10'
- name: Install tufup
run: pip install tufup
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Prepare bundles for TUF (extract zips)
shell: bash
run: |
set -euo pipefail
ls -la artifacts
mkdir -p bundles/windows bundles/macos bundles/linux
extract () {
src="$1"; dst="$2"
case "$src" in
*.zip) unzip -q "$src" -d "$dst" ;;
*.tar.gz|*.tgz) tar -xzf "$src" -C "$dst" ;;
*) echo "Unsupported archive: $src"; exit 2 ;;
esac
}
extract artifacts/telemetry-windows.zip bundles/windows
extract artifacts/telemetry-macos.zip bundles/macos
extract artifacts/telemetry-linux.zip bundles/linux
echo "Bundle contents:"
find bundles -maxdepth 2 -type f | sed 's/^/ /'
- name: Write signing keys (from secrets or fallback)
env:
TUF_KEY_TARGETS_JSON_B64: ${{ secrets.TUF_KEY_TARGETS_JSON_B64 }}
TUF_KEY_SNAPSHOT_JSON_B64: ${{ secrets.TUF_KEY_SNAPSHOT_JSON_B64 }}
TUF_KEY_TIMESTAMP_JSON_B64: ${{ secrets.TUF_KEY_TIMESTAMP_JSON_B64 }}
TUF_KEY_TARGETS_JSON: ${{ secrets.TUF_KEY_TARGETS_JSON }}
TUF_KEY_SNAPSHOT_JSON: ${{ secrets.TUF_KEY_SNAPSHOT_JSON }}
TUF_KEY_TIMESTAMP_JSON: ${{ secrets.TUF_KEY_TIMESTAMP_JSON }}
run: |
set -euo pipefail
python scripts/prepare_keys.py --from-dir scripts/exported_keys --keys-dir src/updater/keys
- name: Validate key JSON
shell: bash
run: |
set -euo pipefail
python scripts/validate_keys_json.py \
src/updater/keys/targets \
src/updater/keys/snapshot \
src/updater/keys/timestamp
- name: Build TUF repo (creates release/metadata + release/targets/*.tar.gz)
shell: bash
env:
TAG: ${{ github.ref_name }} # e.g., v1.8.10
run: |
set -euo pipefail
echo "VERSION=${TAG#v}"
python scripts/build_tuf_repo.py
- name: Show release payload
shell: bash
run: |
echo "::group::Metadata"; ls -la release/metadata; echo "::endgroup::"
echo "::group::Targets"; ls -la release/targets; echo "::endgroup::"
- name: Create GitHub Release (TUF metadata + targets)
uses: softprops/action-gh-release@v2
with:
files: |
release/metadata/root.json
release/metadata/targets.json
release/metadata/snapshot.json
release/metadata/timestamp.json
release/targets/*
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}