From 852711aa1e1f076a0005c1ed40b5010befb2eac8 Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Tue, 7 Feb 2023 19:15:59 +0100 Subject: [PATCH] chore: moved docs/snippets checks to separate step --- ...sable-run-linting-check-and-unit-tests.yml | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-run-linting-check-and-unit-tests.yml b/.github/workflows/reusable-run-linting-check-and-unit-tests.yml index e779fd0737..3bac08a4f4 100644 --- a/.github/workflows/reusable-run-linting-check-and-unit-tests.yml +++ b/.github/workflows/reusable-run-linting-check-and-unit-tests.yml @@ -42,9 +42,9 @@ jobs: if: steps.cache-node-modules.outputs.cache-hit == 'true' run: | npm run build -w packages/commons - 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 + 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 - name: Run linting - 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 + run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency - name: Run unit tests run: npm t -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency check-examples: @@ -64,7 +64,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "npm" - name: Cache node modules id: cache-node-modules @@ -97,7 +97,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 cache: "npm" - name: Cache node modules id: cache-node-modules @@ -114,3 +114,40 @@ jobs: run: npm run lint - name: Run tests run: npm t + check-docs-snippets: + runs-on: ubuntu-latest + env: + NODE_ENV: dev + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Setup NodeJS + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "npm" + - name: Setup npm + run: npm i -g npm@next-8 + - name: Cache node modules + id: cache-node-modules + uses: actions/cache@v3 + with: + path: "./node_modules" + # Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that + # if one of them changes the cache is invalidated/discarded + key: 18-cache-utilities-node-modules-${{ hashFiles('./package-lock.json') }} + - name: Install dependencies + # We can skip the installation if there was a cache hit + if: steps.cache-node-modules.outputs.cache-hit != 'true' + # See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts + run: npm ci --foreground-scripts + - name: Build packages + # If there's a cache hit we still need to manually build the packages + # this would otherwise have been done automatically as a part of the + # post-install npm hook + if: steps.cache-node-modules.outputs.cache-hit == 'true' + run: | + npm run build -w packages/commons + 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 + - name: Run linting + 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