saiblog/.gitlab-ci.yml

116 lines
2.5 KiB
YAML
Raw Normal View History

2020-01-08 11:11:30 +01:00
# Official docker image.
2020-01-08 11:28:25 +01:00
image: quay.io/sheogorath/ubuntu-ci:18.04
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- orthography
- build
- package
- test
#- deploy
spellcheck:
stage: orthography
image: node:10
before_script:
- npm i -g markdown-spellcheck
script:
- mdspell -r -n -a --en-gb "content/posts/*.md" "content/posts/*.markdown"
tags:
- docker
build:
image: docker.io/cibuilds/hugo
stage: build
variables:
HUGO_ENV: production
LANG: C.UTF-8
before_script:
- hugo --minify --enableGitInfo
script:
- htmlproofer ./public --allow-hash-href --check-html --empty-alt-ignore --disable-external
artifacts:
untracked: true
paths:
- public
expire_in: 1 week
package-deploy:
stage: package
services:
2020-01-08 11:11:30 +01:00
- docker:19.03.1-dind
variables:
DOCKER_HOST: "tcp://docker:2375"
2020-01-08 11:11:30 +01:00
DOCKER_TLS_CERTDIR: ""
LANG: C.UTF-8
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- deploy
tags:
- docker
package:
stage: package
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375"
2020-01-08 11:11:30 +01:00
DOCKER_TLS_CERTDIR: ""
LANG: C.UTF-8
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- deploy
tags:
- docker
test:
stage: test
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375"
LANG: C.UTF-8
before_script:
- apt-get install curl
script:
- docker run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- sleep 5
- docker exec testing nginx -c /etc/nginx/nginx.conf -t
- curl http://docker/status.txt | grep -q 'OK'
- docker stop testing
- docker rm testing
except:
- deploy
tags:
- docker
test-deploy:
stage: test
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375"
LANG: C.UTF-8
before_script:
- apt-get install curl
script:
- docker run -d -p 80:80 --name testing $CI_REGISTRY_IMAGE
- sleep 5
- curl http://docker/status.txt | grep -q 'OK'
- docker stop testing
- docker rm testing
only:
- deploy
tags:
- docker