Skip to content

Commit 765039a

Browse files
authored
Merge pull request #32 from rafanog/master
Reviewed and refactored CircleCI Build
2 parents b090329 + c8850fe commit 765039a

1 file changed

Lines changed: 50 additions & 39 deletions

File tree

.circleci/config.yml

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
version: 2
2-
jobs:
3-
build:
4-
working_directory: ~/repo/00-Starter-Seed
5-
machine: true
6-
1+
# Common Logic
2+
defaults: &defaults
73
steps:
8-
- checkout:
9-
path: ~/repo
10-
11-
- run:
12-
name: Set .env file
13-
command: |
14-
echo "AUTH0_DOMAIN=$auth0_domain" >> .env
15-
echo "API_IDENTIFIER=$api_identifier" >> .env
16-
17-
- run:
18-
name: background server
19-
command: sh exec.sh
20-
background: true
21-
4+
- attach_workspace:
5+
at: ~/
226
- run:
23-
name: Wait until server is online
24-
command: |
25-
until $(curl --output /dev/null --silent --head --fail http://localhost:3010/api/public); do
26-
sleep 5
27-
done
28-
7+
name: Prepare environment variables
8+
command: |
9+
cd $AUTH0_CFG
10+
mv .env.example .env
11+
sed -i 's/{DOMAIN}/'$auth0_domain'/g' .env
12+
sed -i 's/{API_IDENTIFIER}/'$api_identifier'/g' .env
2913
- run:
30-
name: Clone script test
31-
command: git clone https://github.com/auth0-samples/api-quickstarts-tests test
32-
33-
- run:
34-
name: Prepare environment variables for test
14+
name: Background Server
15+
command: cd $AUTH0_CFG && sh exec.sh
16+
background: true
17+
- run:
18+
name: Wait until server is online
19+
command: |
20+
until $(curl --silent --head --output /dev/null --fail http://localhost:3010/api/public); do
21+
sleep 5
22+
done
23+
- run:
24+
name: Prepare tests
3525
command: |
3626
cd test
3727
echo "AUTH0_DOMAIN=$auth0_domain" >> .env
@@ -45,17 +35,38 @@ jobs:
4535
echo "AUTH0_CLIENT_ID_4=$client_id_scopes_readwrite" >> .env
4636
echo "AUTH0_CLIENT_SECRET_4=$client_secret_scopes_readwrite" >> .env
4737
echo "API_URL=http://localhost:3010" >> .env
48-
38+
npm install
4939
- run:
50-
name: Install test script dependency
51-
command: cd test && npm install
52-
40+
name: Execute automated tests
41+
command: cd test && npm test
42+
# Jobs and Workflows
43+
version: 2
44+
jobs:
45+
checkout:
46+
machine: true
47+
steps:
48+
- checkout
5349
- run:
54-
name: Test
55-
command: cd test && npm test
50+
name: Clone test script
51+
command: git clone https://github.com/auth0-samples/api-quickstarts-tests test
52+
- persist_to_workspace:
53+
root: ~/
54+
paths:
55+
- project
56+
- test
57+
00-Starter-Seed:
58+
machine: true
59+
environment:
60+
- AUTH0_CFG: 00-Starter-Seed
61+
- SAMPLE_PATH: 00-Starter-Seed
62+
<<: *defaults
5663
workflows:
5764
version: 2
58-
build:
65+
API-Tests:
5966
jobs:
60-
- build:
67+
- checkout:
68+
context: Quickstart API Tests
69+
- 00-Starter-Seed:
6170
context: Quickstart API Tests
71+
requires:
72+
- checkout

0 commit comments

Comments
 (0)