-
Notifications
You must be signed in to change notification settings - Fork 21
131 lines (116 loc) · 4.09 KB
/
build.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: ci
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
task: [lint, 'test:unit', 'test:unit-cypress', 'test:e2e:ci']
name: ${{ matrix.task }}
container:
image: cypress/browsers:node-16.18.1-chrome-110.0.5481.96-1-ff-109.0-edge-110.0.1587.41-1
# https://github.com/cypress-io/github-action#firefox Cypress FF image needs this user permissions to be able to install dependencies
options: --user 1001
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
# Install pnpm because it is not included in our container image
- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
- name: setup ENV variables
id: setup-env-vars
shell: bash
run: |
echo "CYPRESS_CACHE_FOLDER=$CYPRESS_CACHE_FOLDER" >> $GITHUB_OUTPUT
echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: setup pnpm cache
id: pnpm-cache
uses: actions/cache@v3
with:
path: |
${{ steps.setup-env-vars.outputs.PNPM_STORE_PATH }}
${{ steps.setup-env-vars.outputs.CYPRESS_CACHE_FOLDER }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: setup eslint cache
if: ${{ matrix.task == 'lint' }}
uses: actions/cache@v3
with:
path: '**/.eslintcache'
key: eslint-${{github.sha}}
restore-keys: eslint-
- name: setup lerna cache
id: lerna-cache
uses: actions/cache@v3
with:
path: |
node_modules/.cache
key: lerna-cache-${{matrix.task}}-${{github.sha}}
restore-keys: |
lerna-cache-${{matrix.task}}
- name: install dependencies
run: pnpm install
- name: Run ${{ matrix.task }}
run: npm run ${{ matrix.task }}
release:
if:
${{ github.ref_name == 'main' && github.actor != 'support-empathy' &&
!startsWith(github.event.head_commit.message, 'chore(release):') }}
needs: [build]
runs-on: ubuntu-latest
container:
image: cypress/browsers:node-18.16.0-chrome-112.0.5615.121-1-ff-112.0.1-edge-112.0.1722.48-1
# https://github.com/cypress-io/github-action#firefox Cypress FF image needs this user permissions to be able to install dependencies
options: --user 1001
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
# Install pnpm because it is not included in our container image
- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
- name: setup ENV variables
id: setup-env-vars
shell: bash
run: |
echo "CYPRESS_CACHE_FOLDER=$CYPRESS_CACHE_FOLDER" >> $GITHUB_OUTPUT
echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: setup pnpm cache
id: pnpm-cache
uses: actions/cache@v3
with:
path: |
${{ steps.setup-env-vars.outputs.PNPM_STORE_PATH }}
${{ steps.setup-env-vars.outputs.CYPRESS_CACHE_FOLDER }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: setup lerna cache
id: lerna-cache
uses: actions/cache@v3
with:
key: lerna-cache-${{github.sha}}
path: |
node_modules/.cache
restore-keys: |
lerna-cache-
- name: install dependencies
run: pnpm install
- name: Release alpha on non-release pushes to main branch
uses: ./.github/actions/release-alpha
with:
npm_token: ${{ secrets.NPM_TOKEN }}
github_token: ${{ secrets.SUPPORT_TOKEN }}