-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (156 loc) · 7.18 KB
/
Copy pathrelease.yml
File metadata and controls
173 lines (156 loc) · 7.18 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
name: Release firmware
on:
pull_request:
push:
branches:
- "**"
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: windows-2022
env:
HOST_GCC_VERSION: "13.2.0"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/cache@v4
with:
path: _deps
key: hackylens-windows-${{ hashFiles('tools/bootstrap_deps.py') }}
- name: Install Python dependencies
run: python -m pip install pyserial
- name: Bootstrap pinned dependencies
run: python tools/bootstrap_deps.py
- name: Configure pinned host GCC
shell: pwsh
run: |
$hostGcc = Join-Path $PWD "_deps\host-gcc-$env:HOST_GCC_VERSION\mingw64\bin\gcc.exe"
if (-not (Test-Path -LiteralPath $hostGcc)) {
throw "bootstrap did not install pinned host GCC at $hostGcc"
}
$actualVersion = (& $hostGcc -dumpfullversion -dumpversion).Trim()
$actualMachine = (& $hostGcc -dumpmachine).Trim()
if ($actualVersion -ne $env:HOST_GCC_VERSION) {
throw "host GCC version mismatch: expected $env:HOST_GCC_VERSION, got $actualVersion"
}
if ($actualMachine -ne "x86_64-w64-mingw32") {
throw "host GCC target mismatch: expected x86_64-w64-mingw32, got $actualMachine"
}
Split-Path -Parent $hostGcc |
Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
"CC=$hostGcc" |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Validate source and environment
shell: pwsh
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
function Invoke-NativeChecked {
& $args[0] $args[1..($args.Count - 1)]
if ($LASTEXITCODE -ne 0) {
throw "native command failed ($LASTEXITCODE): $($args -join ' ')"
}
}
$diffRange = (Invoke-NativeChecked python tools/ci_diff_range.py).Trim()
if (-not $diffRange) {
throw "cannot determine explicit git diff range"
}
Invoke-NativeChecked git diff --check $diffRange
Invoke-NativeChecked python tools/check_docs.py
Invoke-NativeChecked python tools/check_app_manifests.py --scan-root tests/fixtures/app_manifests/valid --output build/app-manifests.json
Invoke-NativeChecked python tools/check_app_manifests.py --scan-root firmware/src/apps --output build/firmware-app-manifests.json
Invoke-NativeChecked python tools/check_app_sdk.py
Invoke-NativeChecked python tools/gen_app_composition.py --check
Invoke-NativeChecked python tools/check_app_composition.py
Invoke-NativeChecked python tools/check_arch.py
Invoke-NativeChecked python tools/check_capabilities.py
Invoke-NativeChecked python tools/check_board_ports.py --all
Invoke-NativeChecked python tools/check_env.py
Invoke-NativeChecked python tools/run_tests.py
- name: Build firmware without MicroPython and verify isolation
shell: pwsh
run: |
function Invoke-NativeChecked {
& $args[0] $args[1..($args.Count - 1)]
if ($LASTEXITCODE -ne 0) {
throw "native command failed ($LASTEXITCODE): $($args -join ' ')"
}
}
Invoke-NativeChecked python tools/build_firmware.py full --board huskylens-sen0305 --disable-app micropython
Invoke-NativeChecked python tools/check_arch.py --verify-build-profile micropython-disabled
Invoke-NativeChecked python tools/check_firmware_symbols.py build/huskylens-sen0305/sdk-full/hackylens_full --expect absent
Invoke-NativeChecked python tools/check_app_composition.py --verify-build huskylens-sen0305
- name: Build reduced camera compositions
shell: pwsh
run: |
function Invoke-NativeChecked {
& $args[0] $args[1..($args.Count - 1)]
if ($LASTEXITCODE -ne 0) {
throw "native command failed ($LASTEXITCODE): $($args -join ' ')"
}
}
Invoke-NativeChecked python tools/build_firmware.py full --board huskylens-sen0305 --disable-app micropython --disable-app camera --disable-app face-detect --disable-app apriltag --disable-app object-detect
Invoke-NativeChecked python tools/check_app_composition.py --verify-build huskylens-sen0305
Invoke-NativeChecked python tools/build_firmware.py full --board huskylens-sen0305 --disable-app micropython --disable-app camera --disable-app qr-camera --disable-app face-detect --disable-app apriltag --disable-app object-detect
Invoke-NativeChecked python tools/check_app_composition.py --verify-build huskylens-sen0305
- name: Build full firmware and verify feature symbols
shell: pwsh
run: |
function Invoke-NativeChecked {
& $args[0] $args[1..($args.Count - 1)]
if ($LASTEXITCODE -ne 0) {
throw "native command failed ($LASTEXITCODE): $($args -join ' ')"
}
}
Invoke-NativeChecked python tools/build_firmware.py full --board huskylens-sen0305
Invoke-NativeChecked python tools/check_arch.py --verify-build-profile full
Invoke-NativeChecked python tools/check_firmware_symbols.py build/huskylens-sen0305/sdk-full/hackylens_full --expect present
Invoke-NativeChecked python tools/check_app_composition.py --verify-build huskylens-sen0305
Invoke-NativeChecked python tools/check_resources.py
- name: Package release
if: github.event_name == 'push' && github.ref_type == 'tag'
shell: pwsh
run: |
function Invoke-NativeChecked {
& $args[0] $args[1..($args.Count - 1)]
if ($LASTEXITCODE -ne 0) {
throw "native command failed ($LASTEXITCODE): $($args -join ' ')"
}
}
Invoke-NativeChecked python tools/package_release.py --board huskylens-sen0305 --tag "${{ github.ref_name }}"
- name: Upload release payload
if: github.event_name == 'push' && github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
name: hackylens-${{ github.ref_name }}
path: dist/release/
if-no-files-found: error
release:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: validate
runs-on: windows-2022
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: hackylens-${{ github.ref_name }}
path: dist/release
- name: Create GitHub release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "${{ github.ref_name }}" dist/release/* --verify-tag --generate-notes --title "HackyLens ${{ github.ref_name }}"