-
Notifications
You must be signed in to change notification settings - Fork 66
112 lines (92 loc) · 2.75 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
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
goreleaser:
name: Goreleaer Dry
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Install llvm
run: sudo apt-get install llvm libelf-dev
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Initialize and update libbpf submodule
run: git submodule init && git submodule update
- name: Build eBPF
run: make bpf
- name: Set Env
run: echo "BPF_OUT=$(pwd)/dist" >> $GITHUB_ENV
- name: Validate
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: check
- name: Dry Run
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist --skip-validate --skip-publish
env:
# BPF_OUT: ${{ env.GITHUB_WORKSPACE }}/dist
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
go-build-test:
name: Go Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Install llvm
run: sudo apt-get install llvm libelf-dev
- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2
- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Initialize and update libbpf submodule
run: git submodule init && git submodule update
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make bpf test vet lint
- name: Format
run: |
make format
git diff --exit-code
- name: Build
run: make build
- name: Archive generatated artifacts
uses: actions/upload-artifact@v2
with:
name: parca-agent-dist
if-no-files-found: error
path: |
dist
!dist/libbpf
!dist/*.txt