forked from auth0-samples/auth0-react-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
87 lines (83 loc) · 2.62 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
# 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_AUDIENCE = API Audience to use in test
# Jobs and Workflows
version: 2.1
orbs:
node: circleci/[email protected]
docker: circleci/[email protected]
jobs:
checkout:
docker:
- image: cimg/node:lts
steps:
- checkout
- run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts
- persist_to_workspace:
root: ~/
paths:
- project
- scripts
sample-01:
docker:
- image: cimg/node:lts
environment:
- AUTH0_CFG: Sample-01/src/auth_config.json
- SAMPLE_PATH: Sample-01
steps:
- node/install:
install-yarn: true
- attach_workspace:
at: ~/
- run:
name: Replace Auth0 test credentials
command: |
echo "{ \"domain\": \"$AUTH0_TEST_DOMAIN\", \"clientId\": \"$AUTH0_TEST_CLIENT_ID\", \"audience\": \"$AUTH0_TEST_API_IDENTIFIER\" }" > $AUTH0_CFG
- setup_remote_docker:
version: 19.03.13
- run:
name: Build pull request
command: |
docker build -t $CIRCLE_JOB ./$SAMPLE_PATH
docker run -d -p 3000:3000 --name $CIRCLE_SHA1 $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
- node/install-packages:
pkg-manager: yarn
app-dir: Sample-01
- run:
name: Run unit tests
command: |
cd Sample-01
yarn test
- run:
name: Run integration tests
command: |
docker create --network host --name tester codeceptjs/codeceptjs codeceptjs run-multiple --all --steps --verbose
docker cp $(pwd)/lock_login_spa_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
workflows:
version: 2
quickstarts_login:
jobs:
- checkout:
context: Quickstart SPA Test
- sample-01:
context: Quickstart SPA Test
requires:
- checkout