-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (72 loc) · 1.96 KB
/
kubenetmon.yaml
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
name: CI Workflow
on:
pull_request:
paths:
- '**'
push:
branches:
- main
paths:
- '**'
jobs:
lint-and-test:
name: Lint and Test Code and Charts
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
cache-dependency-path: go.sum
- name: Install dependencies
run: |
make golangci-lint
- name: Run code linter
run: |
make lint
- name: Run tests
run: |
make test
make integration-test
- name: Install Helm
uses: azure/setup-helm@v4
- name: Lint Helm charts
run: |
helm lint kubenetmon/deploy/helm
- name: Test Helm charts
run: |
helm template kubenetmon/deploy/helm | kubectl apply --dry-run=client -f -
build-and-publish:
name: Build and Publish Docker and Helm Chart
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build Docker image
run: |
docker build -t your-docker-repo/kubenetmon:${{ github.sha }} .
- name: Push Docker image
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
docker push your-docker-repo/kubenetmon:${{ github.sha }}
- name: Package Helm chart
run: |
helm package kubenetmon/deploy/helm
- name: Publish Helm chart
uses: helm/[email protected]
with:
charts_dir: kubenetmon/deploy/helm
release_repo: your-helm-repo-url