Skip to content

Commit 61080da

Browse files
authored
chore: moved docs/snippets checks to separate step (#1274)
1 parent aa14407 commit 61080da

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

Diff for: .github/workflows/reusable-run-linting-check-and-unit-tests.yml

+41-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ jobs:
4242
if: steps.cache-node-modules.outputs.cache-hit == 'true'
4343
run: |
4444
npm run build -w packages/commons
45-
npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/parameters & npm run build -w packages/idempotency & npm run build -w docs/snippets
45+
npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/parameters & npm run build -w packages/idempotency
4646
- name: Run linting
47-
run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency -w docs/snippets
47+
run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency
4848
- name: Run unit tests
4949
run: npm t -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency
5050
check-examples:
@@ -64,7 +64,7 @@ jobs:
6464
- name: Setup NodeJS
6565
uses: actions/setup-node@v3
6666
with:
67-
node-version: 16
67+
node-version: 18
6868
cache: "npm"
6969
- name: Cache node modules
7070
id: cache-node-modules
@@ -97,7 +97,7 @@ jobs:
9797
- name: Setup NodeJS
9898
uses: actions/setup-node@v3
9999
with:
100-
node-version: 16
100+
node-version: 18
101101
cache: "npm"
102102
- name: Cache node modules
103103
id: cache-node-modules
@@ -114,3 +114,40 @@ jobs:
114114
run: npm run lint
115115
- name: Run tests
116116
run: npm t
117+
check-docs-snippets:
118+
runs-on: ubuntu-latest
119+
env:
120+
NODE_ENV: dev
121+
steps:
122+
- name: Checkout code
123+
uses: actions/checkout@v3
124+
- name: Setup NodeJS
125+
uses: actions/setup-node@v3
126+
with:
127+
node-version: 18
128+
cache: "npm"
129+
- name: Setup npm
130+
run: npm i -g npm@next-8
131+
- name: Cache node modules
132+
id: cache-node-modules
133+
uses: actions/cache@v3
134+
with:
135+
path: "./node_modules"
136+
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
137+
# if one of them changes the cache is invalidated/discarded
138+
key: 18-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }}
139+
- name: Install dependencies
140+
# We can skip the installation if there was a cache hit
141+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
142+
# See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
143+
run: npm ci --foreground-scripts
144+
- name: Build packages
145+
# If there's a cache hit we still need to manually build the packages
146+
# this would otherwise have been done automatically as a part of the
147+
# post-install npm hook
148+
if: steps.cache-node-modules.outputs.cache-hit == 'true'
149+
run: |
150+
npm run build -w packages/commons
151+
npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/parameters & npm run build -w packages/idempotency & npm run build -w docs/snippets
152+
- name: Run linting
153+
run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency -w docs/snippets

0 commit comments

Comments
 (0)