This repository has been archived by the owner on Feb 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
/
config.yml
116 lines (112 loc) · 3.54 KB
/
config.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
# Environment variables to be defined in the build configuration:
# AUTH0_TEST_CLIENT_ID = Client id to use in test
# AUTH0_TEST_DOMAIN = Domain to use in test
# AUTH0_TEST_API_IDENTIFIER = API Audience to use in test
# Common logic
defaults: &defaults
steps:
- attach_workspace:
at: ~/
- run:
name: Replace Auth0 test credentials
command: |
echo "var AUTH0_CLIENT_ID='$AUTH0_TEST_CLIENT_ID';" >> $AUTH0_CFG
echo "var AUTH0_DOMAIN='$AUTH0_TEST_DOMAIN';" >> $AUTH0_CFG
echo "var AUTH0_AUDIENCE='$AUTH0_TEST_AUDIENCE';" >> $AUTH0_CFG
echo "var AUTH0_CALLBACK_URL=location.href;" >> $AUTH0_CFG
- run:
name: Build pull request
command: |
docker build -t $CIRCLE_JOB ./$SAMPLE_PATH
docker run -d -p 3000:3000 --name $CIRCLE_SHA1 -e AUTH0_DOMAIN=$AUTH0_TEST_DOMAIN -e AUTH0_AUDIENCE=$AUTH0_TEST_API_IDENTIFIER $CIRCLE_JOB
- run:
name: Wait for app to be available
command: |
sleep 10
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:3000
- run:
name: Run tests
command: |
docker create --network host --name tester codeception/codeceptjs codeceptjs run-multiple --all --steps --verbose
docker cp $(pwd)/lock_login_test.js tester:/tests/lock_login_test.js
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js
docker start -i tester
working_directory: scripts
- run:
name: Copy app container logs
command: |
mkdir -p /tmp/out
docker logs $CIRCLE_SHA1 > /tmp/out/app_logs.log
docker cp tester:/tests/out /tmp/
when: on_fail
- store_artifacts:
path: /tmp/out
# Jobs and Workflows
version: 2
jobs:
checkout:
machine: true
steps:
- checkout
- run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts
- persist_to_workspace:
root: ~/
paths:
- project
- scripts
01-login:
machine: true
environment:
- AUTH0_CFG: 01-Login/auth0-variables.js
- SAMPLE_PATH: 01-Login
<<: *defaults
02-user-profile:
machine: true
environment:
- AUTH0_CFG: 02-User-Profile/auth0-variables.js
- SAMPLE_PATH: 02-User-Profile
<<: *defaults
03-calling-an-api:
machine: true
environment:
- AUTH0_CFG: 03-Calling-an-API/auth0-variables.js
- SAMPLE_PATH: 03-Calling-an-API
<<: *defaults
04-authorization:
machine: true
environment:
- AUTH0_CFG: 04-Authorization/auth0-variables.js
- SAMPLE_PATH: 04-Authorization
<<: *defaults
05-token-renewal:
machine: true
environment:
- AUTH0_CFG: 05-Token-Renewal/auth0-variables.js
- SAMPLE_PATH: 05-Token-Renewal
<<: *defaults
workflows:
version: 2
quickstarts_login:
jobs:
- checkout:
context: Quickstart SPA Test
- 01-login:
context: Quickstart SPA Test
requires:
- checkout
- 02-user-profile:
context: Quickstart SPA Test
requires:
- checkout
- 03-calling-an-api:
context: Quickstart SPA Test
requires:
- checkout
- 04-authorization:
context: Quickstart SPA Test
requires:
- checkout
- 05-token-renewal:
context: Quickstart SPA Test
requires:
- checkout