renewedtab/.gitlab-ci.yml

135 lines
2.9 KiB
YAML

image: node:14
cache:
paths:
- node_modules/
stages:
- test
- package
- deploy
variables:
NODE_ENV: production
ENV: production
LC_ALL: C.UTF-8
before_script: &before_script
- NODE_ENV=debug npm install
- cp config.example.json config.json
- PATH=$(npm bin):$PATH
test:
stage: test
dependencies: []
interruptible: true
script:
- npm run trans:check
- npm test
- npm run lint
ui-chrome:
stage: test
dependencies: []
interruptible: true
services:
- selenium/standalone-chrome
script:
- unset SENTRY_DSN
- npm run build:app
- npm run uitest-and-server
variables:
TARGET: chrome
SELENIUM_BROWSER: chrome
SELENIUM_REMOTE_URL: http://selenium__standalone-chrome:4444/wd/hub/
SENTRY_DSN: ""
ui-firefox:
stage: test
dependencies: []
interruptible: true
services:
- selenium/standalone-firefox
script:
- unset SENTRY_DSN
- npm run build:app
- npm run uitest-and-server
variables:
TARGET: firefox
SELENIUM_BROWSER: firefox
SELENIUM_REMOTE_URL: http://selenium__standalone-firefox:4444/wd/hub/
webext:
stage: package
dependencies: []
interruptible: true
script:
- npm run package:webext
- mv web-ext-artifacts/*.zip .
- mv dist/webext/app/main.js.map main.js.map
artifacts:
expire_in: 1 week
paths:
- chrome.zip
- firefox.zip
- main.js.map
pages:
stage: deploy
dependencies: []
interruptible: true
script:
- npm run build:app
- cp -r dist/webext/app public
artifacts:
paths:
- public
only:
- tags
sentry:
stage: deploy
dependencies: ["webext"]
interruptible: false
before_script:
- *before_script
- npm install @sentry/cli
script:
- mkdir -p dist
- mv chrome.zip dist/chrome.zip
- pushd dist && unzip chrome.zip && popd
- mv main.js.map dist/app/main.js.map
- sentry-cli releases new ${VERSION}
- sentry-cli releases set-commits --auto $VERSION
- sentry-cli releases deploys ${VERSION} new -e production
- sentry-cli releases files ${VERSION} upload-sourcemaps --validate --ext ts --ext js --ext tsx --ext map dist
- sentry-cli releases finalize ${VERSION}
variables:
VERSION: "renewedtab@$CI_COMMIT_TAG"
SENTRY_ORG: "renewedtab"
SENTRY_PROJECT: "renewedtab"
only:
- tags
chrome:
stage: deploy
dependencies: ["webext"]
interruptible: false
script:
- npm run upload:chrome chrome.zip
only:
- tags
# firefox:
# stage: deploy
# dependencies: ["webext"]
# interruptible: false
# script:
# - VERSION=${CI_COMMIT_REF_NAME:1}
# - JWT=$(node utils/make_jwt.js $FIREFOX_JWT_ISSUER $FIREFOX_JWT_SECRET)
# - >
# curl "https://addons.mozilla.org/api/v4/addons/${FIREFOX_EXTENSION_ID}/versions/${VERSION}/" \
# -g -XPUT --form "upload=@firefox.zip" -H "Authorization: JWT ${JWT}"
# only:
# - tags