-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 1.69 KB
/
Copy pathci.yml
File metadata and controls
58 lines (52 loc) · 1.69 KB
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
name: CI
on:
pull_request:
push:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- uses: golangci/golangci-lint-action@v9
with:
version: latest
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- run: go test -race ./...
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- name: Run coverage
run: |
go test -coverprofile=coverage.out ./pkg/api/... ./pkg/client/... ./pkg/scheduler/... ./pkg/controller/... ./pkg/kubelet/... ./pkg/store/...
TOTAL=$(go tool cover -func=coverage.out | grep ^total | awk '{print $3}')
echo "## Coverage: ${TOTAL}" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
go tool cover -func=coverage.out >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
benchmark:
name: run benchmarks
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
- name: Run benchmarks
run: |
go test -run=^$ -bench=. -benchmem ./... | tee bench.txt
- name: Post summary
run: |
echo "## Benchmark Results" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
grep -E "^(Benchmark|ok)" bench.txt >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"