Skip to content

Commit

Permalink
Initial workflow testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething committed Feb 7, 2023
1 parent 95da01c commit 99c7105
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 57 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/acceptance-test-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Acceptance Test Trigger

on:
issue_comment:
types: [created]

jobs:
testacc-trigger:
runs-on: ubuntu-latest

steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v1
with:
token: ${{ secrets.TRIGGER_TOKEN }}
issue-type: pull-request
commands: testacc
named-args: true
permission: write
32 changes: 32 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
on:
repository_dispatch:
types: [testacc-command]

name: Acceptance Testing

jobs:
acceptance:
runs-on: ubuntu-latest
if:
github.event.client_payload.slash_command.sha != '' &&
github.event.client_payload.slash_command.pkg != '' &&
github.event.client_payload.pull_request.head.sha == github.event.client_payload.slash_command.sha
concurrency: acceptance_tests

steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19.x

- name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.slash_command.sha }}

- run: make PKG_NAME="${{ github.event.client_payload.slash_command.pkg }}" testacc
env:
ACCTEST_PARALLELISM: 10
DIGITALOCEAN_TOKEN: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
54 changes: 0 additions & 54 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,57 +35,3 @@ jobs:

- name: make test
run: make test

acceptance:
# Runs the acceptance test suite using the `Acceptance Tests` environment.
# The enviroment should be configured to require reviewers approve the
# step. This allows the tests to be added as a check to PRs.
#
# This job has the `continue-on-error` set to true which prevents blocking
# PRs if the tests fail.
needs: unit
runs-on: ubuntu-latest
environment:
name: Acceptance Tests

concurrency: acceptance_tests

continue-on-error: true

steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.19.x

- name: Checkout
uses: actions/checkout@v2

- name: make testacc
run: make testacc
env:
TESTARGS: -parallel 20
DIGITALOCEAN_TOKEN: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}

sweep:
runs-on: ubuntu-latest
needs: acceptance
concurrency: acceptance_tests

steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.19.x

- name: Checkout
uses: actions/checkout@v2

- name: make sweep
run: make sweep
env:
DIGITALOCEAN_TOKEN: ${{ secrets.ACCEPTANCE_TESTS_TOKEN }}
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
6 changes: 3 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
TEST?=$$(go list ./... |grep -v 'vendor')
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
PKG_NAME:=digitalocean
ACCTEST_TIMEOUT:=120m
ACCTEST_PARALLELISM:=2
PKG_NAME?=digitalocean
ACCTEST_TIMEOUT?=120m
ACCTEST_PARALLELISM?=2

default: build

Expand Down

0 comments on commit 99c7105

Please sign in to comment.