diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..8cd4c0c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,40 @@ +version: 2.1 + +workflows: + test: + jobs: + - build-run-linux: + context: hello-world-demos + + test-daily: + triggers: + - schedule: + cron: "0 6 * * *" + filters: + branches: + only: main + jobs: + - build-run-linux: + context: hello-world-demos + +# This CI build ensures that the demo both compiles and works correctly. For the runtime test, +# we use an SDK key and flag key that are passed in via the CircleCI project configuration; +# the flag is configured to return a true value. + +jobs: + build-run-linux: + docker: + - image: circleci/node:latest + steps: + - checkout + - run: + name: insert SDK key and flag key into demo code + command: | + sed -i.bak "s/sdkKey *= *\".*\"/sdkKey = \"${LD_HELLO_WORLD_SDK_KEY}\"/" index.ts + sed -i.bak "s/featureFlagKey *= *\".*\"/featureFlagKey = \"${LD_HELLO_WORLD_FLAG_KEY_WITH_TRUE_VALUE}\"/" index.ts + - run: npm install + - run: + name: run demo + command: | + npm start | tee output.txt + grep "is true for this user" output.txt || (echo "Flag did not evaluate to expected true value" && exit 1) diff --git a/.gitignore b/.gitignore index b512c09..d5f19d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +package-lock.json diff --git a/package.json b/package.json index c0f7519..3f969cf 100644 --- a/package.json +++ b/package.json @@ -4,14 +4,12 @@ "description": "Hello LaunchDarkly for Node.js with TypeScript", "main": "index.ts", "scripts": { - "start": "npm run build:live", - "build:live": "nodemon --exec ./node_modules/.bin/ts-node -- ./index.ts" + "start": "ts-node ./index.ts" }, "author": "LaunchDarkly ", "license": "Apache-2.0", "devDependencies": { "@types/node": "8.0.4", - "nodemon": "1.11.0", "ts-node": "3.1.0", "typescript": "2.4.1" },