Skip to content

Commit

Permalink
wip github tests of demos
Browse files Browse the repository at this point in the history
  • Loading branch information
osterman committed Jun 15, 2024
1 parent b466953 commit 7cd8256
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ jobs:
run: |
make version
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
./build/
# run acceptance tests
test:
name: Test
Expand Down Expand Up @@ -78,3 +85,128 @@ jobs:
publish: false
format: binary
secrets: inherit

# run localstack demo tests
localstack:
name: LocalStack Demo Tests
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
demo-folder:
- demo-localstack

timeout-minutes: 20
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: /usr/local/bin

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Start LocalStack
uses: LocalStack/[email protected]
env:
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
SERVICES: s3, iam, lambda, dynamodb, sts, account, ec2
with:
image-tag: 'latest'
install-awslocal: 'true'

- name: Run tests for ${{ matrix.demo-folder }}
run: |
cd examples/${{ matrix.demo-folder }}
atmos test
- name: Stop LocalStack
run: |
docker stop ${{ steps.localstack.outputs.container_id }}
# run k3s demo tests
k3s:
name: k3s Demo Tests
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
demo-folder:
- demo-helmfile

timeout-minutes: 20
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: /usr/local/bin

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- uses: nolar/setup-k3d-k3s@v1
with:
version: v1.30
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Get dependencies
run: |
make deps
- name: Run tests for ${{ matrix.demo-folder }}
run: |
cd examples/${{ matrix.demo-folder }}
atmos test
# run other demo tests
mock:
name: Other Demo Tests (No Provider Required)
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
demo-folder:
- demo-atlantis
- demo-component-manifest
- demo-component-versions
- demo-context
- demo-custom-command
- demo-json-validation
- demo-library
- demo-opa-validation
- demo-opentofu
- demo-project
- demo-stacks
- demo-terraform
- demo-terraform-overrides
- demo-workflows
- demo-yaml-anchors
- demo-mock-architecture
- demo-stack-templating
- demo-multi-cloud
- demo-vendoring

timeout-minutes: 20
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: /usr/local/bin

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Get dependencies
run: |
make deps
- name: Run tests for ${{ matrix.demo-folder }}
run: |
cd examples/${{ matrix.demo-folder }}
atmos test
3 changes: 3 additions & 0 deletions examples/demo-library/github/stargazers/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "github_repository" "repo" {
full_name = var.repository
}
7 changes: 7 additions & 0 deletions examples/demo-library/ipinfo/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
data "http" "ipinfo" {
url = var.ip_address != "" ? "https://ipinfo.io/${var.ip_address}" : "https://ipinfo.io"

request_headers = {
Accept = "application/json"
}
}

0 comments on commit 7cd8256

Please sign in to comment.