Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds acceptance test runs triggered by labels #375

Merged
merged 1 commit into from
Mar 5, 2020
Merged
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
53 changes: 53 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Acceptance Tests

on:
pull_request:
types: [labeled]

jobs:
acceptance-tests:
runs-on: ubuntu-latest
steps:

- name: Parse Context From Environment
run: |
echo ::set-env name=HEAD_SHA::$(
jq -rc '.pull_request.head.sha' $GITHUB_EVENT_PATH
)
echo ::set-env name=LABEL_NAME::$(
jq -rc .label.name $GITHUB_EVENT_PATH
)

- name: Parse Arguments From Label Name
run: |
echo ::set-env name=RUN_FILTER::$(
echo $LABEL_NAME | cut -d/ -f 2
)

- name: Match Expected Label Prefix
run: echo ${LABEL_NAME} | egrep -q "^acceptance-test/"

- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ env.HEAD_SHA }}

- name: Generate Test Fixtures
run: |
openssl req -x509 -newkey rsa:4096 -days 1 -nodes \
-subj "/C=US/ST=CA/L=San Francisco/O=HashiCorp, Inc./CN=localhost" \
-keyout github/test-fixtures/key.pem -out github/test-fixtures/cert.pem

- name: Acceptance Tests
uses: terraformtesting/[email protected]
with:
RUN_FILTER: ${{ env.RUN_FILTER }}
GITHUB_ORGANIZATION: terraformtesting
GITHUB_TEST_USER: github-terraform-test-user
GITHUB_TEST_USER_NAME: "Test User"
GITHUB_TEST_USER_EMAIL: [email protected]
GITHUB_TEST_USER_TOKEN: ${{ secrets.GITHUB_TEST_USER_TOKEN }}
GITHUB_TEST_COLLABORATOR: github-terraform-test-collaborator
GITHUB_TEST_COLLABORATOR_TOKEN: ${{ secrets.GITHUB_TEST_COLLABORATOR_TOKEN }}
GITHUB_TEMPLATE_REPOSITORY: terraform-template-module
GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID: 23826477