forked from gogatekeeper/gatekeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 1.7 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
name: Build & Lint
# Only trigger the event on pull-requests
on: [pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
# Test the latest release of Go
strategy:
matrix:
go: ["1.22"]
steps:
# Setup the workflow to use the specific version of Go
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
id: go
# Checkout the repository
- name: Checkout
uses: actions/checkout@v2
# Verify downloaded dependencies
- name: Verify dependencies
run: go mod verify
- name: "Create k3d Cluster for E2E testing"
uses: AbsaOSS/[email protected]
with:
cluster-name: "testcluster"
args: >-
-p "8081:80@loadbalancer"
- name: "Run Tests"
run: |
k3d kubeconfig merge testcluster --kubeconfig-switch-context
KUBECONFIG=~/.k3d/kubeconfig-testcluster.yaml kubectl apply -f ./e2e/k8s/manifest.yml
go test -v -race -coverprofile=profile.cov ./...
# Run Go benchmarks
- name: Benchmark
run: |
go test -run=^$ -bench=. -benchmem ./...
# Run the linter as a separate job
golangci:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.22"]
steps:
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Checkout
uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
args: "--out-${NO_FUTURE}format colored-line-number --timeout=3m"
github-token: "${{ secrets.GITHUB_TOKEN }}"