파이프라인 구축 #46
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
name: CI | |
permissions: | |
pull-requests: write | |
contents: read | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: ${{ github.actor != 'l10nbot' }} # Avoid running for 'l10nbot' | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
outputs: | |
cache-hit: ${{ steps.cache.outputs.cache-hit }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Enable Corepack (for Yarn 2) | |
run: | | |
corepack enable | |
corepack prepare [email protected] --activate | |
- name: Cache Yarn dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.yarn/cache | |
.yarn/unplugged | |
.yarn/build-state.yml | |
.yarn/install-state.gz | |
.pnp.* | |
key: ${{ runner.os }}-yarn-berry-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-berry- | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --immutable | |
- name: Install TurboRepo | |
run: yarn add turbo --dev | |
- name: Prettier check | |
run: yarn format --check | |
- name: Lint | |
run: yarn lint | |
- name: Run tests | |
run: yarn turbo run test --filter=@zagdang/ui -- --runInBand --ci | |
- name: Build project | |
run: | | |
yarn turbo build --parallel | |
env: | |
NODE_OPTIONS: --max_old_space_size=4096 | |
- name: Cache Storybook build | |
id: cache-storybook | |
uses: actions/cache@v3 | |
with: | |
path: packages/ui/storybook-static | |
key: ${{ runner.os }}-storybook-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-storybook- | |
- name: Build Storybook | |
if: steps.cache-storybook.outputs.cache-hit != 'true' | |
run: yarn turbo run build-storybook -- --quiet | |
required: | |
needs: [build] | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: fail if conditional jobs failed | |
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled') | |
run: exit 1 |