diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..cb3d834 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,51 @@ +# CI for gnexus-ui-kit. +# The Playwright image version must match the installed @playwright/test +# version (browsers are preinstalled there, so no `playwright install`). +image: mcr.microsoft.com/playwright:v1.60.0-noble + +stages: + - build + - test + +variables: + npm_config_cache: "$CI_PROJECT_DIR/.npm-cache" + +cache: + key: + files: + - package-lock.json + paths: + - .npm-cache + +build: + stage: build + script: + - npm ci + - npm ci --prefix examples/vue + - npx gulp build + artifacts: + paths: + - dist/ + expire_in: 1 hour + +test: + stage: test + script: + - npm ci + - npm ci --prefix examples/vue + - npx gulp build + # compare-heights.js (test:demo-sync) needs the demo server on :3000 + - npx gulp serve >server.log 2>&1 & + - | + for i in $(seq 1 60); do + curl -sf http://localhost:3000/index.html >/dev/null && break + sleep 1 + done + curl -sf http://localhost:3000/vue.html >/dev/null + - npm run release:check + artifacts: + when: on_failure + paths: + - screenshots/ + - server.log + expire_in: 1 week \ No newline at end of file diff --git a/package.json b/package.json index e7d4db2..a26f172 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,8 @@ "build:example:vue": "npm --prefix examples/vue run build", "build:vue": "gulp vue", "dev": "gulp serve", - "release:check": "npm run test:vue-adapter && npm run test:vue-package", + "release:check": "npm run test:vue-adapter && npm run test:vue-package && npm run test:demo-sync", + "test:demo-sync": "node compare-heights.js", "start": "gulp serve", "test:vue-adapter": "npm run build:vue && npm run build:example:vue", "test:vue-package": "node scripts/vue-package-smoke.mjs"