soapbox/.gitlab-ci.yml

178 wiersze
3.6 KiB
YAML
Czysty Zwykły widok Historia

2023-04-20 21:04:44 +00:00
image: node:20
2020-04-14 18:07:40 +00:00
variables:
NODE_ENV: test
DS_EXCLUDED_ANALYZERS: gemnasium-python
2020-04-14 18:07:40 +00:00
default:
interruptible: true
2022-06-18 00:02:58 +00:00
cache: &cache
key:
files:
- yarn.lock
paths:
2022-05-17 11:39:59 +00:00
- node_modules/
2022-06-18 00:02:58 +00:00
policy: pull
2020-04-14 23:00:02 +00:00
2020-04-14 18:07:40 +00:00
stages:
- deps
2020-04-14 18:07:40 +00:00
- test
2020-08-30 18:59:39 +00:00
- deploy
- release
2020-04-14 18:07:40 +00:00
deps:
stage: deps
script: yarn install --ignore-scripts
only:
changes:
- yarn.lock
2022-06-18 00:02:58 +00:00
cache:
<<: *cache
policy: push
2020-04-14 18:07:40 +00:00
danger:
stage: test
2022-06-17 23:23:53 +00:00
script:
# https://github.com/danger/danger-js/issues/1029#issuecomment-998915436
- export CI_MERGE_REQUEST_IID=${CI_OPEN_MERGE_REQUESTS#*!}
- npx danger ci
2022-12-30 17:26:16 +00:00
except:
2023-01-01 02:50:05 +00:00
variables:
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
2022-06-19 19:13:35 +00:00
allow_failure: true
2020-04-14 18:07:40 +00:00
lint-js:
stage: test
2022-04-04 15:50:14 +00:00
script: yarn lint:js
only:
changes:
- "**/*.js"
2022-03-18 20:36:15 +00:00
- "**/*.jsx"
- "**/*.cjs"
- "**/*.mjs"
2022-03-18 20:36:15 +00:00
- "**/*.ts"
- "**/*.tsx"
- ".eslintignore"
- ".eslintrc.cjs"
2020-04-14 18:07:40 +00:00
lint-sass:
stage: test
2022-04-04 15:50:14 +00:00
script: yarn lint:sass
only:
changes:
- "**/*.scss"
- "**/*.css"
- ".stylelintrc.json"
2020-04-14 18:07:40 +00:00
2023-09-13 17:14:03 +00:00
# jest:
# stage: test
# script: yarn test:coverage --runInBand
# only:
# changes:
# - "**/*.js"
# - "**/*.json"
# - "app/soapbox/**/*"
# - "webpack/**/*"
# - "custom/**/*"
# - "jest.config.cjs"
# - "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
2020-04-14 18:16:08 +00:00
2022-05-20 23:47:49 +00:00
nginx-test:
stage: test
image: nginx:latest
2022-12-30 17:25:18 +00:00
before_script:
- cp installation/mastodon.conf /etc/nginx/conf.d/default.conf
2022-05-20 23:47:49 +00:00
script: nginx -t
only:
changes:
- "installation/mastodon.conf"
2020-04-14 18:20:07 +00:00
build-production:
stage: test
2022-12-29 06:17:29 +00:00
script:
- yarn build
# - yarn manage:translations en
# # Fail if files got changed.
# # https://stackoverflow.com/a/9066385
# - git diff --quiet
2023-09-14 03:46:18 +00:00
- cp static/index.html static/404.html
2020-04-14 18:20:07 +00:00
variables:
NODE_ENV: production
2020-04-14 18:07:40 +00:00
artifacts:
paths:
- static
2020-04-14 18:07:40 +00:00
2020-08-30 18:59:39 +00:00
docs-deploy:
stage: deploy
image: alpine:latest
2020-08-29 21:51:17 +00:00
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
2020-08-29 18:18:51 +00:00
only:
2023-01-01 02:50:05 +00:00
variables:
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
changes:
- "docs/**/*"
2022-05-19 02:48:16 +00:00
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
2022-05-25 15:23:55 +00:00
allow_failure: true
2022-05-19 02:48:16 +00:00
pages:
stage: deploy
2021-09-07 04:59:19 +00:00
before_script: []
script:
2021-09-07 04:59:19 +00:00
# artifacts are kept between jobs
- mv static public
variables:
NODE_ENV: production
artifacts:
paths:
- public
only:
2023-01-01 02:50:05 +00:00
variables:
- $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME
2022-09-04 20:37:34 +00:00
docker:
stage: deploy
image: docker:24.0.6
2022-09-04 20:37:34 +00:00
services:
- docker:24.0.6-dind
2022-10-09 16:33:10 +00:00
tags:
- dind
2022-09-04 20:37:34 +00:00
# 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:$CI_COMMIT_TAG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG
interruptible: false
release:
stage: release
rules:
- if: $CI_COMMIT_TAG
script:
2023-01-08 22:34:50 +00:00
- npx ts-node ./scripts/do-release.ts
interruptible: false
2022-12-29 06:04:02 +00:00
include:
2022-12-29 15:49:39 +00:00
- template: Jobs/Dependency-Scanning.gitlab-ci.yml