Skip to content

Commit 6d742ce

Browse files
authored
add CI configuration (#3)
* add CI configuration * don't use nodemon - we want it to just run and exit * remove test SDK key (note, this was just a test environment, it's not a disaster if it is in the Git history)
1 parent 854d7e0 commit 6d742ce

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

.circleci/config.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: 2.1
2+
3+
workflows:
4+
test:
5+
jobs:
6+
- build-run-linux:
7+
context: hello-world-demos
8+
9+
test-daily:
10+
triggers:
11+
- schedule:
12+
cron: "0 6 * * *"
13+
filters:
14+
branches:
15+
only: main
16+
jobs:
17+
- build-run-linux:
18+
context: hello-world-demos
19+
20+
# This CI build ensures that the demo both compiles and works correctly. For the runtime test,
21+
# we use an SDK key and flag key that are passed in via the CircleCI project configuration;
22+
# the flag is configured to return a true value.
23+
24+
jobs:
25+
build-run-linux:
26+
docker:
27+
- image: circleci/node:latest
28+
steps:
29+
- checkout
30+
- run:
31+
name: insert SDK key and flag key into demo code
32+
command: |
33+
sed -i.bak "s/sdkKey *= *\".*\"/sdkKey = \"${LD_HELLO_WORLD_SDK_KEY}\"/" index.ts
34+
sed -i.bak "s/featureFlagKey *= *\".*\"/featureFlagKey = \"${LD_HELLO_WORLD_FLAG_KEY_WITH_TRUE_VALUE}\"/" index.ts
35+
- run: npm install
36+
- run:
37+
name: run demo
38+
command: |
39+
npm start | tee output.txt
40+
grep "is true for this user" output.txt || (echo "Flag did not evaluate to expected true value" && exit 1)

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
node_modules
2+
package-lock.json

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
"description": "Hello LaunchDarkly for Node.js with TypeScript",
55
"main": "index.ts",
66
"scripts": {
7-
"start": "npm run build:live",
8-
"build:live": "nodemon --exec ./node_modules/.bin/ts-node -- ./index.ts"
7+
"start": "ts-node ./index.ts"
98
},
109
"author": "LaunchDarkly <team@launchdarkly.com>",
1110
"license": "Apache-2.0",
1211
"devDependencies": {
1312
"@types/node": "8.0.4",
14-
"nodemon": "1.11.0",
1513
"ts-node": "3.1.0",
1614
"typescript": "2.4.1"
1715
},

0 commit comments

Comments
 (0)