-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (113 loc) · 3.67 KB
/
tests-e2e.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
name: Tests - e2e
on:
workflow_call:
inputs:
BUN_VERSION:
required: true
type: string
TAG:
required: true
type: string
APPS:
required: true
type: string
BROWSERS:
required: true
type: string
workflow_dispatch:
inputs:
BUN_VERSION:
description: Bun version used to run tests
required: true
type: string
default: 1.1.43
TAG:
description: Image tag used to run tests
required: true
type: string
default: latest
APPS:
description: Comma separeted application list to run tests on (Options are 'api', 'docs')
required: false
type: string
default: "api,docs"
BROWSERS:
description: Comma separeted browser list to run tests on (Options are 'electron', 'chrome', 'edge', 'firefox')
required: false
type: string
default: electron
jobs:
infos:
name: Generate browsers matrix
runs-on: ubuntu-latest
outputs:
browsers: ${{ steps.build-matrix.outputs.BROWSERS }}
apps: ${{ steps.build-matrix.outputs.APPS }}
steps:
- name: Generate matrix
id: build-matrix
run: |
BROWSERS=$(echo "\"${{ inputs.BROWSERS }}\"" | jq -c 'split(",")')
APPS=$(echo "\"${{ inputs.APPS }}\"" | jq -c 'split(",")')
echo "BROWSERS=$BROWSERS" >> $GITHUB_OUTPUT
echo "APPS=$APPS" >> $GITHUB_OUTPUT
e2e-tests:
name: End to end tests
runs-on: ubuntu-latest
needs:
- infos
strategy:
matrix:
browsers: ${{ fromJson(needs.infos.outputs.browsers) }}
apps: ${{ fromJson(needs.infos.outputs.apps) }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v1
with:
bun-version: "${{ inputs.BUN_VERSION }}"
- name: Setup firefox
uses: browser-actions/setup-firefox@v1
if: ${{ matrix.browsers == 'firefox' }}
- name: Setup chrome
uses: browser-actions/setup-chrome@v1
if: ${{ matrix.browsers == 'chrome' }}
- name: Setup edge
uses: browser-actions/setup-edge@v1
if: ${{ matrix.browsers == 'edge' }}
- name: Get bun store directory
id: bun-store
run: |
echo "STORE_PATH=$(bun pm cache)" >> $GITHUB_OUTPUT
- name: Cache node files
uses: actions/cache@v4
with:
path: |
${{ steps.bun-store.outputs.STORE_PATH }}
key: node-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
node-${{ runner.os }}-${{ runner.arch }}-
- name: Cache turbo files
uses: actions/cache@v4
with:
path: |
./.turbo/cache
key: turbo-e2e-${{ runner.os }}-${{ runner.arch }}-${{ matrix.apps }}-${{ matrix.browsers }}-${{ hashFiles('apps/**/src/**','packages/**/src/**','cypress/src/**') }}
restore-keys: |
turbo-e2e-${{ runner.os }}-${{ runner.arch }}-${{ matrix.apps }}-${{ matrix.browsers }}-
turbo-e2e-${{ runner.os }}-${{ runner.arch }}-${{ matrix.apps }}-
turbo-e2e-${{ runner.os }}-${{ runner.arch }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run e2e tests
run: |
./ci/scripts/init-env.sh
./ci/scripts/run-tests.sh -e "--spec 'src/e2e/specs/${{ matrix.apps }}/*.e2e.ts' --browser '${{ matrix.browsers }}'" -t "${{ inputs.TAG }}"
- name: Upload cypress artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-report
path: ./apps/client/cypress/e2e/screenshots/
retention-days: 14