Skip to content

fix: hcrc v1 major release #1794

fix: hcrc v1 major release

fix: hcrc v1 major release #1794

Workflow file for this run

name: CI-packages
on:
push:
branches:
- dev
- main
paths:
- 'packages/**'
- '.yarnrc.yml'
- 'yarn.lock'
- '.prettier*'
- 'tsconfig.base.json'
- '.prettier*'
- '.github/workflows/**'
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- 'packages/**'
- '.yarnrc.yml'
- 'yarn.lock'
- '.prettier*'
- 'tsconfig.base.json'
- '.prettier*'
- '.github/workflows/**'
env:
CI: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
with:
# Fetch all git history so that yarn workspaces --since can compare with the correct commits
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# Why not using setup-node 2.2+ cache option (yet) ?
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
restore-keys: |
yarn-cache-folder-
- name: Restore packages cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/**/tsconfig.tsbuildinfo
key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }}
restore-keys: |
${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-
- name: Install dependencies
run: |
yarn install --immutable --inline-builds
env:
HUSKY: 0
# Typecheck packages that have changed + packages and apps that depends on them (--from & --since)
# That allows to see if we're introducing "surface" regressions (just the types)
- name: Typecheck
run: |
yarn workspaces foreach -tv --from 'events-helsinki-*' --since=origin/main --recursive run typecheck
# Lint packages that have changed (--include & --since)
- name: Linter
run: |
yarn workspaces foreach -tv --include 'events-helsinki-*' --since=origin/main --recursive run lint
yarn workspaces foreach -tv --include 'events-helsinki-*' --since=origin/main --recursive run lint-styles
# Test packages that have changed (--include & --since)
- name: Unit tests changed packages
run: |
yarn workspaces foreach -tv --include 'events-helsinki-*' --since=origin/main --recursive run test
# to debug cache issues: ls ${{ github.workspace }}/.cache
# Build packages that have changed (--include & --since), assuming that
# apps build are done already. Otherwise --from & --since
- name: Run build for changed packages
run: |
yarn workspaces foreach -tv --include 'events-helsinki-*' --since=origin/main run build
# Test storybook build on packages that have changed (--include & --since)
- name: Run storybook build for changed packages
run: |
yarn workspaces foreach -tv --exclude hobbies-helsinki --exclude events-helsinki --exclude sports-helsinki --since=origin/main run build-storybook