File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 6161 shell : bash
6262 run : git diff --exit-code
6363
64+ bats :
65+ runs-on : ubuntu-latest
66+ container : cloudposse/test-harness:latest
67+ env :
68+ MAKE_INCLUDES : Makefile
69+ TF_PLUGIN_CACHE_DIR : /tmp
70+ BATS_MODULE_TESTS : input-descriptions module-pinning provider-pinning output-descriptions
71+ BATS_EXAMPLES_TESTS : input-descriptions lint output-descriptions
72+ steps :
73+ - name : Checkout
74+ uses : actions/checkout@v4
75+ with :
76+ fetch-depth : 0
77+
78+ - name : Run tests on modified modules
79+ shell : bash -x -e -o pipefail {0}
80+ run : |
81+ # when running in test-harness, need to mark the directory safe for git operations
82+ make git-safe-directory
83+ MODIFIED_MODULES=($(find . -type f -name "*.tf" | xargs -I{} dirname {} | sort | uniq | grep -v ^./.git/ || true))
84+ pass=true
85+ for relative_dir in "${MODIFIED_MODULES[@]}"; do
86+ dir=$(realpath $relative_dir)
87+ printf "\n\nBegin testing in $dir\n"
88+ (
89+ status=pass
90+ cd $dir
91+ [[ $relative_dir =~ ./examples/.* ]] && tests=$BATS_EXAMPLES_TESTS || tests=$BATS_MODULE_TESTS
92+ for test in $tests; do
93+ printf "\n\nRunning ${test} in $dir\n"
94+ bats -t /test/terraform/${test}.bats || status=fail
95+ done
96+ [[ $status == "pass" ]]
97+ ) || pass=false
98+ printf "\n\nEnd of testing in $dir\n\n\n"
99+ done
100+ [[ $pass == "true" ]]
101+
64102 lint-find-dirs :
65103 name : Find modules
66104 runs-on : ${{ fromJSON(inputs.runs-on) }}
You can’t perform that action at this time.
0 commit comments