Skip to content

Merge pull request #33 from hashicorp-forge/dependabot/npm_and_yarn/p… #94

Merge pull request #33 from hashicorp-forge/dependabot/npm_and_yarn/p…

Merge pull request #33 from hashicorp-forge/dependabot/npm_and_yarn/p… #94

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
mockinfra:
runs-on: "ubuntu-latest"
name: "E2E Mock Infra"
steps:
- uses: actions/checkout@v3
- uses: ./apply
id: run
with:
token: ${{ secrets.TFC_TOKEN }}
organization: ${{ secrets.TFC_ORGANIZATION }}
# The workspace is set up to use .github/workspace/main.tf in the main branch
workspace: test-terraform-cloud-action
e2e:
runs-on: "ubuntu-latest"
name: "E2E Test Outputs"
needs: [ mockinfra ]
steps:
- uses: actions/checkout@v3
- name: Fetch outputs
id: fetch
uses: ./outputs
with:
token: ${{ secrets.TFC_TOKEN }}
organization: ${{ secrets.TFC_ORGANIZATION }}
workspace: test-terraform-cloud-action
- name: Assertions
env:
JSON_DATA: ${{ steps.fetch.outputs.workspace-outputs-json }}
run: |
[[ $(jq -n "$JSON_DATA" | jq .number -re) = "3.14159" ]] && echo PASS || (echo FAIL && exit 1)
[[ $(jq -n "$JSON_DATA" | jq .string -re) = "string" ]] && echo PASS || (echo FAIL && exit 1)
[[ $(jq -n "$JSON_DATA" | jq .tuple[0] -re) = "hello" ]] && echo PASS || (echo FAIL && exit 1)
[[ $(jq -n "$JSON_DATA" | jq .tuple[1] -re) = "list" ]] && echo PASS || (echo FAIL && exit 1)
[[ $(jq -n "$JSON_DATA" | jq .object.hello -re) = "object" ]] && echo PASS || (echo FAIL && exit 1)
echo "The following lines should be redacted! (You should see *** and nothing else)"
jq -n "$JSON_DATA" | jq .secretobject.hello[0] -re
jq -n "$JSON_DATA" | jq .secretobject.hello[1] -re
jq -n "$JSON_DATA" | jq .secretstring -re
destroy-infra:
runs-on: ubuntu-latest
name: E2E Destroy Infra
needs: [ e2e ]
steps:
- uses: actions/checkout@v3
- name: Destroy mock infra
uses: ./destroy
with:
token: ${{ secrets.TFC_TOKEN }}
organization: ${{ secrets.TFC_ORGANIZATION }}
workspace: test-terraform-cloud-action
wait: true # default is false
lint-test:
runs-on: "ubuntu-latest"
name: "Lint & Test"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: npm ci
run: npm ci
- name: Format Check
run: npm run format-check
- name: Verify
run: |
npm run build
# Fail if "npm run build" generated new changes in dist
git update-index --refresh dist/**/* && git diff-index --quiet HEAD dist
- name: Test
run: npm run test