1+ name : ci
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches : [main]
7+
8+ jobs :
9+ detectChangedSourceFiles :
10+ name : ' determine changes'
11+ runs-on : ubuntu-latest
12+ outputs :
13+ changes : ${{ steps.changed-files-yaml.outputs.src_any_changed }}
14+ steps :
15+ - uses : actions/checkout@v3
16+ - name : Detect changed files
17+ id : changed-files-yaml
18+ uses : tj-actions/changed-files@v39
19+ with :
20+ files_yaml : |
21+ src:
22+ - packages/formik/src/**
23+ - packages/formik/package.json
24+ - packages/formik-native/src/**
25+ - packages/formik-native/package.json
26+ benchmark :
27+ if : needs.detectChangedSourceFiles.outputs.changes == 'true'
28+ runs-on : ubuntu-latest
29+ strategy :
30+ fail-fast : false
31+ steps :
32+ - uses : actions/checkout@v3
33+
34+ - uses : actions/setup-node@v3
35+ with :
36+ cache : yarn
37+ node-version-file : .nvmrc
38+
39+ - name : Detect changed files
40+ id : changed-files-yaml
41+ uses : tj-actions/changed-files@v39
42+ with :
43+ files_yaml : |
44+ src:
45+ - packages/formik/src/**
46+ - packages/formik-native/src/**
47+
48+ - name : Install & build
49+ run : |
50+ node --version
51+ npm --version
52+ yarn --version
53+ yarn install --frozen-lockfile
54+ yarn build:benchmark
55+
56+ - name : Download previous benchmark data
57+ uses : actions/cache@v3
58+ with :
59+ path : ./benchmark-cache
60+ key : ${{ runner.os }}-benchmark
61+
62+ - name : Run benchmark
63+ run : yarn benchmark
64+
65+ - name : Store benchmark result
66+ uses : benchmark-action/github-action-benchmark@v1
67+ with :
68+ tool : benchmarkjs
69+ external-data-json-path : ./benchmark-cache/benchmark-data.json
70+ output-file-path : output.txt
71+ # comment for PRs that's updated with current perf relative to baseline (main)
72+ summary-always : true
73+ # warn if slowness is detected; might be transient on rerun
74+ alert-threshold : 110%
75+ comment-on-alert : true
76+ fail-on-alert : true
77+ # if things get considerably slower, deny the PR
78+ fail-threshold : 120%
79+ # needed for commenting on PRs
80+ github-token : ${{ secrets.GITHUB_TOKEN }}
81+ interaction :
82+ if : needs.detectChangedSourceFiles.outputs.changes == 'true'
83+ timeout-minutes : 10
84+ runs-on : ubuntu-latest
85+ steps :
86+ - uses : actions/checkout@v3
87+ - uses : actions/setup-node@v3
88+ with :
89+ cache : yarn
90+ node-version-file : .nvmrc
91+
92+ - name : Install dependencies
93+ run : yarn install --frozen-lockfile
94+
95+ - name : Get installed Playwright version
96+ id : playwright-version
97+ run : echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV
98+
99+ - name : Cache playwright binaries
100+ uses : actions/cache@v3
101+ id : playwright-cache
102+ with :
103+ path : |
104+ ~/.cache/ms-playwright
105+ key : ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
106+
107+ - name : Install Playwright Browsers
108+ run : yarn playwright install --with-deps
109+ if : steps.playwright-cache.outputs.cache-hit != 'true'
110+ - run : yarn playwright install-deps
111+ if : steps.playwright-cache.outputs.cache-hit != 'true'
112+
113+ - name : Run Playwright tests
114+ run : yarn playwright test
115+ - uses : actions/upload-artifact@v3
116+ if : always()
117+ with :
118+ name : playwright-report
119+ path : playwright-report/
120+ retention-days : 5
121+ size :
122+ if : needs.detectChangedSourceFiles.outputs.changes == 'true'
123+ runs-on : ubuntu-latest
124+ steps :
125+ - uses : actions/checkout@v3
126+ with :
127+ fetch-depth : 1
128+ - uses : preactjs/compressed-size-action@v2
129+ with :
130+ repo-token : ' ${{ secrets.GITHUB_TOKEN }}'
131+ build-script : ' turbo run build --filter {./packages/*}...'
132+ unit :
133+ if : needs.detectChangedSourceFiles.outputs.changes == 'true'
134+ runs-on : ubuntu-latest
135+ strategy :
136+ fail-fast : false
137+ steps :
138+ - uses : actions/checkout@v3
139+ - uses : actions/setup-node@v3
140+ with :
141+ cache : yarn
142+ node-version-file : .nvmrc
143+ - name : Install deps, build, and test
144+ run : |
145+ node --version
146+ npm --version
147+ yarn --version
148+ yarn install --frozen-lockfile
149+ yarn test --coverage
150+ env :
151+ CI : true
152+ NODE_OPTIONS : --max-old-space-size=4096
0 commit comments