Skip to content

Commit b762ef5

Browse files
author
Jeremy Udit
committed
Adds acceptance test runs triggered by labels
1 parent 39def66 commit b762ef5

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Acceptance Tests
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
acceptance-tests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Parse Context From Environment
13+
run: |
14+
echo ::set-env name=HEAD_SHA::$(
15+
jq -rc '.pull_request.head.sha' $GITHUB_EVENT_PATH
16+
)
17+
echo ::set-env name=LABEL_NAME::$(
18+
jq -rc .label.name $GITHUB_EVENT_PATH
19+
)
20+
21+
- name: Parse Arguments From Label Name
22+
run: |
23+
echo ::set-env name=RUN_FILTER::$(
24+
echo $LABEL_NAME | cut -d/ -f 2
25+
)
26+
27+
- name: Match expected prefix or exit
28+
run: echo ${LABEL_NAME} | egrep -q "^acceptance-test/"
29+
30+
- name: Checkout
31+
uses: actions/[email protected]
32+
with:
33+
ref: ${{ env.HEAD_SHA }}
34+
35+
- name: Generate Test Fixtures
36+
run: |
37+
openssl req -x509 -newkey rsa:4096 -days 1 -nodes \
38+
-subj "/C=US/ST=CA/L=San Francisco/O=HashiCorp, Inc./CN=localhost" \
39+
-keyout github/test-fixtures/key.pem -out github/test-fixtures/cert.pem
40+
41+
- name: Acceptance Tests
42+
uses: terraformtesting/[email protected]
43+
with:
44+
RUN_FILTER: ${{ env.RUN_FILTER }}
45+
GITHUB_ORGANIZATION: terraformtesting
46+
GITHUB_TEST_USER: github-terraform-test-user
47+
GITHUB_TEST_USER_NAME: "Test User"
48+
GITHUB_TEST_USER_EMAIL: [email protected]
49+
GITHUB_TEST_USER_TOKEN: ${{ secrets.GITHUB_TEST_USER_TOKEN }}
50+
GITHUB_TEST_COLLABORATOR: github-terraform-test-collaborator
51+
GITHUB_TEST_COLLABORATOR_TOKEN: ${{ secrets.GITHUB_TEST_COLLABORATOR_TOKEN }}
52+
GITHUB_TEMPLATE_REPOSITORY: terraform-template-module
53+
GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID: 23826477

0 commit comments

Comments
 (0)