-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathaction.yml
More file actions
134 lines (125 loc) · 5.15 KB
/
action.yml
File metadata and controls
134 lines (125 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
name: Test
description: Tests go-tfe within a matrix
inputs:
matrix_index:
description: Index of the matrix strategy runner
required: true
matrix_total:
description: Total number of matrix strategy runners
required: true
address:
description: Address of the HCP Terraform instance to test against
required: true
admin_configuration_token:
description: HCP Terraform Admin API Configuration role token
required: true
admin_provision_licenses_token:
description: HCP Terraform Admin API Provision Licenses role token
required: true
admin_security_maintenance_token:
description: HCP Terraform Admin API Security Maintenance role token
required: true
admin_site_admin_token:
description: HCP Terraform Admin API Site Admin role token
required: true
admin_subscription_token:
description: HCP Terraform Admin API Subscription role token
required: true
admin_support_token:
description: HCP Terraform Admin API Support role token
required: true
admin_version_maintenance_token:
description: HCP Terraform Admin API Version Maintenance role token
required: true
token:
description: HCP Terraform token
required: true
oauth-client-github-token:
description: The GitHub token used for testing OAuth scenarios for VCS workspaces
required: false
enterprise:
description: Test enterprise features (`address` must be running in ON_PREM mode)
required: false
datadog-workflow-token:
description: Datadog API key for test optimization
required: false
skip-statement:
description: Skip tests with this statement substring in their name
required: false
runs:
using: composite
steps:
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Sync dependencies
shell: bash
run: |
go mod download
go mod tidy
- name: Install gotestsum
shell: bash
run: go install gotest.tools/gotestsum@5768fec807c3a620b209c79845e80fb4befa5857 # v1.12.2
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
with:
workflow_conclusion: success
name: junit-test-summary
if_no_artifact_found: warn
branch: main
- name: Split integration tests
id: test_split
uses: hashicorp-forge/go-test-split-action@796beedbdb3d1bea14cad2d3057bab5c5cf15fe5 # v1.0.2
with:
index: ${{ inputs.matrix_index }}
total: ${{ inputs.matrix_total }}
junit-summary: ./ci-summary.xml
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: go
api_key: ${{ inputs.datadog-workflow-token }}
site: datadoghq.com
- name: Run integration tests
shell: bash
env:
TFE_ADDRESS: ${{ inputs.address }}
TFE_TOKEN: ${{ inputs.token }}
TFE_ADMIN_CONFIGURATION_TOKEN: ${{ inputs.admin_configuration_token }}
TFE_ADMIN_PROVISION_LICENSES_TOKEN: ${{ inputs.admin_provision_licenses_token }}
TFE_ADMIN_SECURITY_MAINTENANCE_TOKEN: ${{ inputs.admin_security_maintenance_token }}
TFE_ADMIN_SITE_ADMIN_TOKEN: ${{ inputs.admin_site_admin_token }}
TFE_ADMIN_SUBSCRIPTION_TOKEN: ${{ inputs.admin_subscription_token }}
TFE_ADMIN_SUPPORT_TOKEN: ${{ inputs.admin_support_token }}
TFE_ADMIN_VERSION_MAINTENANCE_TOKEN: ${{ inputs.admin_version_maintenance_token }}
TFC_RUN_TASK_URL: "http://testing-mocks.tfe:22180/runtasks/pass"
GITHUB_POLICY_SET_IDENTIFIER: "ctrombley/test-policy-set"
GITHUB_REGISTRY_MODULE_IDENTIFIER: "ctrombley/terraform-random-module"
GITHUB_REGISTRY_NO_CODE_MODULE_IDENTIFIER: "hashicorp/terraform-random-no-code-module"
OAUTH_CLIENT_GITHUB_TOKEN: "${{ inputs.oauth-client-github-token }}"
SKIP_HYOK_INTEGRATION_TESTS: "${{ inputs.skip-hyok-integration-tests }}"
HYOK_ORGANIZATION_NAME: "${{ inputs.hyok-organization-name }}"
HYOK_WORKSPACE_NAME: "${{ inputs.hyok-workspace-name }}"
HYOK_POOL_ID: "${{ inputs.hyok-pool-id }}"
HYOK_PLAN_ID: "${{ inputs.hyok-plan-id }}"
HYOK_STATE_VERSION_ID: "${{ inputs.hyok-state-version-id }}"
HYOK_CUSTOMER_KEY_VERSION_ID: "${{ inputs.hyok-customer-key-version-id }}"
HYOK_ENCRYPTED_DATA_KEY_ID: "${{ inputs.hyok-encrypted-data-key-id }}"
GO111MODULE: "on"
ENABLE_TFE: ${{ inputs.enterprise }}
run: |
gotestsum --junitfile summary.xml --format short-verbose --rerun-fails=3 --packages=./ -- -parallel=2 -timeout=59m -coverprofile cover.out -run "${{ steps.test_split.outputs.run }}" ${{ inputs.skip-statement }}
- name: Upload test artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: junit-test-summary-${{ matrix.index }}
path: |
summary.xml
cover.out
retention-days: 1