-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (79 loc) · 1.95 KB
/
daisctl-pr.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
name: Daisctl PRs
env:
WORKDIR: tools/daisctl
on:
push:
branches:
- "main"
pull_request:
paths:
- "tools/daisctl/**/*.go"
- "tools/daisctl/go.*"
- "tools/daisctl/Makefile"
- "./github/workflows/daisctl-pr.yml"
jobs:
tidy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: '${{ env.WORKDIR }}/go.mod'
cache: true
- name: Check go mod
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum
lint:
needs: tidy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: '${{ env.WORKDIR }}/go.mod'
cache: true
- name: lint
uses: golangci/golangci-lint-action@v6.1.1
with:
version: latest
working-directory: ${{ env.WORKDIR }}
test:
needs: lint
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
shell: bash
test-cmd: make test
- os: macos-latest
shell: bash
test-cmd: make test
- os: windows-latest
shell: powershell
test-cmd: make.exe test
name: Test - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.WORKDIR }}
steps:
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: '${{ env.WORKDIR }}/go.mod'
cache: true
- name: Run tests
run: ${{ matrix.test-cmd }}