-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (92 loc) · 3.77 KB
/
build.yaml
File metadata and controls
112 lines (92 loc) · 3.77 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
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: Run tests with coverage
run-name: Validate ${{github.ref_name}} by @${{ github.actor }}
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Validate code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24.*'
- name: Check Format
run: gofmt -d ./
- name: Verify dependencies
run: go mod verify
- name: Install dependencies
run: go mod vendor
- name: Run go vet
run: go vet ./...
- name: Build
run: go build -v ./...
- name: Lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1.0
- name: Create Controller Kind Cluster
uses: helm/kind-action@main
with:
cluster_name: 'nexus-controller'
cloud_provider: true
- name: Create Shard Kind Cluster
uses: helm/kind-action@main
with:
cluster_name: 'nexus-shard-0'
- name: Export kubeconfigs and install CRD
run: |
mkdir -p ./test-resources/kubecfg/shards
kind export kubeconfig --name nexus-controller --kubeconfig ./test-resources/kubecfg/controller
kind export kubeconfig --name nexus-shard-0 --kubeconfig ./test-resources/kubecfg/shards/kind-nexus-shard-0.kubeconfig
chmod 777 ./test-resources/kubecfg/controller
chmod 777 ./test-resources/kubecfg/shards/kind-nexus-shard-0.kubeconfig
helm install --kube-context kind-nexus-controller --namespace nexus --create-namespace --version v1.0.0 nexus-crd oci://ghcr.io/sneaksanddata/helm/nexus-crd
helm install --kube-context kind-nexus-shard-0 --namespace nexus --create-namespace --version v1.0.0 nexus-crd oci://ghcr.io/sneaksanddata/helm/nexus-crd
- name: Test
env:
NEXUS__ALIAS: kind-nexus-controller
NEXUS__FAILURE_RATE_BASE_DELAY: 30ms
NEXUS__FAILURE_RATE_MAX_DELAY: 5s
NEXUS__RATE_LIMIT_ELEMENTS_PER_SECOND: 50
NEXUS__RATE_LIMIT_ELEMENTS_BURST: 300
NEXUS__WORKERS: 10
NEXUS__CONTROLLER_NAMESPACE: nexus
NEXUS__LOG_LEVEL: DEBUG
NEXUS__SHARD_CONFIG_PATH: ./test-resources/kubecfg/shards
NEXUS__CONTROLLER_CONFIG_PATH: ./test-resources/kubecfg/controller
APPLICATION_ENVIRONMENT: local
run: go test ./... -coverprofile=./cover.out -covermode=atomic -coverpkg=./...
- name: Visualise Coverage
if: ${{ github.ref != 'refs/heads/main' && always() }}
run: go tool cover -html=cover.out -o=cover.html
- name: Upload Coverage
if: ${{ github.ref != 'refs/heads/main' && always() }}
uses: actions/upload-artifact@v4
with:
name: coverage
path: cover.html
retention-days: 1
id: cover
- name: Post Coverage
if: ${{ github.ref != 'refs/heads/main' && always() }}
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.number }}
body: |
New [coverage report](${{ steps.cover.outputs.artifact-url }}) available :sparkles:
- name: Check Coverage
uses: vladopajic/go-test-coverage@v2
with:
config: ./.testcoverage.yml
## badge is created and committed only for main branch
git-token: ${{ github.ref_name == 'main' && secrets.GITHUB_TOKEN || '' }}
## name of branch where badges are stored
## ideally this should be orphan branch (see below how to create this branch)
git-branch: badges