-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): split PR preview action and upgrade deps
Signed-off-by: Jon Koops <[email protected]>
- Loading branch information
Showing
5 changed files
with
198 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Set up and build project | ||
inputs: | ||
skip-build: | ||
description: Skip the build step | ||
required: false | ||
default: 'false' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
check-latest: true | ||
|
||
- name: Enable Corepack | ||
shell: bash | ||
run: corepack enable | ||
|
||
- name: Get Yarn configuration | ||
id: yarn-config | ||
shell: bash | ||
run: | | ||
echo "cache-directory=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
# TODO: This can be simplified to use the `cache` option of the `actions/setup-node` action when it supports Corepack. | ||
# See: https://github.com/actions/setup-node/issues/531 | ||
- uses: actions/cache@v4 | ||
name: Setup Yarn cache | ||
with: | ||
# Also cache Cypress binary. | ||
path: | | ||
~/.cache/Cypress | ||
${{ steps.yarn-config.outputs.cache-directory }} | ||
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn-cache- | ||
- name: Install dependencies | ||
shell: bash | ||
run: yarn install --frozen-lockfile | ||
|
||
- uses: actions/cache@v4 | ||
if: inputs.skip-build != 'true' | ||
id: cache-build | ||
name: Cache build | ||
with: | ||
path: | | ||
packages/*/dist | ||
packages/*/next | ||
packages/*/deprecated | ||
packages/*/components | ||
packages/react-styles/css | ||
packages/react-core/layouts | ||
packages/react-core/helpers | ||
key: ${{ runner.os }}-build-${{ hashFiles('yarn.lock', '**/package.json', 'packages/**', '!**/node_modules', '!**/dist') }} | ||
|
||
- name: Run build | ||
if: inputs.skip-build != 'true' && steps.cache-build.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: yarn build && yarn build:umd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Preview documentation | ||
on: | ||
pull_request_target: | ||
jobs: | ||
deploy: | ||
name: Build, test & deploy | ||
runs-on: ubuntu-latest | ||
env: | ||
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | ||
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||
GH_PR_TOKEN: ${{ secrets.GH_PR_TOKEN }} | ||
GH_PR_NUM: ${{ github.event.number }} | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v4 | ||
with: | ||
# Checkout the merge commit so that we can access the PR's changes. | ||
# This is nessesary because `pull_request_target` checks out the base branch. | ||
ref: ${{ github.event.pull_request.merge_commit_sha }} | ||
|
||
- name: Set up and build project | ||
uses: ./.github/actions/setup-project | ||
|
||
- name: Build documentation | ||
run: yarn build:docs | ||
|
||
- name: Upload documentation | ||
if: always() | ||
run: node .github/upload-preview.js packages/react-docs/public | ||
|
||
- name: Run accessibility tests | ||
run: yarn serve:docs & yarn test:a11y | ||
|
||
- name: Upload accessibility results | ||
if: always() | ||
run: node .github/upload-preview.js packages/react-docs/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: CI | ||
on: | ||
push: | ||
pull_request: | ||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up project | ||
uses: ./.github/actions/setup-project | ||
with: | ||
skip-build: true | ||
|
||
- uses: actions/cache@v4 | ||
name: Cache files proccesed by ESLint | ||
with: | ||
path: .eslintcache | ||
key: ${{ runner.os }}-eslint-cache | ||
|
||
- name: Run linter | ||
run: yarn lint:all | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up and build project | ||
uses: ./.github/actions/setup-project | ||
|
||
unit-tests: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up and build project | ||
uses: ./.github/actions/setup-project | ||
|
||
- name: Run tests | ||
run: yarn test --maxWorkers=2 | ||
|
||
demo-app: | ||
name: Build demo app | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up and build project | ||
uses: ./.github/actions/setup-project | ||
|
||
- name: Build demo app | ||
run: yarn build:integration | ||
|
||
- name: Upload demo app | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: demo-app | ||
path: packages/react-integration/demo-app-ts/public | ||
|
||
integration-tests: | ||
name: Integration tests | ||
runs-on: ubuntu-latest | ||
needs: demo-app | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
worker: [0, 1, 2, 3, 4] | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up and build project | ||
uses: ./.github/actions/setup-project | ||
|
||
- name: Download demo app | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: demo-app | ||
path: packages/react-integration/demo-app-ts/public | ||
|
||
- name: Print environment variables | ||
run: printenv | ||
|
||
- name: Run Cypress tests | ||
run: yarn serve:integration & yarn test:integration -s $(node .github/split.js) | ||
env: | ||
WORKER_NUM: ${{ matrix.worker }} | ||
WORKER_COUNT: 5 |
Oops, something went wrong.