stages: - test - build - deploy test: stage: test image: node:15-buster-slim cache: key: "pnpm-store" paths: - ".pnpm-store" before_script: - npm install --global pnpm - pnpm config set store-dir .pnpm-store - pnpm install script: - pnpx jest src/ --coverage --coverageReporters cobertura coverage: /All\sfiles.*?\s+(\d+.\d+)/ artifacts: reports: cobertura: "$CI_PROJECT_DIR/coverage/cobertura-coverage.xml" build: stage: build image: node:15-buster-slim cache: key: "pnpm-store" paths: - ".pnpm-store" before_script: - npm install --global pnpm - pnpm config set store-dir .pnpm-store - pnpm install script: - npm run build artifacts: paths: - dist # Deploy main branch to contact.greenhost.net deploy-staging: stage: deploy # Only run this job for the main branch. rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH image: debian:10 environment: name: staging url: https://contact.greenhost.net/staging variables: FTP_USER: 'webmaster_greenhost_nl' FTP_HOST: 'ftp.greenhost.nl' DOMAIN_NAME: 'greenhost.net' SUBDOMAIN: 'contact' SUBFOLDER: '/staging' BUILD_FOLDER: './dist' before_script: - apt-get update - apt-get install -y rsync openssh-client script: - deploy/deploy.sh