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

test acceptance #151

Closed
Closed
Show file tree
Hide file tree
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
78 changes: 39 additions & 39 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ name: Release
# This GitHub action creates a release when manually run with signer details
on:
workflow_dispatch:
inputs:
CS_ID:
description: "Code Signing ID"
required: true
type: string
CS_API_TOKEN:
description: "Code Signing API Token"
required: true
type: string
# inputs:
# CS_ID:
# description: "Code Signing ID"
# required: true
# type: string
# CS_API_TOKEN:
# description: "Code Signing API Token"
# required: true
# type: string

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write
# # Releases need permissions to read and write the repository contents.
# # GitHub considers creating releases and uploading assets as writing contents.
# permissions:
# contents: write

jobs:
acceptance-tests:
Expand All @@ -32,36 +32,36 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Inject Env File
run: echo "${{ secrets.ACCEPTANCE_ENV }}" > acceptance.env
run: echo "${{ secrets.ACCEPTANCE_ENV_FILE }}" > acceptance.env

- name: Run Acceptance Tests
run: just acceptance-tests acceptance.env

goreleaser:
runs-on: Signer
needs: acceptance-tests
steps:
- uses: actions/[email protected]
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
# goreleaser:
# runs-on: Signer
# needs: acceptance-tests
# steps:
# - uses: actions/[email protected]
# with:
# # Allow goreleaser to access older tag information.
# fetch-depth: 0

- name: Setup Just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Setup Just
# uses: extractions/setup-just@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/[email protected]
with:
go-version-file: 'go.mod'
cache: true
# - uses: actions/[email protected]
# with:
# go-version-file: 'go.mod'
# cache: true

- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CS_ID: ${{ inputs.CS_ID }}
CS_API_TOKEN: ${{ inputs.CS_API_TOKEN }}
# - name: Run GoReleaser
# uses: goreleaser/[email protected]
# with:
# args: release --clean
# env:
# # GitHub sets the GITHUB_TOKEN secret automatically.
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CS_ID: ${{ inputs.CS_ID }}
# CS_API_TOKEN: ${{ inputs.CS_API_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/test-acceptance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Terraform Provider release workflow.
name: TestAcceptance

# This GitHub action creates a release when manually run with signer details
on:
workflow_dispatch:

jobs:
acceptance-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Just
uses: extractions/setup-just@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Inject Env File
run: echo "${{ secrets.ACCEPTANCE_ENV_FILE }}" > acceptance.env

- name: Run Acceptance Tests
run: just acceptance-tests acceptance.env
22 changes: 8 additions & 14 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ coverage-provider:
tidy-tools:
cd {{ TOOLS_PROVIDER_DIR }} && go mod tidy

acceptance-tests ENV_PATH='' +ARGS='':
acceptance-tests ENV_PATH=''+ARGS='':
#!/usr/bin/env bash
set -e

if [ -z "{{ ENV_PATH }}" ]; then
echo "Error: ENV_PATH argument is required" >&2
Expand All @@ -113,18 +112,13 @@ acceptance-tests ENV_PATH='' +ARGS='':
exit 1
fi

read -p "This is going to run requests against UXI backend. Continue (y/Y)? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
# we run these separately so that they do not interfere with each other since GoLang executes
# tests in different directories at the same time
for dir in "datasources" "resources"
do
echo "Running tests in $dir..."
env $(cat {{ ENV_PATH }} | xargs) TF_ACC=1 go test -v ./test/live/$dir/... -race {{ ARGS }}
done
fi
# we run these separately so that they do not interfere with each other since GoLang executes
# tests in different directories at the same time
for dir in "datasources" "resources"
do
echo "Running tests in $dir..."
env $(cat {{ ENV_PATH }} | xargs) TF_ACC=1 go test -v ./test/live/$dir/... -race {{ ARGS }}
done

test +ARGS='':
just test-client {{ ARGS }}
Expand Down
Loading