-
Notifications
You must be signed in to change notification settings - Fork 262
109 lines (99 loc) · 3.48 KB
/
e2e-validation.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
name: Cypress E2E Tests
on:
workflow_call:
inputs:
environment:
type: string
required: true
description: "where to deploy"
workflow_dispatch:
inputs:
environment:
type: choice
required: true
description: "where to deploy"
default: "tools"
options:
- tools
- production
jobs:
define-test-matrix:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.tests.outputs.tests }}
steps:
- uses: actions/checkout@v3
- id: tests
working-directory: app/web/cypress/e2e
run: |
# get the names of all test subdirs with out slashes
test_dirs=$(find . -mindepth 1 -maxdepth 1 -type d | sed 's|^\./||')
test_array="[]"
# put them into an array
for d in $test_dirs; do
test_array=$(echo "$test_array" | jq --arg d "$d" '. += [$d]')
done
test_array=$(echo "$test_array" | jq -c '.')
echo "$test_array"
echo "tests=$test_array" >> "$GITHUB_OUTPUT"
cypress-tests:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
needs: define-test-matrix
strategy:
# don't fail the entire matrix on failure
fail-fast: false
matrix:
# run copies of the current job in parallel split by test dir
# TODO: we really should build once and set it as an
# artifact so we aren't rebuilding for each of these
tests: ${{ fromJSON(needs.define-test-matrix.outputs.tests) }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.18.2'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.10.5
- name: Install Cypress
working-directory: app/web
run: |
pnpm i
pnpm install cypress
- name: install uuid
run: |
sudo apt update
sudo apt install uuid -y
- run: |
cd app/web
export VITE_AUTH0_USERNAME=${{ secrets.VITE_AUTH0_USERNAME }}
export VITE_AUTH0_PASSWORD=${{ secrets.VITE_AUTH0_PASSWORD }}
export VITE_SI_CYPRESS_MULTIPLIER=${{ vars.VITE_SI_CYPRESS_MULTIPLIER }}
export VITE_SI_WORKSPACE_URL=${{ vars.VITE_SI_WORKSPACE_URL }}
export VITE_HOST_URL=${{ vars.VITE_SI_WORKSPACE_URL }}
export VITE_SI_WORKSPACE_ID=${{ vars.VITE_SI_WORKSPACE_ID }}
export VITE_UUID=$(uuid)
export VITE_AUTH_API_URL=https://auth-api.systeminit.com
export VITE_AUTH_PORTAL_URL=https://auth.systeminit.com
npx cypress run --spec "cypress/e2e/${{ matrix.tests }}/**"
- name: 'Upload Cypress Recordings to Github'
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-recordings-run-${{ matrix.tests }}
path: app/web/cypress/videos/**/*.mp4
retention-days: 5
#
# on-failure:
# runs-on: ubuntu-latest
# needs: cypress-tests
# if: ${{ always() && contains(needs.*.result, 'failure') }}
# steps:
# - run: |
# curl -X POST \
# -H 'Content-type: application/json' \
# --data "{\"text\": \":si: Failed Cypress E2E Test for ${{ inputs.environment }}: <https://github.com/systeminit/si/actions/runs/$GITHUB_RUN_ID|:test_tube: Link>\"}" ${{ secrets.SLACK_WEBHOOK_URL }}