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: simplify pipelines and setup jest to follow fluent core setup #206

Merged
merged 5 commits into from
Jul 31, 2024
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
42 changes: 16 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ on:
- main
pull_request:

env:
NX_PARALLEL: 2 # ubuntu-latest = 2-core CPU / 7 GB of RAM
NX_VERBOSE_LOGGING: true

jobs:
main:
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
uses: nrwl/nx-set-shas@v4

- uses: actions/setup-node@v4
with:
Expand All @@ -31,34 +39,16 @@ jobs:
- name: Install Playwright Browsers
run: npx playwright install --with-deps

- run: yarn nx affected --target=verify-integrity --parallel --max-parallel=3
- run: yarn nx affected --target=type-check --parallel --max-parallel=3
- run: yarn nx affected --target=build --parallel --max-parallel=3
- run: yarn nx affected --target=build-storybook --parallel --max-parallel=3
- run: yarn nx affected --target=test --parallel --max-parallel=2
- run: yarn nx affected --target=component-test --skipInstall --parallel --max-parallel=2
- run: yarn nx affected --target=lint --parallel --max-parallel=3
- run: yarn nx affected --target=verify-integrity
- run: yarn nx affected --target=build
- run: yarn nx affected --target=build-storybook
- run: yarn nx affected --target=type-check
- run: yarn nx affected --target=lint
- run: yarn nx affected --target=test
- run: yarn nx affected --target=component-test --skipInstall
- run: yarn nx format:check --base origin/main

- name: 'Check for unstaged changes'
run: |
git status --porcelain
git diff-index --quiet HEAD -- || exit 1

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2

- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: '20'

- run: yarn install --frozen-lockfile
- run: yarn nx affected --target=build-storybook --parallel --max-parallel=3
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ permissions:
pages: write
id-token: write

env:
NX_PARALLEL: 2 # ubuntu-latest = 2-core CPU / 7 GB of RAM
NX_VERBOSE_LOGGING: true

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
Expand All @@ -36,7 +40,7 @@ jobs:
node-version: '20'

- run: yarn install --frozen-lockfile
- run: yarn nx run-many --target=build-storybook --parallel --max-parallel=3
- run: yarn nx run-many --target=build-storybook

- name: Setup Pages
uses: actions/configure-pages@v3
Expand Down
9 changes: 9 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ module.exports = {
// @see https://github.com/nrwl/nx/blob/master/packages/jest/preset/jest-preset.ts#L8-L13
'^.+\\.(ts|js|html)$': ['@swc/jest'],
},
maxWorkers: isCI() ? 1 : '50%',
};

function isCI() {
return (
(process.env.CI && process.env.CI !== 'false') ||
process.env.TF_BUILD === 'true' ||
process.env.GITHUB_ACTIONS === 'true'
);
}