-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (80 loc) · 2.5 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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