forked from trezor/trezor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
203 lines (185 loc) · 7.47 KB
/
release-emu.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
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
name: "[Release] emulators for trezor-user-env"
on:
push:
tags:
- 'core/v*'
- 'legacy/v*'
workflow_dispatch:
permissions:
id-token: write # for fetching the OIDC token
contents: read # for actions/checkout
jobs:
get_models:
name: Get models
runs-on: ubuntu-latest
outputs:
models: ${{ steps.get_models.outputs.models }}
version: ${{ steps.get_models.outputs.version }}
steps:
- name: Get models from releases.json
id: get_models
run: |
if [[ $GITHUB_REF == refs/tags/core/* ]]; then
VERSION=${GITHUB_REF#refs/tags/core/v}
MODELS=$(jq -r --arg version "$VERSION" '.firmware[$version] | join(",")' common/releases.json)
elif [[ $GITHUB_REF == refs/tags/legacy/* ]]; then
VERSION=${GITHUB_REF#refs/tags/legacy/v}
MODELS=$(jq -r --arg version "$VERSION" '.firmware[$version] | join(",")' common/releases.json)
fi
echo "models=$MODELS" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
core_emu:
if: startsWith(github.ref, 'refs/tags/core/v')
name: Build emu
needs: get_models
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
model: ${{ fromJson(needs.get_models.outputs.models) }}
coins: [universal]
type: [debuglink]
asan: [noasan]
exclude:
- type: normal
asan: asan
env:
TREZOR_MODEL: ${{ matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
ADDRESS_SANITIZER: "0"
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "poetry run make -C core build_bootloader_emu"
if: matrix.coins == 'universal'
- run: nix-shell --run "poetry run make -C core build_unix_frozen"
- run: cp core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-${{ matrix.model }}-v${{ needs.get_models.outputs.version }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
continue-on-error: true
- name: Upload emulator binaries
run: |
aws s3 mv core/build/unix/trezor-emu-core-${{ matrix.model }}-v${{ needs.get_models.outputs.version }} s3://data.trezor.io/dev/firmware/releases/emulators-new/${{ matrix.model}}/
- uses: actions/upload-artifact@v4
with:
name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }}
path: |
core/build/unix/trezor-emu-core*
core/build/bootloader_emu/bootloader.elf
retention-days: 7
core_emu_arm:
if: startsWith(github.ref, 'refs/tags/core/v')
name: Build core emu arm
needs: get_models
runs-on: ubuntu-latest-arm64
strategy:
fail-fast: false
matrix:
model: ${{ fromJson(needs.get_models.outputs.models) }}
coins: [universal]
type: [debuglink]
asan: [noasan]
exclude:
- type: normal
asan: asan
env:
TREZOR_MODEL: ${{ matrix.model }}
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
PYOPT: ${{ matrix.type == 'debuglink' && '0' || '1' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
LSAN_OPTIONS: "suppressions=../../asan_suppressions.txt"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "poetry run make -C core build_bootloader_emu"
if: matrix.coins == 'universal'
- run: nix-shell --run "poetry run make -C core build_unix_frozen"
- run: mv core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-${{ matrix.model }}-v${{ needs.get_models.outputs.version }}-arm
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
continue-on-error: true
- name: Upload emulator binaries
run: |
aws s3 cp core/build/unix/trezor-emu-core-${{ matrix.model }}-v${{ needs.get_models.outputs.version }}-arm s3://data.trezor.io/dev/firmware/releases/emulators-new/${{ matrix.model}}/
- uses: actions/upload-artifact@v4
with:
name: core-emu-${{ matrix.model }}-${{ matrix.coins }}-${{ matrix.type }}-${{ matrix.asan }}
path: |
core/build/unix/trezor-emu-core*
core/build/bootloader_emu/bootloader.elf
retention-days: 7
legacy_emu:
if: startsWith(github.ref, 'refs/tags/legacy/v')
name: Build legacy emu
needs: get_models
runs-on: ubuntu-latest
strategy:
matrix:
coins: [universal]
type: [debuglink]
arch: [x86_64]
asan: [noasan]
env:
EMULATOR: 1
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
DEBUG_LINK: ${{ matrix.type == 'debuglink' && '1' || '0' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "poetry run legacy/script/cibuild"
- run: mv legacy/firmware/trezor.elf legacy/firmware/trezor-emu-legacy-T1B1-v${{ needs.get_models.outputs.version }}
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
continue-on-error: true
- name: Upload emulator binaries
run: |
aws s3 cp legacy/firmware/trezor-emu-legacy-T1B1-v${{ needs.get_models.outputs.version }} s3://data.trezor.io/dev/firmware/releases/emulators-new/T1B1/
legacy_emu_arm:
if: startsWith(github.ref, 'refs/tags/legacy/v')
name: Build legacy emu arm
needs: get_models
runs-on: ubuntu-latest-arm64
strategy:
matrix:
coins: [universal]
type: [debuglink]
asan: [noasan]
env:
EMULATOR: 1
BITCOIN_ONLY: ${{ matrix.coins == 'universal' && '0' || '1' }}
DEBUG_LINK: ${{ matrix.type == 'debuglink' && '1' || '0' }}
ADDRESS_SANITIZER: ${{ matrix.asan == 'asan' && '1' || '0' }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/environment
- run: nix-shell --run "poetry run legacy/script/cibuild"
- run: mv legacy/firmware/trezor.elf legacy/firmware/trezor-emu-legacy-T1B1-v${{ needs.get_models.outputs.version }}-arm
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::538326561891:role/gh_actions_deploy_dev_firmware_data
aws-region: eu-west-1
continue-on-error: true
- name: Upload emulator binaries
run: |
aws s3 cp legacy/firmware/trezor-emu-legacy-T1B1-v${{ needs.get_models.outputs.version }}-arm s3://data.trezor.io/dev/firmware/releases/emulators-new/T1B1/