/
Makefile
48 lines (40 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
ENV:=tmp/env
DOCKER_IMAGES:=syntax,rubocop,shellcheck,editorconfig,eslint,gometalinter,phpcs,stylelint,credo,kubeval,cfnlint
DOCKER_IMAGE_FILES:=$(shell find {$(DOCKER_IMAGES)} -print)
$(ENV): docker-compose.yml $(DOCKER_IMAGE_FILES) test/fake_api/*
docker-compose build
docker-compose up -d api
@mkdir -p $(@D)
@touch $@
.PHONY: test-compose
test-compose:
docker run --rm -v $(CURDIR):/data -w /data ruby:2.5 ruby test/compose_test.rb
.PHONY: test-lint
test-lint:
@echo '~~~ Linting Tests'
docker run --rm -v $(CURDIR):/data -w /data koalaman/shellcheck:v0.4.7 -f gcc \
$(wildcard script/*) \
.buildkite/pipeline \
$(wildcard .buildkite/hooks/*) \
$(wildcard test/stubs/bin/*) \
$(shell find . -name '*-tap' -print) \
test/emulate-buildkite
.PHONY: test-acceptance
test-acceptance: FILE=$(wildcard test/acceptance/*_test.bats)
test-acceptance: $(ENV)
@echo '~~~ Acceptance Tests'
@env \
BUILDKITE_AGENT_METADIR=$(shell mktemp -d) \
FIXTURE_DIR=$(CURDIR)/test/fixtures \
PATH=$(CURDIR)/test/stubs/bin:$$PATH \
TEAMCI_API_URL=http://localhost:9292 \
TEAMCI_CODE_DIR=$(CURRDIR)/tmp/code \
bats $(FILE)
.PHONY: test-ci
test-ci: test-acceptance test-pipeline test-compose test-lint
tmp/buildkite-agent:
mkdir -p $@
.PHONY: clean
clean:
rm -rf $(ENV) tmp/*
docker-compose down