-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
99 lines (85 loc) · 2.85 KB
/
build-examples.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: Build All Examples
on:
pull_request:
paths:
- "packages/**"
- "examples/**"
types:
- labeled
- synchronize
- opened
- reopened
- ready_for_review
push:
branches:
- master
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
inputs:
environment:
description: "Environment to run tests against"
type: environment
required: false
jobs:
chunks:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-build-examples
cancel-in-progress: true
name: Create Example Chunks
if: "${{ !github.event.pull_request.draft }}"
outputs:
CHUNKS: ${{ steps.chunkstep.outputs.CHUNKS }}
steps:
- name: Get PR labels
id: pr-labels
uses: joerick/[email protected]
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
run_install: |
- recursive: false
args: [--ignore-scripts]
- name: Fetch commits
run: git fetch origin ${{ github.base_ref || 'master' }} --depth=1
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Split Into Chunks
id: chunkstep
run: CHUNKS=6 BASE_REF=${{ github.base_ref }} BUILD_ALL_EXAMPLES=${{ (contains(steps.pr-labels.outputs.labels, ' build-examples ') || github.event_name == 'schedule' || github.event_name == 'synchronize' ) && 'true' || 'false' }} node ./.github/workflows/scripts/build-example-chunks.js
build-chunk:
runs-on: ubuntu-latest
needs: chunks
concurrency:
group: ${{ github.ref }}-${{ format('chunk-{0}', fromJson(format('[{0}]', matrix.chunk))[0]) }}
cancel-in-progress: false
strategy:
matrix:
chunk: ${{ fromJson(needs.chunks.outputs.CHUNKS) }}
steps:
- name: Get PR labels
id: pr-labels
uses: joerick/[email protected]
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Install Dependencies
run: |
pnpm install --ignore-scripts
pnpm cypress install
- name: Build
run: REFINE_NO_TELEMETRY=true pnpm build --no-bail --scope={${{ matrix.chunk }}}
- name: Get short SHA
id: slug
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
- name: Run E2E Tests
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ matrix.chunk }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-1-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js