forked from cloudposse/terraform-null-label
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update README * Add `codefresh.yml` * Update README * Test README
- Loading branch information
Showing
5 changed files
with
132 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
version: '1.0' | ||
|
||
stages: | ||
- Prepare | ||
- Test | ||
|
||
steps: | ||
main_clone: | ||
title: "Clone repository" | ||
type: git-clone | ||
stage: Prepare | ||
description: "Initialize" | ||
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} | ||
git: CF-default | ||
revision: ${{CF_REVISION}} | ||
|
||
clean_init: | ||
title: Prepare build-harness and test-harness | ||
image: ${{TEST_IMAGE}} | ||
stage: Prepare | ||
commands: | ||
- make init | ||
- make -C test/ clean init | ||
|
||
test: | ||
type: "parallel" | ||
title: "Run tests" | ||
description: "Run all tests in parallel" | ||
stage: Test | ||
steps: | ||
test_readme_lint: | ||
title: "Test README.md updated" | ||
stage: "Test" | ||
image: ${{TEST_IMAGE}} | ||
description: Test "readme/lint" | ||
commands: | ||
- make readme/lint | ||
|
||
test_module: | ||
title: Test module | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/ module | ||
|
||
test_examples_complete: | ||
title: Test "examples/complete" | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/ examples/complete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.test-harness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
TEST_HARNESS ?= https://github.com/cloudposse/test-harness.git | ||
TEST_HARNESS_BRANCH ?= master | ||
TEST_HARNESS_PATH = $(realpath .test-harness) | ||
BATS_ARGS ?= --tap | ||
BATS_LOG ?= test.log | ||
|
||
# Define a macro to run the tests | ||
define RUN_TESTS | ||
@echo "Running tests in $(1)" | ||
@cd $(1) && bats $(BATS_ARGS) $(addsuffix .bats,$(addprefix $(TEST_HARNESS_PATH)/test/terraform/,$(TESTS))) | ||
endef | ||
|
||
default: all | ||
|
||
# Provision the test-harnesss | ||
.test-harness: | ||
[ -d $@ ] || git clone --depth=1 -b $(TEST_HARNESS_BRANCH) $(TEST_HARNESS) $@ | ||
|
||
# Initialize the tests | ||
init: .test-harness | ||
|
||
# Clean up the test harness | ||
clean: | ||
[ "$(TEST_HARNESS_PATH)" == "/" ] || rm -rf $(TEST_HARNESS_PATH) | ||
|
||
# Run all tests | ||
all: module examples/complete | ||
|
||
# Install all dependencies (OS specific) | ||
deps: init | ||
@[ ! -x /sbin/apk ] || apk add --update terraform-docs@cloudposse | ||
|
||
# Run basic sanity checks against the module itself | ||
module: export TESTS ?= installed lint get-modules validate terraform-docs input-descriptions output-descriptions | ||
module: deps | ||
$(call RUN_TESTS, ../) | ||
|
||
# Run tests against example | ||
examples/complete: export TESTS ?= init plan apply | ||
examples/complete: deps | ||
$(call RUN_TESTS, ../$@) |