Skip to content

Commit 158f71d

Browse files
chore: separate code health gh action per tools to run only when specific paths are changed
1 parent d0c6db0 commit 158f71d

File tree

2 files changed

+96
-62
lines changed

2 files changed

+96
-62
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: 'Code Health FoasCLI'
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'tools/cli/**'
8+
pull_request: {}
9+
workflow_dispatch: {}
10+
workflow_call: {}
11+
12+
permissions:
13+
contents: read
14+
15+
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
49+
lint:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
54+
with:
55+
sparse-checkout: |
56+
.github
57+
tools
58+
- name: Install Go
59+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
60+
with:
61+
go-version-file: 'tools/cli/go.mod'
62+
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
63+
- name: golangci-lint
64+
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837
65+
with:
66+
version: v1.64.5
67+
working-directory: tools/cli
68+
- name: Checkout GitHub actions
69+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
70+
with:
71+
sparse-checkout: |
72+
.github
73+
- name: Download actionlint
74+
id: get_actionlint
75+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
76+
shell: bash
77+
- name: Check workflow files
78+
run: |
79+
echo "::add-matcher::.github/actionlint-matcher.json"
80+
${{ steps.get_actionlint.outputs.executable }} -color
81+
shell: bash
82+
e2e-tests:
83+
needs: build
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
88+
- name: Install Go
89+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34
90+
with:
91+
go-version-file: 'tools/cli/go.mod'
92+
- name: Run e2e tests
93+
working-directory: tools/cli
94+
run: make e2e-test

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

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
branches:
55
- main
66
paths:
7-
- 'tools/**'
7+
- 'tools/postman/**'
8+
- 'tools/spectral/**'
89
pull_request: {}
910
workflow_dispatch: {}
1011
workflow_call: {}
@@ -13,39 +14,6 @@ permissions:
1314
contents: read
1415

1516
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
4917
js-tests:
5018
runs-on: ubuntu-latest
5119
steps:
@@ -95,21 +63,6 @@ jobs:
9563
exit 1
9664
fi
9765
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
11366
- name: Download actionlint
11467
id: get_actionlint
11568
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
@@ -119,16 +72,3 @@ jobs:
11972
echo "::add-matcher::.github/actionlint-matcher.json"
12073
${{ steps.get_actionlint.outputs.executable }} -color
12174
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)