Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion actions/deployTerraform/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
13 changes: 13 additions & 0 deletions deploy/test/terraform/test.go
Original file line number Diff line number Diff line change
@@ -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.")
}