forked from aws-amplify/amplify-js
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (125 loc) · 4.18 KB
/
callable-e2e-test.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
name: E2E Test
run-name: e2e.${{ inputs.test_name }}
on:
workflow_call:
inputs:
test_name:
required: true
type: string
framework:
required: true
type: string
category:
required: true
type: string
sample_name:
required: true
type: string
spec:
required: true
type: string
browser:
required: true
type: string
backend:
required: true
type: string
amplifyjs_dir:
required: true
type: boolean
timeout_minutes:
required: true
type: number
retry_count:
required: true
type: number
env:
AMPLIFY_DIR: /home/runner/work/amplify-js/amplify-js/amplify-js
CYPRESS_GOOGLE_CLIENTID: ${{ secrets.CYPRESS_GOOGLE_CLIENTID }}
CYPRESS_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_GOOGLE_CLIENT_SECRET }}
CYPRESS_GOOGLE_REFRESH_TOKEN: ${{ secrets.CYPRESS_GOOGLE_REFRESH_TOKEN }}
jobs:
e2e-test:
name: E2E ${{ inputs.test_name }}
runs-on: ubuntu-latest
strategy:
matrix:
browser:
- ${{ fromJson(inputs.browser) }}
sample_name:
- ${{ fromJson(inputs.sample_name) }}
fail-fast: false
timeout-minutes: ${{ inputs.timeout_minutes }}
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: amplify-js
- name: Setup node and build the repository
uses: ./amplify-js/.github/actions/node-and-build
- name: Setup samples staging repository
uses: ./amplify-js/.github/actions/setup-samples-staging
with:
GH_TOKEN_STAGING_READ: ${{ secrets.GH_TOKEN_STAGING_READ }}
- name: Load Verdaccio with AmplifyJs
uses: ./amplify-js/.github/actions/load-verdaccio-with-amplify-js
- name: Run cypress tests for ${{ inputs.test_name }} dev
shell: bash
working-directory: amplify-js-samples-staging
env:
E2E_FRAMEWORK: ${{ inputs.framework }}
E2E_CATEGORY: ${{ inputs.category }}
E2E_SAMPLE_NAME: ${{ matrix.sample_name }}
E2E_SPEC: ${{ inputs.spec }}
E2E_BROWSER: ${{ matrix.browser }}
E2E_BACKEND: ${{ inputs.backend }}
E2E_AMPLIFY_JS_DIR: ${{ inputs.amplifyjs_dir == true && env.AMPLIFY_DIR || ''}}
E2E_RETRY_COUNT: ${{ inputs.retry_count }}
E2E_TEST_NAME: ${{ inputs.test_name }}
run: |
../amplify-js/scripts/retry-yarn-script.sh -s \
"ci:test \
$E2E_FRAMEWORK \
$E2E_CATEGORY \
$E2E_SAMPLE_NAME \
$E2E_SPEC \
$E2E_BROWSER \
dev \
$E2E_BACKEND \
$E2E_AMPLIFY_JS_DIR" \
-n $E2E_RETRY_COUNT
- name: Run cypress tests for ${{ inputs.test_name }} prod
shell: bash
working-directory: amplify-js-samples-staging
env:
E2E_FRAMEWORK: ${{ inputs.framework }}
E2E_CATEGORY: ${{ inputs.category }}
E2E_SAMPLE_NAME: ${{ matrix.sample_name }}
E2E_SPEC: ${{ inputs.spec }}
E2E_BROWSER: ${{ matrix.browser }}
E2E_BACKEND: ${{ inputs.backend }}
E2E_AMPLIFY_JS_DIR: ${{ inputs.amplifyjs_dir == true && env.AMPLIFY_DIR || ''}}
E2E_RETRY_COUNT: ${{ inputs.retry_count }}
E2E_TEST_NAME: ${{ inputs.test_name }}
run: |
../amplify-js/scripts/retry-yarn-script.sh -s \
"ci:test \
$E2E_FRAMEWORK \
$E2E_CATEGORY \
$E2E_SAMPLE_NAME \
$E2E_SPEC \
$E2E_BROWSER \
prod \
$E2E_BACKEND \
$E2E_AMPLIFY_JS_DIR" \
-n $E2E_RETRY_COUNT
- name: Upload artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 https://github.com/actions/upload-artifact/commit/0b7f8abb1508181956e8e162db84b466c27e18ce
if: failure()
with:
name: ${{ inputs.test_name }}
if-no-files-found: ignore
path: |
amplify-js-samples-staging/cypress/videos
amplify-js-samples-staging/cypress/screenshots
retention-days: 14