-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (151 loc) · 5.04 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
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 }}
- run: |
mkdir -p target/${{ matrix.target }}/release
touch target/${{ matrix.target }}/release/kprobe
shell: bash
- uses: actions/upload-artifact@v4
with:
name: kprobe-${{ matrix.target }}
path: target/${{ matrix.target }}/release/kprobe
needs: version
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: version
run: |
git describe --always --tags > version
date -u +%Y%m%d%H%M%S >> version
case "${{ startsWith(github.ref, 'refs/tags') }}" in
true) VERSION=`sed -n 1p version` ;;
false) VERSION=`sed -n 2p version` ;;
esac
echo "::notice ::kprobe version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: version
path: version
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:
artifact: kprobe-${{ matrix.target }}
version: ${{ needs.version.outputs.version }}
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
continue-on-error: ${{ !startsWith(matrix.target, '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 }}
package: package.yml
needs: [build, 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 "${{ startsWith(github.ref, 'refs/tags') }}" in
# true) REPO="${{ github.event.repository.name }}" ;;
# false) REPO="${{ github.event.repository.name }}-dev" ;;
# 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 }}
# needs: [package, version]