Skip to content

Commit

Permalink
ci(actions): centralize setup actions and update third-party actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwremmel committed Oct 28, 2023
1 parent ee9bfd6 commit 06f49d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 63 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Setup'
description: 'Common setup steps for all jobs'
runs:
using: 'composite'
steps:
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v4
- run: npm ci
shell: bash
- run: npx --no-install nx run-many --target=build --parallel=4
shell: bash
75 changes: 12 additions & 63 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,31 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: npx nx run-many --target=build --parallel=4
- uses: './.github/actions/setup'

diff:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: npm ci
# by making this job depend on the build job, the following line should be
# 100% cache hits; The nx cache seems to be much easier to use than the
# GitHub artifact action.
- run: npx nx run-many --target=build --parallel=4
- uses: './.github/actions/setup'
- run: ./scripts/diff-lint

lint:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: npm ci
# by making this job depend on the build job, the following line should be
# 100% cache hits; The nx cache seems to be much easier to use than the
# GitHub artifact action.
- run: npx nx run-many --target=build --parallel=4
- uses: './.github/actions/setup'
- run: npx nx workspace-lint
- run: npx nx format:check
- run: npm run lint
Expand Down Expand Up @@ -93,19 +69,10 @@ jobs:
# need to be release, so 60 is not unreasonable.
timeout-minutes: 60
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: npm ci
# by making this job depend on the build job, the following line should be
# 100% cache hits; The nx cache seems to be much easier to use than the
# GitHub artifact action.
- run: npx nx run-many --target=build --parallel=4
- uses: './.github/actions/setup'
- run: |
npm config set workspaces-update false
npx multi-semantic-release \
Expand Down Expand Up @@ -136,24 +103,15 @@ jobs:
nodeCount: [5]
nodeIndex: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure AWS credentials from Test account
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: npm ci
# by making this job depend on the build job, the following line should be
# 100% cache hits; The nx cache seems to be much easier to use than the
# GitHub artifact action.
- run: npx nx run-many --target=build --parallel=4
- uses: './.github/actions/setup'
- uses: check-run-reporter/[email protected]
id: split
with:
Expand Down Expand Up @@ -196,19 +154,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3.5.0
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: nrwl/nx-set-shas@v3
- run: npm ci
# by making this job depend on the build job, the following line should be
# 100% cache hits; The nx cache seems to be much easier to use than the
# GitHub artifact action.
- run: npx nx run-many --target=build --parallel=4
- uses: './.github/actions/setup'
- run: npm test -- --selectProjects 'Unit Tests'
- uses: check-run-reporter/[email protected]
if: ${{ always() }}
Expand Down

0 comments on commit 06f49d4

Please sign in to comment.