-
Jonas Gröger authoredJonas Gröger authored
.gitlab-ci.yml 3.37 KiB
.ssh-setup: &ssh-setup
- eval $(ssh-agent -s)
- echo "$CI_DEPLOYMENT_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- echo "$UBERSPACE_KNOWN_HOST" >> ~/.ssh/known_hosts
include:
- project: 'fit-connect/pipeline'
ref: main
file: 'workflows/no-duplicate-pipelines.gitlab-ci.yml'
stages:
- build
- lint
- upload
- validate
build:
stage: build
image: ${CI_REGISTRY}/fit-connect/baseimage:latest
before_script:
# See Makefile for as to why this is required
- git clone https://github.com/JonasGroeger/swagger-cli.git /tmp/swagger-cli
- (cd /tmp/swagger-cli && npm install && npm install -g)
script:
- swagger-cli bundle --type yaml --outfile dist/submission-api.yaml spec/submission-api.yaml
artifacts:
expose_as: 'Built API spec'
paths:
- dist/
expire_in: 1 day
lint:
stage: lint
image:
name: ${CI_REGISTRY}/stoplight/spectral:6
entrypoint: [ "" ]
script:
- spectral lint spec/submission-api.yaml --verbose --display-only-failures
- spectral lint dist/submission-api.yaml --verbose --display-only-failures
upload:preview:
stage: upload
image: ${CI_REGISTRY}/fit-connect/baseimage:latest
environment:
name: review/$CI_COMMIT_REF_NAME
on_stop: stop:preview
auto_stop_in: 2 week
url: https://preview.docs.fitko.dev/submission-api/$CI_COMMIT_REF_SLUG/
rules:
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
before_script:
- *ssh-setup
script:
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./ci/index.html fitko@dorado.uberspace.de:preview.docs.fitko.dev/submission-api/$CI_COMMIT_REF_SLUG/
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./ci/rapidoc.js fitko@dorado.uberspace.de:preview.docs.fitko.dev/submission-api/$CI_COMMIT_REF_SLUG/
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./dist/submission-api.yaml fitko@dorado.uberspace.de:preview.docs.fitko.dev/submission-api/$CI_COMMIT_REF_SLUG/
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./dist/submission-api.yaml fitko@dorado.uberspace.de:schema.fitko.de/fit-connect/submission-api/latest-dev/
link-check:
stage: validate
variables:
CRAWLER_URL: "https://schema.fitko.de/fit-connect/submission-api/"
CRAWLER_DOMAIN: "schema.fitko.de"
CRAWL_ONE_DOMAIN_ONLY: "yes"
trigger:
strategy: depend
project: fit-connect/schema-link-checker
branch: main
upload:latest: