-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (100 loc) · 3.39 KB
/
lint-and-test.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: lint-and-test
on:
push:
branches:
- main
pull_request:
permissions:
checks: write
contents: read
jobs:
# warmgocache warms up the go cache by running a compile only test run.
warmgocache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: 1.19
cache: true
# Run a fake test run to compile all the dependencies so that they get loaded into the cache
- run: |
go test -v -run TestFoo ./...
golangci:
name: lint
runs-on: ubuntu-latest
needs: warmgocache
steps:
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: 1.19
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: v1.52.0
args: --timeout 10m0s
# Run go test
testgo:
runs-on: ubuntu-latest
needs: warmgocache
permissions:
id-token: write
packages: write
contents: read
steps:
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: 1.19
cache: true
- name: install go-junit-report
run: |
go install github.com/jstemmer/go-junit-report/v2@v2.0.0
# Need to login to docker for testing against remote repos
- name: Login to test GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
with:
username: masoukishi
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: test
run: |
2>&1 go test -v ./... | tee testout.txt
cat testout.txt | go-junit-report -set-exit-code > report.xml
env:
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
- name: report
uses: mikepenz/action-junit-report@7210fead7f92f6395c37241964df3b0f730f5e4e # v3.7.1
if: always()
with:
report_paths: "report.xml"
check_name: "go test Report"
goreleaser:
name: check goreleaser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
with:
distribution: goreleaser
version: latest
args: check
dryrelease:
name: dry run release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: "lts/*"
- name: Dry run release
run: |
npm install @semantic-release/exec
npx -y semantic-release@v19 --dry-run