forked from leaktk/leaktk
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (94 loc) · 2.69 KB
/
testing.yml
File metadata and controls
113 lines (94 loc) · 2.69 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
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
name: Testing & Linting
defaults:
run:
shell: bash
env:
GO_VERSION: '1.23'
GO111MODULE: on
on:
workflow_call:
workflow_dispatch:
push:
branches:
- 'main'
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches:
- 'main'
permissions:
contents: read
jobs:
go-mod:
name: Running go mod check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v4
- name: Install
run: |
sudo apt-get update
sudo apt-get install -y libbtrfs-dev
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # pin@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Check go mod
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum
test:
name: Running tests on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v4
- name: Install
if: startsWith(runner.os, 'Linux')
run: |
sudo apt-get update
sudo apt-get install -y libbtrfs-dev
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # pin@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
gosec:
name: Running gosec security checks on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@32975f4bab0d7b683a88756aaf3fa5502188b476 # pin@master
with:
args: ./...
golangci-lint:
name: Running linting on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v4
- name: Install
run: |
sudo apt-get update
sudo apt-get install -y libbtrfs-dev
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # pin@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # pin@v8.0.0
with:
args: --timeout=2m
version: latest