From 7d29b4c8df0adbe21b24da047e972d6ba62cbebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Rebours?= Date: Tue, 18 May 2021 13:52:56 +0200 Subject: [PATCH] add CI tests --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e5c86aa --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +stages: + - test + - deploy + +image: node:14 + +before_script: + - echo "//registry.npmjs.org/:_authToken=${NPM_REGISTRY_TOKEN}" > .npmrc + - npm ci --cache .npm --prefer-offline + +cache: + key: "nedb" # universal cache + paths: + - .npm/ + +test: + stage: test + script: + - npm run lint + - npm run test + - npm run test:browser + +deploy: + stage: deploy + script: + - if (npx semver $CI_COMMIT_TAG --range '>0.0.0'); then NPM_TAG=latest; else NPM_TAG=beta; fi; # Using the fact that semver by default considers that pre-releases do not respect stable ranges + - npm publish --tag=$NPM_TAG + only: + - tags