forked from filecoin-project/lotus
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (102 loc) · 2.98 KB
/
check.yml
File metadata and controls
107 lines (102 loc) · 2.98 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
name: Check
on:
pull_request:
push:
branches:
- master
- release/*
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
pre-check:
name: Check (precheck)
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
outputs:
skip_checks: ${{ steps.changes.outputs.nonMarkdownFiles == 'false' }}
steps:
- uses: actions/checkout@v4
- id: changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
filters: |
nonMarkdownFiles:
- '!**/*.md'
check-gen:
name: Check (gen-check)
needs: [pre-check]
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- uses: ./.github/actions/make-deps
- run: make gen
- run: git diff --exit-code
- run: make docsgen-cli
- run: git diff --exit-code
check-lint:
name: Check (lint-all)
needs: [pre-check]
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- uses: ./.github/actions/make-deps
- run: make lint
check-fmt:
name: Check (gofmt)
needs: [pre-check]
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- uses: ./.github/actions/install-go
- run: go fmt ./...
- run: git diff --exit-code
check-mod-tidy:
name: Check (mod-tidy-check)
needs: [pre-check]
if: ${{ needs.pre-check.outputs.skip_checks != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- uses: ./.github/actions/install-go
- run: go mod tidy -v
- run: git diff --exit-code
post-check:
name: Check (postcheck)
needs: [check-gen, check-lint, check-fmt, check-mod-tidy]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- env:
failure: ${{ needs.check-gen.result == 'failure' || needs.check-lint.result == 'failure' || needs.check-fmt.result == 'failure' || needs.check-mod-tidy.result == 'failure' }}
run: |
if [[ "$failure" == "true" ]]; then
echo "Some checks failed, see the workflow results for more information."
exit 1
fi
shell: bash