Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(actions): centralize setup actions and update third-party actions #137

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading