Skip to content

Commit

Permalink
.github: add action to run acceptance tests
Browse files Browse the repository at this point in the history
Since right now we don't have any way to run acceptance tests on the AWS
plugin, we add a workflow that can manually be triggered.
  • Loading branch information
lbajolet-hashicorp committed May 11, 2023
1 parent 5c9471e commit ec4a43a
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

name: "AWS Acceptance Tests"

on:
workflow_dispatch:
inputs:
branch:
description: "A branch or SHA"
default: 'main'
required: false
run_pattern:
description: "The pattern to run tests on"
default: "*"
required: false

permissions:
contents: read

jobs:
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
ebs-acc-tests:
needs:
- get-go-version
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
name: AWS EBS Acceptance tests
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: "Compile/install the plugin on the current branch"
run: |
make dev
- uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2
with:
aws-access-key-id: "${{ env.AWS_ACC_TEST_KEY_ID }}"
aws-secret-access-key: "${{ env.AWS_ACC_TEST_KEY_SECRET }}"
aws-region: "${{ env.AWS_ACC_TEST_REGION }}"
role-to-assume: "${{ env.AWS_ACC_TEST_ROLE }}"
role-session-name: "packer-aws-acceptance-tests"
role-duration-seconds: 14400 # 4h
- run: |
echo "Testing with Go ${{ needs.get-go-version.outputs.go-version }}"
PACKER_ACC=1 go test \
-timeout 3h \
-count 1 \
-run "${{ github.event.inputs.run_pattern }}" \
./builder/ebs

0 comments on commit ec4a43a

Please sign in to comment.