sforkowany z mirror/soapbox
171 wiersze
3.3 KiB
YAML
171 wiersze
3.3 KiB
YAML
image: node:18
|
|
|
|
variables:
|
|
NODE_ENV: test
|
|
|
|
cache: &cache
|
|
key:
|
|
files:
|
|
- yarn.lock
|
|
paths:
|
|
- node_modules/
|
|
policy: pull
|
|
|
|
stages:
|
|
- deps
|
|
- test
|
|
- deploy
|
|
|
|
deps:
|
|
stage: deps
|
|
script: yarn install --ignore-scripts
|
|
only:
|
|
changes:
|
|
- yarn.lock
|
|
cache:
|
|
<<: *cache
|
|
policy: push
|
|
interruptible: true
|
|
|
|
danger:
|
|
stage: test
|
|
script:
|
|
# https://github.com/danger/danger-js/issues/1029#issuecomment-998915436
|
|
- export CI_MERGE_REQUEST_IID=${CI_OPEN_MERGE_REQUESTS#*!}
|
|
- npx danger ci
|
|
allow_failure: true
|
|
interruptible: true
|
|
|
|
lint-js:
|
|
stage: test
|
|
script: yarn lint:js
|
|
only:
|
|
changes:
|
|
- "**/*.js"
|
|
- "**/*.jsx"
|
|
- "**/*.ts"
|
|
- "**/*.tsx"
|
|
- ".eslintignore"
|
|
- ".eslintrc.js"
|
|
interruptible: true
|
|
|
|
lint-sass:
|
|
stage: test
|
|
script: yarn lint:sass
|
|
only:
|
|
changes:
|
|
- "**/*.scss"
|
|
- "**/*.css"
|
|
- ".stylelintrc.json"
|
|
interruptible: true
|
|
|
|
jest:
|
|
stage: test
|
|
script: yarn test:coverage --runInBand
|
|
only:
|
|
changes:
|
|
- "**/*.js"
|
|
- "**/*.json"
|
|
- "app/soapbox/**/*"
|
|
- "webpack/**/*"
|
|
- "custom/**/*"
|
|
- "jest.config.js"
|
|
- "package.json"
|
|
- "yarn.lock"
|
|
- ".gitlab-ci.yml"
|
|
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
|
|
artifacts:
|
|
reports:
|
|
junit: junit.xml
|
|
coverage_report:
|
|
coverage_format: cobertura
|
|
path: .coverage/cobertura-coverage.xml
|
|
interruptible: true
|
|
|
|
nginx-test:
|
|
stage: test
|
|
image: nginx:latest
|
|
before_script: cp installation/mastodon.conf /etc/nginx/conf.d/default.conf
|
|
script: nginx -t
|
|
only:
|
|
changes:
|
|
- "installation/mastodon.conf"
|
|
interruptible: true
|
|
|
|
build-production:
|
|
stage: test
|
|
script: yarn build
|
|
variables:
|
|
NODE_ENV: production
|
|
artifacts:
|
|
paths:
|
|
- static
|
|
interruptible: true
|
|
|
|
docs-deploy:
|
|
stage: deploy
|
|
image: alpine:latest
|
|
before_script:
|
|
- apk add curl
|
|
script:
|
|
- curl -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' https://gitlab.com/api/v4/projects/15685485/trigger/pipeline
|
|
only:
|
|
refs:
|
|
- develop
|
|
changes:
|
|
- "docs/**/*"
|
|
interruptible: true
|
|
|
|
# Supposed to fail when translations are outdated, instead always passes
|
|
#
|
|
# i18n:
|
|
# stage: build
|
|
# script: yarn manage:translations
|
|
# variables:
|
|
# NODE_ENV: development
|
|
# before_script:
|
|
# - yarn
|
|
# - yarn build
|
|
|
|
review:
|
|
stage: deploy
|
|
environment:
|
|
name: review/$CI_COMMIT_REF_NAME
|
|
url: https://$CI_COMMIT_REF_SLUG.git.soapbox.pub
|
|
script:
|
|
- npx -y surge static $CI_COMMIT_REF_SLUG.git.soapbox.pub
|
|
allow_failure: true
|
|
interruptible: true
|
|
|
|
pages:
|
|
stage: deploy
|
|
before_script: []
|
|
script:
|
|
# artifacts are kept between jobs
|
|
- mv static public
|
|
variables:
|
|
NODE_ENV: production
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
refs:
|
|
- develop
|
|
interruptible: true
|
|
|
|
docker:
|
|
stage: deploy
|
|
image: docker:20.10.17
|
|
services:
|
|
- docker:20.10.17-dind
|
|
tags:
|
|
- dind
|
|
# https://medium.com/devops-with-valentine/how-to-build-a-docker-image-and-push-it-to-the-gitlab-container-registry-from-a-gitlab-ci-pipeline-acac0d1f26df
|
|
script:
|
|
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
|
|
- docker build -t $CI_REGISTRY_IMAGE .
|
|
- docker push $CI_REGISTRY_IMAGE
|
|
only:
|
|
refs:
|
|
- develop
|
|
interruptible: true |