From d543dfb2010f186f242407284016ffe34669f78c Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 19:45:56 +0100 Subject: [PATCH 01/12] Added drone pipeline that automaticly runs on prs (or at least it should) ref #23 --- .drone.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..238cce8 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,13 @@ +--- +kind: pipeline +name: tests:latest + +steps: +- name: run tests + image: node:alpine + commands: + - npm install + - npm test +trigger: + event: + - pull_request \ No newline at end of file From abb13045e6857057515aab77d8aacb6ef9e23e82 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 19:47:35 +0100 Subject: [PATCH 02/12] Switched to yarn ref #23 --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 238cce8..5e1ca7e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,8 +6,8 @@ steps: - name: run tests image: node:alpine commands: - - npm install - - npm test + - yarn + - yarn test trigger: event: - pull_request \ No newline at end of file From 79e418f91883f90827453fdf5fe031cf777173da Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 19:56:27 +0100 Subject: [PATCH 03/12] Added a test:ci script (for testing in ci enviornments) ref #23 --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index b59be18..f0f8d45 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "jest": "^26.6.3", "nodemon": "^2.0.6", "sqlite3": "^5.0.0", + "start-server-and-test": "^1.11.6", "ts-jest": "^26.4.4", "ts-node": "^9.0.0", "typedoc": "^0.19.2", @@ -69,7 +70,8 @@ "build": "tsc", "docs": "typedoc --out docs src", "test": "jest", - "test:watch": "jest --watchAll" + "test:watch": "jest --watchAll", + "test:ci": "start-server-and-test dev http://localhost:4010/api/openapi.json test" }, "nodemonConfig": { "ignore": [ From 7a79f35b58eb4c1e9cf7a6bca559bdb396212fef Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:07:52 +0100 Subject: [PATCH 04/12] Test for branch restrictions ref #23 --- .drone.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.drone.yml b/.drone.yml index 5e1ca7e..1c0d902 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,6 +8,9 @@ steps: commands: - yarn - yarn test + when: + branch: + - $DRONE_SOURCE_BRANCH trigger: event: - pull_request \ No newline at end of file From 1fbddf5ef83a7d40e249ce1bbabfb6913e90a875 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:13:32 +0100 Subject: [PATCH 05/12] Added source --- .drone.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1c0d902..347c5a2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,9 +8,7 @@ steps: commands: - yarn - yarn test - when: - branch: - - $DRONE_SOURCE_BRANCH + source: ${DRONE_SOURCE_BRANCH} trigger: event: - pull_request \ No newline at end of file From 31e7d074dc1850e91d01c3f96a9b29c09f36a59d Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:18:03 +0100 Subject: [PATCH 06/12] Added dedicated clone step ref #23 --- .drone.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 347c5a2..48606e3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,12 +3,15 @@ kind: pipeline name: tests:latest steps: +- name: clone + image: alpine/git + commands: + - git checkout $DRONE_SOURCE_BRANCH - name: run tests image: node:alpine commands: - yarn - yarn test - source: ${DRONE_SOURCE_BRANCH} trigger: event: - pull_request \ No newline at end of file From 61b2baaee71bee52c3c5209f4828a2efb4bb66eb Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:18:53 +0100 Subject: [PATCH 07/12] renamed step ref #23 --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 48606e3..ba6ff99 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,7 +3,7 @@ kind: pipeline name: tests:latest steps: -- name: clone +- name: checkout pr image: alpine/git commands: - git checkout $DRONE_SOURCE_BRANCH From ef3fcee2a9cb4dc29e26040f9a9039a1b135edb4 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:22:31 +0100 Subject: [PATCH 08/12] testing branch parameter --- .drone.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index ba6ff99..166e33e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,14 @@ --- kind: pipeline name: tests:latest - +clone: + branch: $DRONE_SOURCE_BRANCH steps: -- name: checkout pr - image: alpine/git - commands: - - git checkout $DRONE_SOURCE_BRANCH +# - name: checkout pr +# image: alpine/git +# commands: +# - git clone $DRONE_REMOTE_URL +# - git checkout - name: run tests image: node:alpine commands: From 553a35bb8ec61f0bc6335b2eacd26df508db6f8d Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:23:12 +0100 Subject: [PATCH 09/12] switched to custom clone logic ref #23 --- .drone.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 166e33e..b9cf924 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,13 +2,13 @@ kind: pipeline name: tests:latest clone: - branch: $DRONE_SOURCE_BRANCH + disable: true steps: -# - name: checkout pr -# image: alpine/git -# commands: -# - git clone $DRONE_REMOTE_URL -# - git checkout +- name: checkout pr + image: alpine/git + commands: + - git clone $DRONE_REMOTE_URL + - git checkout $DRONE_SOURCE_BRANCH - name: run tests image: node:alpine commands: From a83a23a64751db583b693892d83852e0f356a984 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:24:03 +0100 Subject: [PATCH 10/12] fixed typo ref #23 --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b9cf924..cfa0f6e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,7 +7,7 @@ steps: - name: checkout pr image: alpine/git commands: - - git clone $DRONE_REMOTE_URL + - git clone $DRONE_REMOTE_URL . - git checkout $DRONE_SOURCE_BRANCH - name: run tests image: node:alpine From 0f419625d26c7727b20124f7d413c7d42262e500 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:25:26 +0100 Subject: [PATCH 11/12] switched to using the ci testing script ref #23 --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index cfa0f6e..0a5f42a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -13,7 +13,7 @@ steps: image: node:alpine commands: - yarn - - yarn test + - yarn test:ci trigger: event: - pull_request \ No newline at end of file From 6cfaec8397f184dd357779eddac2aca568634c25 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 11 Dec 2020 20:29:33 +0100 Subject: [PATCH 12/12] Added ci env ref #23 --- .drone.yml | 1 + .env.ci | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 .env.ci diff --git a/.drone.yml b/.drone.yml index 0a5f42a..6cc56aa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,6 +9,7 @@ steps: commands: - git clone $DRONE_REMOTE_URL . - git checkout $DRONE_SOURCE_BRANCH + - mv .env.ci .env - name: run tests image: node:alpine commands: diff --git a/.env.ci b/.env.ci new file mode 100644 index 0000000..6103f14 --- /dev/null +++ b/.env.ci @@ -0,0 +1,8 @@ +APP_PORT=4010 +DB_TYPE=sqlite +DB_HOST=unused +DB_PORT=unused +DB_USER=unused +DB_PASSWORD=bla +DB_NAME=./test.sqlite +NODE_ENV=production \ No newline at end of file