Add tests

These aren't run on drone yet as there is no pre-commit plugin!
This commit is contained in:
IamTheFij 2020-09-08 10:14:06 -07:00
parent 09fb067889
commit 6481b89b0c
3 changed files with 18 additions and 3 deletions

View File

@ -3,4 +3,4 @@ repos:
- repo: https://github.com/IamTheFij/docker-pre-commit - repo: https://github.com/IamTheFij/docker-pre-commit
rev: v2.0.0 rev: v2.0.0
hooks: hooks:
- id: hadolint - id: hadolint-system

View File

@ -1,11 +1,17 @@
DOCKER_TAG = drone-pre-commit-$(USER)
.PHONY: clean .PHONY: clean
.PHONY: default .PHONY: default
default: test default: test
.PHONY: test .PHONY: test
test: test: build
@echo noop docker run --rm -v $(shell pwd):/src:ro --workdir /src $(DOCKER_TAG) ./tests/steps.sh
.PHONY: build
build: ./Dockerfile
docker build -t $(DOCKER_TAG) .
.PHONY: install-hooks .PHONY: install-hooks
install-hooks: install-hooks:

9
tests/steps.sh Executable file
View File

@ -0,0 +1,9 @@
#! /bin/bash
set -ex
# These simulate commands added to a pipeline step
wget -L -O /usr/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-Linux-x86_64
chmod +x /usr/bin/hadolint
pre-commit run --all-files