-
Notifications
You must be signed in to change notification settings - Fork 4
157 lines (136 loc) · 4.82 KB
/
release.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
name: Release CI
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
# NOTE(20241016): this is a workaround for PR with head
# updated by gen_requirements_txt workflow
- review_requested
- assigned
# allow manually triggering the build
workflow_dispatch:
jobs:
build_python_packages:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
OTACLIENT_WHL: ${{ steps.set_env.outputs.OTACLIENT_WHL }}
OTACLIENT_VERSION: ${{ steps.set_env.outputs.OTACLIENT_VERSION }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
# use the minimum py ver we support to generate the wheel
python-version: 3.8
- name: install build deps
run: |
python -m pip install -U pip
python -m pip install -U hatch
- name: build otaclient package
run: |
hatch build -t wheel
- name: set environment variables
id: set_env
run: |
OTACLIENT_WHL=$(basename $(ls dist/otaclient-*.whl))
OTACLIENT_VERSION=$(echo $OTACLIENT_WHL | sed -E 's/otaclient-([0-9]+\.[0-9]+(\.[0-9]+)?).*\.whl/\1/')
echo "::set-output name=OTACLIENT_WHL::${OTACLIENT_WHL}"
echo "::set-output name=OTACLIENT_VERSION::${OTACLIENT_VERSION}"
- name: build otaclient service API python package
run: |
pushd proto
hatch build -t wheel
popd
cp proto/dist/*.whl dist/
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-python-packages
path: dist/*.whl
build_squashfs_image_amd64:
runs-on: ubuntu-latest
needs: build_python_packages
steps:
- name: checkout
uses: actions/checkout@v4
- name: build squashfs image for amd64
uses: ./.github/actions/build_squashfs_image
with:
platform: linux/amd64
platform_suffix: amd64
base_image: ubuntu:22.04
whl: ${{ needs.build_python_packages.outputs.OTACLIENT_WHL }}
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-amd64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: build paches
uses: ./.github/actions/build_patches
with:
platform_suffix: amd64
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-amd64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-squashfs_amd64
path: dist/*.squashfs
build_squashfs_image_arm64:
runs-on: ubuntu-latest
needs: build_python_packages
steps:
- name: checkout
uses: actions/checkout@v4
- name: build squashfs image for arm64
uses: ./.github/actions/build_squashfs_image
with:
platform: linux/arm64
platform_suffix: arm64
base_image: arm64v8/ubuntu:22.04
whl: ${{ needs.build_python_packages.outputs.OTACLIENT_WHL }}
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-arm64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: build paches
uses: ./.github/actions/build_patches
with:
platform_suffix: arm64
version: ${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}
squashfs: dist/ota-client-arm64-v${{ needs.build_python_packages.outputs.OTACLIENT_VERSION }}.squashfs
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-squashfs_arm64
path: |
dist/*.squashfs
dist/*.patch
post_build:
runs-on: ubuntu-latest
needs: [build_python_packages, build_squashfs_image_amd64, build_squashfs_image_arm64]
steps:
- name: download python packages artifact
uses: actions/download-artifact@v4
with:
name: artifacts-python-packages
path: dist
- name: download squashfs amd64 artifact
uses: actions/download-artifact@v4
with:
name: artifacts-squashfs_amd64
path: dist
- name: download squashfs arm64 artifact
uses: actions/download-artifact@v4
with:
name: artifacts-squashfs_arm64
path: dist
- name: calculate checksum
run: |
for FILE in dist/*.{whl,squashfs,patch}; do
sha256sum ${FILE} | sed -E "s@(\w+)\s+.*@sha256:\1@" > ${FILE}.checksum
done
- name: debug
run: |
ls -l dist