Compare commits

...

10 Commits

Author SHA1 Message Date
IamTheFij 27792a2e4d Add openssl dependency
continuous-integration/drone/push Build is passing Details
2020-01-28 15:12:23 -05:00
IamTheFij 7c0c912374 Add more dependencies for tests
continuous-integration/drone/push Build is failing Details
2020-01-28 14:59:47 -05:00
IamTheFij 3f215fb2f4 Add gcc to test env
continuous-integration/drone/push Build is failing Details
2020-01-28 14:04:36 -05:00
IamTheFij f1d00cd499 Add docker-compose to test env
continuous-integration/drone/push Build is failing Details
2020-01-28 14:03:31 -05:00
IamTheFij fa2c56fced Try to add bash to tests
continuous-integration/drone/push Build is failing Details
2020-01-28 14:02:51 -05:00
IamTheFij 3522297171 Debug test working dir
continuous-integration/drone/push Build is failing Details
2020-01-28 14:01:52 -05:00
IamTheFij 204c916c7e Add workspace for drone tests
continuous-integration/drone/push Build is failing Details
2020-01-28 13:59:48 -05:00
IamTheFij 51fcfd76c4 Add make
continuous-integration/drone/push Build is failing Details
2020-01-28 13:57:54 -05:00
IamTheFij 8fa016eeb7 Fix apk add
continuous-integration/drone/push Build is failing Details
2020-01-28 13:56:28 -05:00
IamTheFij 7b55d67b34 Add some tests and drone to run them
continuous-integration/drone/push Build is failing Details
2020-01-27 17:17:55 -05:00
5 changed files with 62 additions and 4 deletions

29
.drone.yml Normal file
View File

@ -0,0 +1,29 @@
---
kind: pipeline
name: test
workspace:
base: "/app"
path: "."
steps:
- name: test
image: python:3-alpine
commands:
- apk add bash shellcheck make gcc musl-dev libffi-dev openssl-dev
- pip install docker-compose
- make all
- name: notify
image: drillster/drone-email
settings:
host:
from_secret: SMTP_HOST # pragma: whitelist secret
username:
from_secret: SMTP_USER # pragma: whitelist secret
password:
from_secret: SMTP_PASS # pragma: whitelist secret
from: drone@iamthefij.com
when:
status: [changed, failure]

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
.PHONY: all test clean
all: test shellcheck
test: test-negative test-positive
.PHONY: shellcheck
shellcheck:
shellcheck *.sh
.PHONY: test-positive
test-positive:
@echo "Check valid compose file."
./compose-check.sh tests/docker-compose.yml || { echo 'fail'; exit 1; }
.PHONY: test-negative
test-negative:
@echo "Check bad file. Should error."
./compose-check.sh tests/docker-compose.bad.yml && { echo 'fail'; exit 1; } || echo 'ok'
@echo "Check multiple files. Should error."
./compose-check.sh tests/docker-compose* && { echo 'fail'; exit 1; } || echo 'ok'

View File

@ -6,15 +6,16 @@ check_file() {
local file=$1
docker-compose -f "$file" config -q 2>&1 \
| sed "/variable is not set. Defaulting/d"
return ${PIPESTATUS[0]}
return "${PIPESTATUS[0]}"
}
check_files() {
local all_files=$@
local all_files=( "$@" )
has_error=0
for file in $all_files ; do
for file in "${all_files[@]}" ; do
if [[ -f "$file" ]]; then
if ! check_file "$file" ; then
echo "ERROR: $file"
has_error=1
fi
fi
@ -22,7 +23,7 @@ check_files() {
return $has_error
}
if ! check_files $@ ; then
if ! check_files "$@" ; then
echo "To ignore, use --no-verify"
fi

View File

@ -0,0 +1 @@
not: valid

6
tests/docker-compose.yml Normal file
View File

@ -0,0 +1,6 @@
---
version: '2'
services:
main:
image: busybox