forked from gitlabhq/terraform-provider-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (60 loc) · 1.9 KB
/
pr-lint.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
# This workflow runs basic checks for pull requests that do not need secrets.
name: pr-lint
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v3
# Read the .go-version file and output it for other jobs to use.
- id: go-version
run: echo "::set-output name=go-version::$(cat .go-version)"
lint:
runs-on: ubuntu-latest
needs: [go-version]
strategy:
fail-fast: false
# Run all lint targets.
matrix:
target:
- lint-golangci
- lint-examples-tf
- lint-examples-sh
- lint-generated
- lint-custom
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.go-version.outputs.go-version }}
- uses: actions/checkout@v3
# Cache the Go modules and compiled tools for the specific lint target.
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
bin
key: ${{ github.job }}-${{ matrix.target }}-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'GNUMakefile') }}
- run: make ${{ matrix.target }}
unit-test:
runs-on: ${{ matrix.os }}
needs: [go-version]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.go-version.outputs.go-version }}
- uses: actions/checkout@v3
# Cache the Go modules.
- uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ github.job }}-${{ runner.os }}-go${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'GNUMakefile') }}
- run: make test