diff --git a/actions/deployTerraform/action.yml b/actions/deployTerraform/action.yml index 4a85c0c..40ac31d 100644 --- a/actions/deployTerraform/action.yml +++ b/actions/deployTerraform/action.yml @@ -137,4 +137,29 @@ runs: shell: bash working-directory: ./deploy/terraform if: github.ref == 'refs/heads/master' && github.event_name == 'push' - run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false \ No newline at end of file + run: terraform apply --var "environment=${{inputs.ENVIRONMENT}}" -auto-approve -input=false + + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: "1.18.1" + + - name: Init Go + working-directory: ./deploy/test + shell: bash + run: | + go mod init github.com/nexilus18/SampleRepo1/test + go install github.com/jstemmer/go-junit-report@latest + + - name: Run Tests + working-directory: ./deploy/test/terraform + shell: bash + run: | + go get github.com/stretchr/testify/assert + go test -v test.go 2>&1 | go-junit-report > test.xml + + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: Test results + path: ./deploy/test/terraform/*.xml \ No newline at end of file diff --git a/deploy/test/terraform/test.go b/deploy/test/terraform/test.go new file mode 100644 index 0000000..613209e --- /dev/null +++ b/deploy/test/terraform/test.go @@ -0,0 +1,13 @@ +package terraform + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func Test(t *testing.T) { + var a string = "Hello" + var b string = "Hello" + + assert.Equal(t, a, b, "The two words should be the same.") +} \ No newline at end of file