-
Notifications
You must be signed in to change notification settings - Fork 8
97 lines (93 loc) · 2.5 KB
/
build.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
88
89
90
91
92
93
94
95
96
97
name: Build
on:
push:
branches: [main]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .editorconfig
- .chartreleaser.yaml
- .github/workflows/*-helm.yaml
- helm/**
- version.yaml
pull_request:
branches: [main]
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .editorconfig
- .chartreleaser.yaml
- .github/workflows/*-helm.yaml
- helm/**
- version.yaml
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Checkout code
uses: actions/checkout@v4
- name: Get dependencies
run: |
export GO111MODULE=on
go get -v -t -d ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
install-mode: binary
version: latest
build:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Checkout code
uses: actions/checkout@v4
- name: Get dependencies
run: |
export GO111MODULE=on
go get -v -t -d ./...
- name: Build
run: |
export GO111MODULE=on
go mod download
GOOS=linux GOARCH=amd64 go build -o bin/hcloud-pricing-exporter-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o bin/hcloud-pricing-exporter-linux-arm64 main.go
GOOS=windows GOARCH=amd64 go build -o bin/hcloud-pricing-exporter-windows-amd64.exe main.go
- name: Upload Artifacts
uses: actions/upload-artifact@master
with:
name: binaries
path: bin/
test:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Checkout code
uses: actions/checkout@v4
- name: Get dependencies
run: |
export GO111MODULE=on
go get -v -t -d ./...
- name: Run tests
env:
HCLOUD_API_TOKEN: ${{ secrets.HCLOUD_API_TOKEN }}
run: go test -v -race -covermode=atomic "-coverprofile=coverprofile.out" ./...
- name: Report coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: coverprofile.out
fail_ci_if_error: true