Skip to content

Commit d658d5d

Browse files
chore: separate code health gh action per tools to run only when specific paths are changed (#552)
1 parent ab360fc commit d658d5d

File tree

2 files changed

+111
-63
lines changed

2 files changed

+111
-63
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: 'Code Health FoasCLI'
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'tools/cli/**'
8+
pull_request:
9+
branches:
10+
- main
11+
paths:
12+
- 'tools/cli/**'
13+
workflow_dispatch: {}
14+
workflow_call: {}
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout CLI
24+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
25+
- name: Install Go
26+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
27+
with:
28+
go-version-file: 'tools/cli/go.mod'
29+
- name: Build CLI
30+
working-directory: tools/cli
31+
run: make build
32+
unit-tests:
33+
needs: build
34+
env:
35+
COVERAGE: coverage.out
36+
UNIT_TAGS: unit
37+
INTEGRATION_TAGS: integration
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
os: [ubuntu-latest, windows-latest, macos-latest]
42+
runs-on: ${{ matrix.os }}
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
46+
- name: Install Go
47+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
48+
with:
49+
go-version-file: 'tools/cli/go.mod'
50+
- name: Run unit tests
51+
working-directory: tools/cli
52+
run: make unit-test
53+
lint:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
58+
with:
59+
sparse-checkout: |
60+
.github
61+
tools
62+
- name: Install Go
63+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
64+
with:
65+
go-version-file: 'tools/cli/go.mod'
66+
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
67+
- name: golangci-lint
68+
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837
69+
with:
70+
version: v1.64.5
71+
working-directory: tools/cli
72+
- name: Checkout GitHub actions
73+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
74+
with:
75+
sparse-checkout: |
76+
.github
77+
- name: Setup Node
78+
uses: actions/setup-node@v4
79+
with:
80+
node-version: '20.x'
81+
cache: 'npm'
82+
- name: Download actionlint
83+
id: get_actionlint
84+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
85+
shell: bash
86+
- name: Check workflow files
87+
run: |
88+
echo "::add-matcher::.github/actionlint-matcher.json"
89+
${{ steps.get_actionlint.outputs.executable }} -color
90+
shell: bash
91+
e2e-tests:
92+
needs: build
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: Checkout
96+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
97+
- name: Install Go
98+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
99+
with:
100+
go-version-file: 'tools/cli/go.mod'
101+
- name: Run e2e tests
102+
working-directory: tools/cli
103+
run: make e2e-test

.github/workflows/code-health-tools.yml

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,21 @@ on:
44
branches:
55
- main
66
paths:
7-
- 'tools/**'
8-
pull_request: {}
7+
- 'tools/postman/**'
8+
- 'tools/spectral/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'tools/postman/**'
14+
- 'tools/spectral/**'
915
workflow_dispatch: {}
1016
workflow_call: {}
1117

1218
permissions:
1319
contents: read
1420

1521
jobs:
16-
build:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- name: Checkout CLI
20-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
21-
- name: Install Go
22-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
23-
with:
24-
go-version-file: 'tools/cli/go.mod'
25-
- name: Build CLI
26-
working-directory: tools/cli
27-
run: make build
28-
unit-tests:
29-
needs: build
30-
env:
31-
COVERAGE: coverage.out
32-
UNIT_TAGS: unit
33-
INTEGRATION_TAGS: integration
34-
strategy:
35-
fail-fast: false
36-
matrix:
37-
os: [ubuntu-latest, windows-latest, macos-latest]
38-
runs-on: ${{ matrix.os }}
39-
steps:
40-
- name: Checkout
41-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
42-
- name: Install Go
43-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
44-
with:
45-
go-version-file: 'tools/cli/go.mod'
46-
- name: Run unit tests
47-
working-directory: tools/cli
48-
run: make unit-test
4922
js-tests:
5023
runs-on: ubuntu-latest
5124
steps:
@@ -95,21 +68,6 @@ jobs:
9568
exit 1
9669
fi
9770
exit 0
98-
- name: Install Go
99-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
100-
with:
101-
go-version-file: 'tools/cli/go.mod'
102-
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
103-
- name: golangci-lint
104-
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837
105-
with:
106-
version: v1.64.5
107-
working-directory: tools/cli
108-
- name: Checkout GitHub actions
109-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
110-
with:
111-
sparse-checkout: |
112-
.github
11371
- name: Download actionlint
11472
id: get_actionlint
11573
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
@@ -119,16 +77,3 @@ jobs:
11977
echo "::add-matcher::.github/actionlint-matcher.json"
12078
${{ steps.get_actionlint.outputs.executable }} -color
12179
shell: bash
122-
e2e-tests:
123-
needs: build
124-
runs-on: ubuntu-latest
125-
steps:
126-
- name: Checkout
127-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
128-
- name: Install Go
129-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
130-
with:
131-
go-version-file: 'tools/cli/go.mod'
132-
- name: Run e2e tests
133-
working-directory: tools/cli
134-
run: make e2e-test

0 commit comments

Comments
 (0)