...
1name: Test
2
3on:
4 push:
5 pull_request:
6 workflow_dispatch:
7
8env:
9 GO111MODULE: on
10
11permissions:
12 contents: read
13
14jobs:
15
16
17 lic-headers:
18 runs-on: ubuntu-latest
19 steps:
20
21 - uses: actions/checkout@v4
22
23 - run: >-
24 docker run
25 -v $(pwd):/wrk -w /wrk
26 ghcr.io/google/addlicense
27 -c 'The Cobra Authors'
28 -y '2013-2023'
29 -l apache
30 -ignore '.github/**'
31 -check
32 .
33
34
35 golangci-lint:
36 permissions:
37 contents: read # for actions/checkout to fetch code
38 pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
39 runs-on: ubuntu-latest
40 steps:
41
42 - uses: actions/checkout@v4
43
44 - uses: actions/setup-go@v4
45 with:
46 go-version: '^1.21'
47 check-latest: true
48 cache: true
49
50 - uses: actions/checkout@v4
51
52 - uses: golangci/golangci-lint-action@v3.7.0
53 with:
54 version: latest
55 args: --verbose
56
57
58 test-unix:
59 strategy:
60 fail-fast: false
61 matrix:
62 platform:
63 - ubuntu
64 - macOS
65 go:
66 - 17
67 - 18
68 - 19
69 - 20
70 - 21
71 name: '${{ matrix.platform }} | 1.${{ matrix.go }}.x'
72 runs-on: ${{ matrix.platform }}-latest
73 steps:
74
75 - uses: actions/checkout@v4
76
77 - uses: actions/setup-go@v4
78 with:
79 go-version: 1.${{ matrix.go }}.x
80 cache: true
81
82 - run: |
83 export GOBIN=$HOME/go/bin
84 go install github.com/kyoh86/richgo@latest
85 go install github.com/mitchellh/gox@latest
86
87 - run: RICHGO_FORCE_COLOR=1 PATH=$HOME/go/bin/:$PATH make richtest
88
89
90 test-win:
91 name: MINGW64
92 defaults:
93 run:
94 shell: msys2 {0}
95 runs-on: windows-latest
96 steps:
97
98 - shell: bash
99 run: git config --global core.autocrlf input
100
101 - uses: msys2/setup-msys2@v2
102 with:
103 msystem: MINGW64
104 update: true
105 install: >
106 git
107 make
108 unzip
109 mingw-w64-x86_64-go
110
111 - uses: actions/checkout@v4
112
113 - uses: actions/cache@v3
114 with:
115 path: ~/go/pkg/mod
116 key: ${{ runner.os }}-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
117 restore-keys: ${{ runner.os }}-${{ matrix.go }}-
118
119 - run: |
120 export GOBIN=$HOME/go/bin
121 go install github.com/kyoh86/richgo@latest
122 go install github.com/mitchellh/gox@latest
123
124 - run: RICHGO_FORCE_COLOR=1 PATH=$HOME/go/bin:$PATH make richtest
View as plain text