Skip to content

add test lambda

add test lambda #38

name: Running Terratest and Deploy Report Github Pages
on: push
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
TF_VAR_aws_key_pub: ${{secrets.TF_VAR_aws_key_pub}}
jobs:
terratest:
name: terratest
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- uses: actions/setup-go@v4
with:
go-version: '>=1.21.6'
cache-dependency-path: |
tests/go.sum
- name: Setup Go
run: |
export PATH=$PATH:/usr/bin/
cd tests
go mod download
go install github.com/gruntwork-io/terratest/modules/terraform
go install github.com/stretchr/testify/assert
cd /usr/bin/
go install github.com/vakenbolt/go-test-report@v0.9.3
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/tests
go test -v -timeout 30m -json | go-test-report -o reports/index.html -t Report_Terratest_Infrastructure_provisioned_by_Terraform -s "32" -g 1
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: './tests/reports/'
deploy:
needs: terratest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3