forked from zigbee-alliance/distributed-compliance-ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (158 loc) · 4.47 KB
/
verify.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
# Copyright 2022
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Check Tests and Documentation
# yamllint disable-line rule:truthy
on:
push:
branches:
- master
pull_request:
branches:
- master
- issue-99-cosmos-upgrade-v0.44
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
outputs:
go: ${{ steps.filter.outputs.go }}
src: ${{ steps.filter.outputs.src }}
docs: ${{ steps.filter.outputs.docs }}
workflows: ${{ steps.filter.outputs.workflows }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
if: ${{ !env.ACT }}
id: filter
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
go:
- '**/*.go'
- 'go.mod'
- 'go.sum'
src:
- '!((**.md)|(**/*.md)|(.github/**)|(docs/**)|(vue/**))'
docs:
- '**.md'
- '**/*.md'
workflows:
- '.github/**'
gh-actions:
if: needs.changes.outputs.workflows == 'true'
name: Run actionlint tool to verify lint issues in GitHub actions
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@master
- uses: reviewdog/action-actionlint@v1
links:
if: needs.changes.outputs.docs == 'true'
name: Run markdown-link-check tool to verify link issues
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
spell:
if: needs.changes.outputs.docs == 'true'
name: Run PySpelling tool to verify spelling issues
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@v3
- uses: rojopolis/[email protected]
unit-tests:
name: Check unit tests
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/setup-go@v4
with:
go-version: ^1.20
- uses: actions/checkout@v3
- uses: actions/cache@v3
if: ${{ !env.ACT }}
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: haveyoudebuggedit/gotestfmt-action@v2
- name: Run tests
run: |
set -euo pipefail
# shellcheck disable=SC2046
go test -json -v $(go list ./... | grep -v '/integration_tests') 2>&1 | tee /tmp/gotest.log | gotestfmt
integration-tests:
if: needs.changes.outputs.src == 'true'
name: Integration tests
runs-on: ubuntu-20.04
needs:
- changes
steps:
- uses: actions/setup-go@v4
with:
go-version: ^1.20
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run integration tests
shell: bash
run: integration_tests/run-all.sh
lint:
if: needs.changes.outputs.go == 'true'
name: Check linter issues with golangci-lint tool
runs-on: ubuntu-latest
needs:
- changes
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.21
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55
args: --timeout 5m0s
check:
if: always()
needs:
- unit-tests
- integration-tests
- lint
- links
- spell
- gh-actions
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
allowed-skips: lint, unit-tests, integration-tests, links, spell, gh-actions
jobs: ${{ toJSON(needs) }}