Skip to content

Commit ee826b7

Browse files
committed
set up ci
1 parent 2d0aeef commit ee826b7

File tree

5 files changed

+86
-80
lines changed

5 files changed

+86
-80
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ updates:
6060
- 'react'
6161
- 'react-dom'
6262
- '@types/react'
63-
- '@types/react-dom'
6463
tailwind:
6564
patterns:
6665
- '@savvywombat/tailwindcss-grid-areas'

.github/workflows/build.yml

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
types:
1717
- labeled
1818
merge_group:
19+
workflow_dispatch:
1920

2021
defaults:
2122
run:
@@ -26,15 +27,18 @@ permissions:
2627
contents: read
2728
actions: read
2829

30+
env:
31+
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--cache-dir
32+
TURBO_ARGS: --cache-dir=.turbo/cache
33+
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--force
34+
TURBO_FORCE: true
35+
2936
jobs:
3037
build:
31-
# This Job should run either on `merge_groups` or `push` events
38+
# This Job should run either on non-`pull_request_target` events,
3239
# or `pull_request_target` event with a `labeled` action with a label named `github_actions:pull-request`
33-
# since we want to run Website Builds on all these 3 occasions. As this allows us to be certain the that builds are passing
34-
if: |
35-
(github.event_name == 'push' || github.event_name == 'merge_group') ||
36-
(github.event_name == 'pull_request_target' &&
37-
github.event.label.name == 'github_actions:pull-request')
40+
# since we want to run Website Builds on all these occasions. As this allows us to be certain the that builds are passing
41+
if: github.event_name != 'pull_request_target' || github.event.label.name == 'github_actions:pull-request'
3842

3943
name: Build on ${{ matrix.os }}
4044
runs-on: ${{ matrix.os }}
@@ -50,14 +54,6 @@ jobs:
5054
with:
5155
egress-policy: audit
5256

53-
- name: Provide Turborepo Arguments
54-
# This step is responsible for providing a reusable string that can be used within other steps and jobs
55-
# that use the `turbo` cli command as a way of easily providing shared arguments to the `turbo` command
56-
id: turborepo_arguments
57-
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--cache-dir
58-
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--force
59-
run: echo "turbo_args=--force=true --cache-dir=.turbo/cache" >> "$GITHUB_OUTPUT"
60-
6157
- name: Use GNU tar instead BSD tar
6258
# This ensures that we use GNU `tar` which is more efficient for extracting caches's
6359
if: matrix.os == 'windows-latest'
@@ -78,34 +74,31 @@ jobs:
7874

7975
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
8076
with:
81-
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node
82-
path: |
83-
~/.npm
84-
${{ github.workspace }}/apps/site/.next/cache
85-
# Generate a new cache whenever packages or source files change.
86-
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
87-
# If source files changed but packages didn't, rebuild from a prior cache.
88-
restore-keys: |
89-
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
77+
path: ${{ github.workspace }}/apps/site/.next/cache
78+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
79+
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
80+
81+
- name: Set up pnpm
82+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
83+
with:
84+
# We want to ensure that the Node.js version running here respects our supported versions
85+
node-version-file: '.nvmrc'
86+
cache: true
9087

9188
- name: Set up Node.js
9289
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
9390
with:
9491
# We want to ensure that the Node.js version running here respects our supported versions
9592
node-version-file: '.nvmrc'
96-
cache: 'npm'
93+
cache: 'pnpm'
9794

98-
- name: Install npm packages
99-
# We want to avoid npm from running the Audit Step and Funding messages on a CI environment
100-
# We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted
101-
# We also use `--omit=dev` to avoid installing devDependencies as we don't need them during the build step
102-
run: npm i --no-audit --no-fund --userconfig=/dev/null --omit=dev
95+
- name: Install packages
96+
# We only want to install required production packages
97+
run: pnpm install --prod --no-optional
10398

10499
- name: Build Next.js (ISR)
105100
# We want a ISR build on CI to ensure that regular Next.js builds work as expected.
106-
# We want to enforce that the actual `turbo@latest` package is used instead of a possible hijack from the user
107-
# the `${{ steps.turborepo_arguments.outputs.turbo_args }}` is a string substitution coming from a previous step
108-
run: npx --package=turbo@latest -- turbo build ${{ steps.turborepo_arguments.outputs.turbo_args }}
101+
run: pnpm build -- ${{ env.TURBO_ARGS }}
109102
env:
110103
# We want to ensure we have enough RAM allocated to the Node.js process
111104
# this should be a last resort in case by any chances the build memory gets too high
@@ -118,9 +111,7 @@ jobs:
118111
# We only run full static builds within Pull Requests. This step is also used to export
119112
# static output in all languages, and it only works on `push` events.
120113
if: github.event_name == 'push'
121-
# We want to enforce that the actual `turbo@latest` package is used instead of a possible hijack from the user
122-
# the `${{ steps.turborepo_arguments.outputs.turbo_args }}` is a string substitution coming from a previous step
123-
run: npx --package=turbo@latest -- turbo deploy ${{ steps.turborepo_arguments.outputs.turbo_args }}
114+
run: pnpm deploy -- ${{ env.TURBO_ARGS }}
124115
env:
125116
# We want to ensure we have enough RAM allocated to the Node.js process
126117
# this should be a last resort in case by any chances the build memory gets too high
@@ -139,9 +130,7 @@ jobs:
139130
if: |
140131
(github.event_name == 'pull_request_target' &&
141132
github.event.pull_request.head.ref != 'chore/crowdin')
142-
# We want to enforce that the actual `turbo@latest` package is used instead of a possible hijack from the user
143-
# the `${{ steps.turborepo_arguments.outputs.turbo_args }}` is a string substitution coming from a previous step
144-
run: npx --package=turbo@latest -- turbo deploy ${{ steps.turborepo_arguments.outputs.turbo_args }}
133+
run: pnpm deploy -- ${{ env.TURBO_ARGS }}
145134
env:
146135
# We want to ensure we have enough RAM allocated to the Node.js process
147136
# this should be a last resort in case by any chances the build memory gets too high
@@ -154,14 +143,12 @@ jobs:
154143

155144
- name: Sync Orama Cloud
156145
# We only want to sync the Orama Cloud production indexes on `push` events.
157-
# We also want to sync the Orama Cloud preview (deployment) indexes on `pull_request_target` events.
146+
# We also want to sync the Orama Cloud preview (deployment) indexes on `pull_request_target` events (or manual triggers).
158147
# We also want to ensure that the sync only happens on the `ubuntu-latest` runner to avoid duplicate syncs
159148
# or Windows-based path issues.
160149
env:
161150
ORAMA_INDEX_ID: ${{ github.event_name == 'push' && secrets.ORAMA_PRODUCTION_INDEX_ID || secrets.ORAMA_INDEX_ID }}
162151
ORAMA_SECRET_KEY: ${{ github.event_name == 'push' && secrets.ORAMA_PRODUCTION_SECRET_KEY || secrets.ORAMA_SECRET_KEY }}
163-
if: |
164-
(matrix.os == 'ubuntu-latest') &&
165-
((github.event_name == 'push') || (github.event_name == 'pull_request_target'))
166-
run: |
167-
cd apps/site && npm run sync-orama
152+
if: matrix.os == 'ubuntu-latest' && github.event_name !== 'merge_group'
153+
working-directory: apps/site
154+
run: pnpm sync-orama

.github/workflows/chromatic.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- main
1717
types:
1818
- labeled
19+
workflow_dispatch:
1920

2021
defaults:
2122
run:
@@ -36,9 +37,8 @@ jobs:
3637
# introduce changes to the Storybook. Hence, we skip running these on Crowdin PRs and Dependabot PRs
3738
# sha reference has no stable git tag reference or URL. see https://github.com/chromaui/chromatic-cli/issues/797
3839
if: |
39-
github.event_name == 'push' || github.event_name == 'merge_group' ||
40+
github.event_name != 'pull_request_target' ||
4041
(
41-
github.event_name == 'pull_request_target' &&
4242
github.event.label.name == 'github_actions:pull-request' &&
4343
startsWith(github.event.pull_request.head.ref, 'dependabot/') == false &&
4444
github.event.pull_request.head.ref != 'chore/crowdin'
@@ -66,22 +66,29 @@ jobs:
6666
# previous changes and previous commits and determine which Storybooks should be tested against and what should be built
6767
fetch-depth: 0
6868

69+
- name: Set up pnpm
70+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
71+
with:
72+
# We want to ensure that the Node.js version running here respects our supported versions
73+
node-version-file: '.nvmrc'
74+
cache: true
75+
6976
- name: Set up Node.js
7077
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
7178
with:
7279
# We want to ensure that the Node.js version running here respects our supported versions
7380
node-version-file: '.nvmrc'
74-
cache: 'npm'
81+
cache: 'pnpm'
7582

76-
- name: Install npm packages
77-
# We want to avoid npm from running the Audit Step and Funding messages on a CI environment
78-
# We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted
79-
run: npm i --no-audit --no-fund --userconfig=/dev/null
83+
- name: Install packages
84+
run: pnpm install
8085

8186
- name: Start Visual Regression Tests (Chromatic)
8287
# This assigns the Environment Deployment for Storybook
88+
# This action must be manually updated to the latest commit from
89+
# https://github.com/chromaui/action
8390
id: chromatic-deploy
84-
uses: chromaui/action@c93e0bc3a63aa176e14a75b61a31847cbfdd341c
91+
uses: chromaui/action@e8cc4c31775280b175a3c440076c00d19a9014d7 # v11.28.2
8592
with:
8693
workingDir: packages/ui-components
8794
buildScriptName: storybook:build

.github/workflows/lint-and-tests.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ jobs:
5555
with:
5656
path: |
5757
.turbo/cache
58-
node_modules/.cache
5958
.eslintmdcache
6059
.stylelintcache
6160
.prettiercache
@@ -64,22 +63,27 @@ jobs:
6463
# as they will only run on files that have changed since the last cached run
6564
# this might of course lead to certain files not being checked against the linter, but the chances
6665
# of such situation from happening are very slim as the checksums of both files would need to match
67-
key: cache-lint-${{ hashFiles('package-lock.json') }}-
66+
key: cache-lint-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('.turbo/cache/**') }}
6867
restore-keys: |
69-
cache-lint-${{ hashFiles('package-lock.json') }}-
68+
cache-lint-${{ hashFiles('pnpm-lock.yaml') }}-
7069
cache-lint-
7170
7271
- name: Set up pnpm
73-
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0
72+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
7473
with:
7574
# We want to ensure that the Node.js version running here respects our supported versions
7675
node-version-file: '.nvmrc'
7776
cache: true
7877

79-
- name: Install npm packages
80-
# We want to avoid npm from running the Audit Step and Funding messages on a CI environment
81-
# We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted
82-
run: npm i --no-audit --no-fund --ignore-scripts --userconfig=/dev/null
78+
- name: Set up Node.js
79+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
80+
with:
81+
# We want to ensure that the Node.js version running here respects our supported versions
82+
node-version-file: '.nvmrc'
83+
cache: 'pnpm'
84+
85+
- name: Install packages
86+
run: pnpm install
8387

8488
- name: Run quality checks with `turbo`
8589
# We run the ESLint and Prettier commands on all Workflow triggers of the `Lint` job, besides if
@@ -88,7 +92,7 @@ jobs:
8892
if: |
8993
(github.event_name == 'push' || github.event_name == 'merge_group') ||
9094
(github.event_name == 'pull_request' && github.event.pull_request.head.ref != 'chore/crowdin')
91-
run: npx turbo lint check-types prettier
95+
run: pnpm exec turbo lint check-types prettier
9296

9397
- name: Save Lint Cache
9498
# We only want to save caches on `push` events or `pull_request_target` events
@@ -105,11 +109,10 @@ jobs:
105109
with:
106110
path: |
107111
.turbo/cache
108-
node_modules/.cache
109112
.eslintmdcache
110113
.stylelintcache
111114
.prettiercache
112-
key: cache-lint-${{ hashFiles('package-lock.json') }}-${{ hashFiles('.turbo/cache/**') }}
115+
key: cache-lint-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('.turbo/cache/**') }}
113116

114117
tests:
115118
name: Tests
@@ -124,22 +127,27 @@ jobs:
124127
- name: Git Checkout
125128
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
126129

130+
- name: Set up pnpm
131+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
132+
with:
133+
# We want to ensure that the Node.js version running here respects our supported versions
134+
node-version-file: '.nvmrc'
135+
cache: true
136+
127137
- name: Set up Node.js
128138
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
129139
with:
130140
# We want to ensure that the Node.js version running here respects our supported versions
131141
node-version-file: '.nvmrc'
132-
cache: 'npm'
142+
cache: 'pnpm'
133143

134-
- name: Install npm packages
135-
# We want to avoid npm from running the Audit Step and Funding messages on a CI environment
136-
# We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted
137-
run: npm i --no-audit --no-fund --userconfig=/dev/null
144+
- name: Install packages
145+
run: pnpm install
138146

139147
- name: Run Unit Tests
140148
# We want to run Unit Tests in every circumstance, including Crowdin PRs and Dependabot PRs to ensure
141149
# that changes to dependencies or translations don't break the Unit Tests
142-
run: npm run test:ci
150+
run: pnpm test:ci
143151

144152
- name: Upload test coverage to Codecov
145153
if: ${{ !cancelled() && github.event_name != 'merge_group' }}

.github/workflows/translations-sync.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,32 +88,37 @@ jobs:
8888
# as they will only run on files that have changed since the last cached run
8989
# this might of course lead to certain files not being checked against the linter, but the chances
9090
# of such situation from happening are very slim as the checksums of both files would need to match
91-
key: cache-lint-${{ hashFiles('package-lock.json') }}-
91+
key: cache-lint-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('apps/site/.eslintmdcache') }}
9292
restore-keys: |
93-
cache-lint-${{ hashFiles('package-lock.json') }}-
93+
cache-lint-${{ hashFiles('pnpm-lock.yaml') }}-
9494
cache-lint-
9595
96+
- name: Set up pnpm
97+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
98+
with:
99+
# We want to ensure that the Node.js version running here respects our supported versions
100+
node-version-file: '.nvmrc'
101+
cache: true
102+
96103
- name: Set up Node.js
97104
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
98105
with:
99106
# We want to ensure that the Node.js version running here respects our supported versions
100107
node-version-file: '.nvmrc'
101-
cache: 'npm'
108+
cache: 'pnpm'
102109

103-
- name: Install npm packages
104-
# We want to avoid npm from running the Audit Step and Funding messages on a CI environment
105-
# We also use `npm i` instead of `npm ci` so that the node_modules/.cache folder doesn't get deleted
106-
run: npm i --no-audit --no-fund --ignore-scripts --userconfig=/dev/null
110+
- name: Install packages
111+
run: pnpm install
107112

108113
- name: Run `npx lint:md --fix`
109114
# This runs a specific version of ESLint with only the Translation Pages Globbing
110115
# This avoid that unrelated changes get linted/modified within this PR
111-
run: npx eslint "apps/site/pages/**/*.md?(x)" --fix --cache --cache-strategy=metadata --cache-file=apps/site/.eslintmdcache --config=apps/site/eslint.config.js
116+
run: pnpm exec eslint "apps/site/pages/**/*.md?(x)" --fix --cache --cache-strategy=metadata --cache-file=apps/site/.eslintmdcache --config=apps/site/eslint.config.js
112117

113118
- name: Run `npx prettier --write`
114119
# This runs a specific version of Prettier with only the Translation Pages Globbing
115120
# This avoid that unrelated changes get prettied/modified within this PR
116-
run: npx prettier "apps/site/{pages,i18n}/**/*.{json,md,mdx}" --check --write --cache --cache-strategy=metadata --cache-location=apps/site/.prettiercache
121+
run: pnpm exec prettier "apps/site/{pages,i18n}/**/*.{json,md,mdx}" --check --write --cache --cache-strategy=metadata --cache-location=apps/site/.prettiercache
117122

118123
- name: Push Changes back to Pull Request
119124
uses: stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # v5.1.0
@@ -128,4 +133,4 @@ jobs:
128133
path: |
129134
apps/site/.eslintmdcache
130135
apps/site/.prettiercache
131-
key: cache-lint-${{ hashFiles('package-lock.json') }}-${{ hashFiles('apps/site/.eslintmdcache') }}
136+
key: cache-lint-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('apps/site/.eslintmdcache') }}

0 commit comments

Comments
 (0)