-
Notifications
You must be signed in to change notification settings - Fork 43
89 lines (87 loc) · 2.33 KB
/
test.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
name: Test
on:
push:
branches:
- master
pull_request:
jobs:
test:
name: Run tests
strategy:
fail-fast: false
matrix:
# https://github.com/actions/go-versions/blob/main/versions-manifest.json
go-version: [1.20.x, 1.21.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
stable: false
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: make test
env:
BOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-extended:
name: Run race+coverage tests
runs-on: "ubuntu-latest"
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Checkout code
uses: actions/checkout@v4
- name: Build binary
run: make build/slack-bot
- name: Run tests with race
run: make test-race
env:
BOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test with coverage
run: make test-coverage
env:
BOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Coverage
uses: codecov/codecov-action@v3
lint:
name: Lint
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
with:
only-new-issues: true
args: --timeout=3m
security:
name: Security
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude=G404,G307,G104 ./...
- name: Run govulncheck
uses: Templum/govulncheck-action@v0.10.0
with:
package: ./...
docker:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Build and push
uses: docker/build-push-action@v5.1.0
with:
context: .
load: true