Set up some barebones automated testing

This commit is contained in:
Salt 2021-03-20 14:14:11 -05:00
parent acc4e3f324
commit 73cad693a1

View File

@ -9,6 +9,7 @@ variables:
CI_HUB_USERNAME: rehashedsalt CI_HUB_USERNAME: rehashedsalt
stages: stages:
- build - build
- test
- push - push
services: services:
- docker:dind - docker:dind
@ -19,6 +20,7 @@ before_script:
after_script: after_script:
- docker logout hub.docker.com - docker logout hub.docker.com
# BUILD
Build: Build:
stage: build stage: build
script: script:
@ -31,6 +33,15 @@ Build:
. .
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA - docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
# TEST
Test_HTTP_200:
stage: test
script:
- docker run -d -p 8889:80 $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
- curl localhost:8889 | grep -ie '200 OK'
- docker kill $(docker ps -q)
# PUSH
Push_When_Tag: Push_When_Tag:
stage: push stage: push
only: only:
@ -47,8 +58,7 @@ Push_When_Tag:
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
$CI_HUB_USERNAME/$CI_PROJECT_NAME:latest $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest - docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
Push_Bleeding:
Push_Latest:
stage: push stage: push
script: script:
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA - docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA