-
Notifications
You must be signed in to change notification settings - Fork 4
157 lines (136 loc) · 4.58 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_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-directory
path: dist/*.whl
build_squashfs_image_x86_64:
runs-on: ubuntu-latest
needs: build_packages
env:
OTACLIENT_WHL: ${{ needs.build_packages.outputs.OTACLIENT_WHL }}
OTACLIENT_VERSION: ${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
DOCKER_IMAGE: otaclient-x86_64:${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
DOCKER_CONTAINER: otaclient-x86_64_v${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
SQUASHFS: otaclient-x86_64_v${{ needs.build_packages.outputs.OTACLIENT_VERSION }}.squashfs
steps:
- name: checkout
uses: actions/checkout@v4
- name: build squashfs image for x86_64
uses: ./.github/actions/build_squashfs_image
with:
platform: linux/amd64
platform_suffix: x86_64
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
path: dist/*.squashfs
build_squashfs_image_arm64:
runs-on: ubuntu-latest
needs: build_packages
env:
OTACLIENT_WHL: ${{ needs.build_packages.outputs.OTACLIENT_WHL }}
OTACLIENT_VERSION: ${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
DOCKER_IMAGE: otaclient-arm64:${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
DOCKER_CONTAINER: otaclient-arm64_v${{ needs.build_packages.outputs.OTACLIENT_VERSION }}
SQUASHFS: otaclient-arm64_v${{ needs.build_packages.outputs.OTACLIENT_VERSION }}.squashfs
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
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
path: dist/*.squashfs
calculate_checksum:
runs-on: ubuntu-latest
needs: [build_squashfs_image_x86_64, build_squashfs_image_arm64]
steps:
- name: checkout
uses: actions/checkout@v4
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: calculate checksum
run: |
for WHL in dist/*.whl; \
do \
sha256sum ${WHL} | sed -E "s@(\w+)\s+.*@sha256:\1@" > \
${WHL}.checksum; \
done
for SQUASHFS in dist/*.squashfs; \
do \
sha256sum ${SQUASHFS} | sed -E "s@(\w+)\s+.*@sha256:\1@" > \
${SQUASHFS}.checksum; \
done
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
path: dist/*.checksum
publish_release_artifacts:
runs-on: ubuntu-latest
needs: calculate_checksum
steps:
- name: checkout
uses: actions/checkout@v4
- name: download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: debug
run: |
ls -l dist