Skip to content

Adam/react 18 migration fork #7888

Adam/react 18 migration fork

Adam/react 18 migration fork #7888

Workflow file for this run

name: Node.js CI
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
install:
name: Install node modules
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- name: Install
run: yarn install --frozen-lockfile --prefer-offline
outputs:
yarn-cache-dir: ${{ steps.get-yarn-cache-dir.outputs.dir }}
lints:
name: Check lints
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- name: prettier
run: yarn check:prettier
- name: eslint
run: yarn check:eslint --format junit -o reports/junit/js-lint-results.xml
types:
name: Check types
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/cache/restore@v3
name: Restore TS cache
id: ts-cache
with:
path: |
**/dist/**/*.ts
!**/node_modules
key: ${{ runner.os }}-ts-cache-${{ hashFiles('**/tsconfig.js', '**/package.tsconfig.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- name: types
run: yarn check:ts
deps:
name: Check dependency list
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- name: deps
run: yarn check:deps
- name: package.json versions
run: yarn check:package-json
build:
name: Build packages
runs-on: ubuntu-latest
needs: [install, lints]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
name: Check for build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
# Only setup & build if there was no build cache hit
- name: Use Node.js 16
uses: actions/setup-node@v3
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- name: Install
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn install --frozen-lockfile --prefer-offline
- name: build
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn build:packages
build-ts:
name: Build TypeScript
runs-on: ubuntu-latest
needs: [install, lints]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
name: Check for ts cache
id: ts-cache
with:
path: |
**/dist/**/*.ts
!**/node_modules
key: ${{ runner.os }}-ts-cache-${{ hashFiles('**/tsconfig.js', '**/package.tsconfig.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- name: Use Node.js 16
if: ${{ steps.ts-cache.outputs.cache-hit != 'true' }}
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- name: Install
if: ${{ steps.ts-cache.outputs.cache-hit != 'true' }}
run: yarn install --frozen-lockfile --prefer-offline
- name: build-ts
if: ${{ steps.ts-cache.outputs.cache-hit != 'true' }}
run: yarn build:ts
chromatic:
name: Chromatic
runs-on: ubuntu-latest
needs: [install, build]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: 'build-storybook'
exitOnceUploaded: true
exitZeroOnChanges: true
tests:
name: Run tests
runs-on: ubuntu-latest
needs: [install, build]
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- name: tests
run: yarn test --no-cache --ci --runInBand --reporters=default --reporters=jest-junit
env:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
tests-ssr:
name: Run tests with artificial server rendering
runs-on: ubuntu-latest
needs: [install, build]
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- name: tests
run: yarn test --ssr --no-cache --ci --runInBand --reporters=default --reporters=jest-junit
env:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-ssr-results.xml'
checkBuilds:
name: Verify builds
runs-on: ubuntu-latest
needs: [install, build, build-ts]
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- uses: actions/cache/restore@v3
name: Restore TS cache
id: ts-cache
with:
path: |
**/dist/**/*.ts
!**/node_modules
key: ${{ runner.os }}-ts-cache-${{ hashFiles('**/tsconfig.js', '**/package.tsconfig.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- name: check builds
run: yarn check:builds
sizeDiff:
name: Check file size
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
cache-dependency-path: 'yarn.lock'
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/cache/restore@v3
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
- uses: preactjs/compressed-size-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
clean-script: 'clean:builds && clean:modules'
build-script: 'build:packages'