forked from eclipse-zenoh/zenoh-c
-
Notifications
You must be signed in to change notification settings - Fork 0
270 lines (245 loc) · 9.96 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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#
# Copyright (c) 2022 ZettaScale Technology
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# ZettaScale Zenoh Team, <[email protected]>
#
name: Release
on:
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:
inputs:
live-run:
type: boolean
description: Live-run
required: false
version:
type: string
description: Release number
required: false
zenoh-version:
type: string
description: Release number of Zenoh
required: false
branch:
type: string
description: Release branch
required: false
jobs:
tag:
name: Branch, Bump & tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.create-release-branch.outputs.version }}
branch: ${{ steps.create-release-branch.outputs.branch }}
steps:
- id: create-release-branch
uses: eclipse-zenoh/ci/create-release-branch@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
# NOTE(fuzzypixelz): When the version is undefined (e.g. on schedule
# events) we cannot use git-describe as CMake doesn't support it.
# However, we still need some placeholder version to test that the
# version can be reliably bumped.
version: ${{ inputs.version || '0.0.0' }}
branch: ${{ inputs.branch }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
- name: Checkout this repository
uses: actions/checkout@v4
with:
ref: ${{ steps.create-release-branch.outputs.branch }}
token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
- name: Bump and tag project
run: bash ci/scripts/bump-and-tag.bash
env:
LIVE_RUN: ${{ inputs.live-run || false }}
VERSION: ${{ steps.create-release-branch.outputs.version }}
BUMP_DEPS_VERSION: ${{ inputs.zenoh-version }}
BUMP_DEPS_PATTERN: ${{ inputs.zenoh-version && 'zenoh.*' || '' }}
BUMP_DEPS_BRANCH: ${{ inputs.zenoh-version && format('release/{0}', inputs.zenoh-version) || '' }}
GIT_USER_NAME: eclipse-zenoh-bot
GIT_USER_EMAIL: [email protected]
build:
name: Build packages
runs-on: ${{ matrix.build.os }}
strategy:
fail-fast: false
matrix:
build:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04 }
- { target: arm-unknown-linux-gnueabi, os: ubuntu-20.04 }
- { target: arm-unknown-linux-gnueabihf, os: ubuntu-20.04 }
- { target: armv7-unknown-linux-gnueabihf, os: macos-14 }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: aarch64-unknown-linux-musl, os: ubuntu-20.04 }
- { target: x86_64-apple-darwin, os: macos-14 }
- { target: aarch64-apple-darwin, os: macos-14 }
- { target: x86_64-pc-windows-msvc, os: windows-2019 }
- { target: x86_64-pc-windows-gnu, os: ubuntu-20.04 }
needs: tag
steps:
- name: Checkout this repository
uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.branch }}
token: ${{ secrets.BOT_TOKEN_WORKFLOW }}
- name: Add rust toolchain
run: |
rustup target add ${{ matrix.build.target }}
- name: Install build deps
if: ${{ matrix.build.target == 'x86_64-unknown-linux-musl'}}
run: |
sudo apt-get install -y musl-tools
wget https://musl.cc/x86_64-linux-musl-cross.tgz
tar xvfz x86_64-linux-musl-cross.tgz
echo "$(readlink -f x86_64-linux-musl-cross)/bin" >> "$GITHUB_PATH"
- name: Install build deps
if: ${{ matrix.build.target == 'arm-unknown-linux-gnueabi'}}
run: sudo apt-get install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
- name: Install build deps
if: ${{ matrix.build.target == 'arm-unknown-linux-gnueabihf'}}
run: sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
- name: Install build deps
if: ${{ matrix.build.target == 'armv7-unknown-linux-gnueabihf'}}
run: |
brew install -f messense/macos-cross-toolchains/armv7-unknown-linux-gnueabihf
brew install dpkg
brew install rpm
- name: Install build deps
if: ${{ matrix.build.target == 'aarch64-unknown-linux-gnu'}}
run: sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install build deps
if: ${{ matrix.build.target == 'aarch64-unknown-linux-musl'}}
run: |
wget https://musl.cc/aarch64-linux-musl-cross.tgz
tar xvfz aarch64-linux-musl-cross.tgz
echo "$(readlink -f aarch64-linux-musl-cross)/bin" >> "$GITHUB_PATH"
- name: Install build deps
if: ${{ matrix.build.target == 'x86_64-pc-windows-gnu'}}
run: |
sudo apt-get install -y mingw-w64
- name: Compute package name
id: compute-package-name
shell: bash
run: |
if [[ "${{ matrix.build.target }}" =~ "armv7" ]]; then
echo "value=zenohc-armv7" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.build.target }}" =~ "musl" ]]; then
echo "value=zenohc-musl" >> $GITHUB_OUTPUT
else
echo "value=zenohc" >> $GITHUB_OUTPUT
fi
- name: Build standalone
id: build
shell: bash
run: |
toolchain_file=$(readlink -f ci/toolchains/TC-${{ matrix.build.target }}.cmake)
mkdir -p build && cd build
cmake .. -DCPACK_PACKAGE_NAME=${{ steps.compute-package-name.outputs.value }} -DZENOHC_CUSTOM_TARGET=${{ matrix.build.target }} -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DZENOHC_BUILD_WITH_UNSTABLE_API=ON -DZENOHC_BUILD_WITH_SHARED_MEMORY=ON
cmake --build . --config Release
cpack -C Release -G ZIP
- name: Build distro packages (DEB/RPM)
id: build-distro-packages
if: ${{ contains(matrix.build.target, 'linux') }}
run: |
cd build
cpack -G DEB
cpack -G RPM
- name: Prepare standalone archives
shell: bash
run: |
zip_filename=$(readlink -f ./build/packages/*.zip)
mv ${zip_filename} zenoh-c-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-standalone.zip
- name: Zip deb/rpm archives
shell: bash
if: ${{ contains(matrix.build.target, 'linux') }}
run: |
zip -9 -j libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-debian.zip ./build/packages/*.deb
zip -9 -j libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-rpm.zip ./build/packages/*.rpm
- name: Upload standalone archive
uses: actions/upload-artifact@v4
with:
# Publish the artifact with zenoh-c (repo name) so it can be used by homebrew action
name: zenoh-c-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-standalone.zip
path: zenoh-c-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-standalone.zip
- name: Upload DEB archive
if: ${{ contains(matrix.build.target, 'linux') }}
uses: actions/upload-artifact@v4
with:
name: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-debian.zip
path: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-debian.zip
- name: Upload RPM archive
if: ${{ contains(matrix.build.target, 'linux') }}
uses: actions/upload-artifact@v4
with:
name: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-rpm.zip
path: libzenohc-${{ inputs.version || '0.0.0' }}-${{ matrix.build.target }}-rpm.zip
debian:
name: Publish Debian packages
needs: [tag, build]
uses: eclipse-zenoh/ci/.github/workflows/release-crates-debian.yml@main
with:
no-build: true
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
repo: ${{ github.repository }}
branch: ${{ needs.tag.outputs.branch }}
installation-test: false
secrets: inherit
homebrew:
name: Publish Homebrew formulae
needs: [tag, build]
uses: eclipse-zenoh/ci/.github/workflows/release-crates-homebrew.yml@main
with:
no-build: true
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
branch: ${{ needs.tag.outputs.branch }}
artifact-patterns: |
^libzenohc\.dylib$
^include$
formulae: |
libzenohc
secrets: inherit
eclipse:
name: Publish artifacts to Eclipse downloads
needs: [tag, build]
uses: eclipse-zenoh/ci/.github/workflows/release-crates-eclipse.yml@main
with:
no-build: true
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
repo: ${{ github.repository }}
branch: ${{ needs.tag.outputs.branch }}
artifact-patterns: |
^libzenohc\.(dylib|so)$
^zenohc\.dll$
^include$
name: zenoh-c
secrets: inherit
github:
name: Publish artifacts to GitHub Releases
needs: [tag, build]
uses: eclipse-zenoh/ci/.github/workflows/release-crates-github.yml@main
with:
no-build: true
live-run: ${{ inputs.live-run || false }}
version: ${{ needs.tag.outputs.version }}
repo: ${{ github.repository }}
branch: ${{ needs.tag.outputs.branch }}
artifact-patterns: |
^libzenohc\.(dylib|so)$
^zenohc\.dll$
^include$
secrets: inherit