diff --git a/ci/pipeline.yml b/ci/pipeline.yml new file mode 100644 index 00000000..633792e5 --- /dev/null +++ b/ci/pipeline.yml @@ -0,0 +1,34 @@ +--- +resource_types: + - name: npm-cache + type: docker-image + source: + repository: ymedlop/npm-cache-resource + tag: latest +resources: + - name: hello_hapi + type: git + source: &repo-source + uri: https://github.com/hamidval/hello_hapi + branch: pipeline + - name: dependency-cache + type: npm-cache + source: + <<: *repo-source + paths: + - package.json +jobs: + - name: Install dependencies + plan: + - get: hello_hapi + trigger: true + - get: dependency-cache + - name: Run tests + plan: + - get: hello_hapi + trigger: true + passed: [Install dependencies] + - get: dependency-cache + passed: [Install dependencies] + - task: run the test suite + file: hello_hapi/ci/tasks/run_tests.yml \ No newline at end of file diff --git a/ci/scripts/run_tests.sh b/ci/scripts/run_tests.sh new file mode 100644 index 00000000..70fc1e76 --- /dev/null +++ b/ci/scripts/run_tests.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -e -u -x + +mv dependency-cache/node_modules hello_hapi +cd hello_hapi && npm test \ No newline at end of file diff --git a/ci/scripts/run_tests.yml b/ci/scripts/run_tests.yml new file mode 100644 index 00000000..70fc1e76 --- /dev/null +++ b/ci/scripts/run_tests.yml @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -e -u -x + +mv dependency-cache/node_modules hello_hapi +cd hello_hapi && npm test \ No newline at end of file diff --git a/ci/tasks/run_tests.yml b/ci/tasks/run_tests.yml new file mode 100644 index 00000000..1b558d88 --- /dev/null +++ b/ci/tasks/run_tests.yml @@ -0,0 +1,15 @@ +--- +platform: linux + +image_resource: + type: docker-image + source: + repository: node + tag: latest + +inputs: + - name: hello_hapi + - name: dependency-cache + +run: + path: hello_hapi/ci/scripts/run_tests.sh \ No newline at end of file