-
Notifications
You must be signed in to change notification settings - Fork 4
190 lines (178 loc) · 5.86 KB
/
build.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
name: build
on:
push:
branches: "*"
tags: "[0-9]+.[0-9]+.[0-9]+*"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
- x86_64-unknown-freebsd
continue-on-error: ${{ !startsWith(matrix.target, 'x86_64') }}
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.KENTIK_API_RUST_DEPLOY_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
DOCKER_OPTS="-v $SSH_AUTH_SOCK:/ssh-agent -e SSH_AUTH_SOCK=/ssh-agent"
echo DOCKER_OPTS="$DOCKER_OPTS" >> $GITHUB_ENV
- uses: docker/build-push-action@v4
with:
context: .github/workflows
file: .github/workflows/Dockerfile.${{ matrix.target }}
tags: local/cross:${{ matrix.target }}
push: false
env:
DOCKER_BUILDKIT: 1
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: kprobe-${{ matrix.target }}
path: target/${{ matrix.target }}/release/kprobe
needs: version
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/version
id: version
outputs:
version: ${{ steps.version.outputs.version }}
prerelease: ${{ steps.version.outputs.prerelease }}
publish: ${{ steps.version.outputs.publish }}
release: ${{ steps.version.outputs.release }}
bundle:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- armv7-unknown-linux-musleabihf
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/bundle
with:
binary: kprobe
name: kprobe
target: ${{ matrix.target }}
version: "v${{ needs.version.outputs.version }}"
- uses: ./.github/actions/bundle
with:
binary: kprobe
name: kprobe-ott
target: ${{ matrix.target }}
version: "v${{ needs.version.outputs.version }}"
if: ${{ contains(needs.version.outputs.publish, 'bundle') }}
needs: [build, version]
package:
runs-on: ubuntu-latest
strategy:
matrix:
format: [deb, rpm]
target:
- name: aarch64-unknown-linux-musl
arch: aarch64
- name: armv7-unknown-linux-musleabihf
arch: armv7
- name: x86_64-unknown-linux-musl
arch: x86_64
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/package
with:
artifact: kprobe-${{ matrix.target.name }}
version: ${{ needs.version.outputs.version }}
arch: ${{ matrix.target.arch }}
format: ${{ matrix.format }}
if: ${{ contains(needs.version.outputs.publish, 'package') }}
needs: [build, version]
publish-bundle:
runs-on: ubuntu-latest
strategy:
matrix:
bundle:
- kprobe
- kprobe-ott
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
- run: ls -lR
- uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.KENTIK_MACHINERY_APP_ID }}
private-key: ${{ secrets.KENTIK_MACHINERY_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: packages
id: token
- uses: ncipollo/release-action@v1
with:
token: ${{ steps.token.outputs.token }}
repo: packages
tag: "${{ matrix.bundle }}/v${{ needs.version.outputs.version }}"
prerelease: ${{ needs.version.outputs.prerelease }}
allowUpdates: false
removeArtifacts: true
artifacts: "${{ matrix.bundle }}_*.tgz/${{ matrix.bundle }}_*.tgz"
if: ${{ contains(needs.version.outputs.publish, 'bundle') }}
needs: [bundle, version]
publish-packages:
runs-on: ubuntu-latest
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- uses: actions/download-artifact@v4
with:
path: packages
- name: publish packages
run: |
ls -ltR packages
gem install package_cloud
case "${{ needs.version.outputs.prerelease }}" in
true) REPO="${{ github.event.repository.name }}-dev" ;;
false) REPO="${{ github.event.repository.name }}" ;;
esac
for deb in packages/*.deb/*.deb; do
package_cloud push kentik/$REPO/debian/jessie $deb
package_cloud push kentik/$REPO/debian/stretch $deb
package_cloud push kentik/$REPO/debian/buster $deb
package_cloud push kentik/$REPO/debian/bullseye $deb
package_cloud push kentik/$REPO/ubuntu/focal $deb
package_cloud push kentik/$REPO/ubuntu/bionic $deb
package_cloud push kentik/$REPO/ubuntu/jammy $deb
done
for rpm in packages/*.rpm/*.rpm; do
package_cloud push kentik/$REPO/el/7 $rpm
package_cloud push kentik/$REPO/el/8 $rpm
package_cloud push kentik/$REPO/el/9 $rpm
done
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
if: ${{ contains(needs.version.outputs.publish, 'package') }}
needs: [package, version]