-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (68 loc) · 2.11 KB
/
ci.yml
File metadata and controls
82 lines (68 loc) · 2.11 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
---
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_call: # Allow release.yml to call this as a gate
jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run unit tests with coverage
run: go test -coverpkg=github.com/numberly/opentofu-provider-flashblade/internal/... -coverprofile=coverage.out ./internal/... -count=1 -timeout 5m
- name: Extract coverage percentage
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: coverage
run: |
PCT=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%')
echo "percentage=${PCT}" >> "$GITHUB_OUTPUT"
- name: Update coverage badge
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: 59bd98f69a5ecbb7e643402fde956fed
filename: coverage.json
label: coverage
message: ${{ steps.coverage.outputs.percentage }}%
valColorRange: ${{ steps.coverage.outputs.percentage }}
minColorRange: 40
maxColorRange: 80
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
docs-check:
name: Docs up to date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_wrapper: false
- name: Regenerate docs
run: go generate ./...
- name: Check for uncommitted doc changes
run: git diff --exit-code docs/