-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (94 loc) · 2.8 KB
/
go-ci.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
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
on:
workflow_call:
inputs:
disable-sudo:
type: boolean
default: true
egress-policy-allowlist:
type: string
default: ""
runs-on:
type: string
default: "ubuntu-latest"
working-directory:
type: string
default: "."
jobs:
go-lint:
name: Golang Linting
runs-on: ${{ inputs.runs-on }}
defaults:
run:
working-directory: ${{ inputs.working-directory }}
permissions:
contents: read
pull-requests: read
checks: write
steps:
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f
# v2.10.2
with:
disable-sudo: ${{ inputs.disable-sudo }}
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
raw.githubusercontent.com:443
storage.googleapis.com:443
sum.golang.org:443
${{ inputs.egress-policy-allowlist }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
# v5.1.0
with:
go-version: "oldstable"
- name: golangci-lint
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8
# v6.1.1
with:
version: latest
only-new-issues: true
go-build-and-test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
defaults:
run:
working-directory: ${{ inputs.working-directory }}
steps:
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f
# v2.10.2
with:
disable-sudo: ${{ inputs.disable-sudo }}
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
storage.googleapis.com:443
sum.golang.org:443
${{ inputs.egress-policy-allowlist }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# v4.2.2
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
# v5.1.0
with:
go-version-file: ${{ inputs.working-directory }}/go.mod
cache-dependency-path: |
${{ inputs.working-directory }}/**/*.sum
- name: Install dependencies
run: go get -v .
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: go test -v ./...