@@ -11,6 +11,14 @@ MAKEFLAGS+=--no-builtin-rules
1111BASE_NAME =docker-stack-deploy
1212IMAGE_NAME =ghcr.io/kitconcept/$(BASE_NAME )
1313
14+ # Images used by the test suite, never pushed.
15+ TEST_IMAGE =$(IMAGE_NAME ) :test
16+ TEST_RUNNER_IMAGE =$(IMAGE_NAME ) :test-runner
17+ SHELLCHECK_IMAGE =koalaman/shellcheck:stable
18+
19+ # Everything shellcheck should look at.
20+ SHELL_SOURCES =scripts/docker-entrypoint.sh scripts/stack-wait.sh tests/helpers/bin/docker
21+
1422# We like colors
1523# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
1624RED =` tput setaf 1 `
@@ -36,6 +44,26 @@ build-image: # Build Docker Image
3644 @echo " Building $( IMAGE_NAME) "
3745 docker build . -t $(IMAGE_NAME )
3846
47+ .PHONY : lint
48+ lint : # Lint the shell scripts with shellcheck
49+ docker run --rm -v " $( PWD) " :/code -w /code $(SHELLCHECK_IMAGE ) $(SHELL_SOURCES )
50+
51+ .PHONY : build-test-image
52+ build-test-image : # Build the bats test runner image
53+ docker build . -t $(TEST_IMAGE )
54+ docker build . -f Dockerfile.test --build-arg BASE_IMAGE=$(TEST_IMAGE ) -t $(TEST_RUNNER_IMAGE )
55+
56+ .PHONY : test
57+ test : build-test-image # Run the bats test suite
58+ docker run --rm -v " $( PWD) " :/code -w /code $(TEST_RUNNER_IMAGE ) tests/
59+
60+ # Changelog
61+ .PHONY : draft-changelog
62+ draft-changelog : # Display the draft of the changelog
63+ @uvx towncrier build --draft --version unreleased --config towncrier.toml
64+
65+ # Release
66+ .PHONY : create-tag
3967create-tag : # Create a new tag using git
4068 @test -n " $( VERSION) "
4169 if git show-ref --tags v$( VERSION) --quiet; \
@@ -44,6 +72,7 @@ create-tag: # Create a new tag using git
4472 else \
4573 echo " Creating new tag $( VERSION) " ; \
4674 sed -i ' s/$(BASE_NAME):latest/$(BASE_NAME):$(VERSION)/' action.yml; \
75+ uvx towncrier build --yes --version $(VERSION ) --config towncrier.toml; \
4776 git commit -am " Prepare release $( VERSION) " ; \
4877 git tag -a v$(VERSION ) -m " Release $( VERSION) " ; \
4978 git push && git push --tags; \
0 commit comments