-
Notifications
You must be signed in to change notification settings - Fork 6
151 lines (138 loc) · 7.84 KB
/
gotest-cloud.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# This is a Go Test workflow that is manually triggered
name: GoTest - Cloud
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
pull_request:
branches:
- main
paths:
- 'internal/**'
- '**.go'
types: [opened, reopened, synchronize]
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI
description: 'Release version that is tested against.'
# Default value if no value is explicitly provided
default: 'Latest'
# Input has to be provided for the workflow to run
required: false
# The data type of the input
type: string
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a job for preparing test env, and a job for running go tests
gotest-prep:
# GitHub environment for the job
environment: Go Test - Cloud
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checkout repo
- name: Checkout Repo
uses: actions/checkout@v4
- name: Run Azure PowerShell inline script
uses: azure/powershell@v2
with:
inlineScript: |
./scripts/test-env-power-management/azure_env.ps1 `
-ClientId ${{secrets.CLIENT_ID}} `
-ClientSecret ${{secrets.CLIENT_SECRET}} `
-DomainFqdn ${{secrets.DOMAIN_FQDN}} `
-Hostname ${{secrets.HOSTNAME}} `
-AzureClientId ${{secrets.AZURE_CLIENT_ID}} `
-AzureClientSecret ${{secrets.AZURE_CLIENT_SECRET}} `
-AzureTenantId ${{secrets.AZURE_TENANT_ID}} `
-AzureSubscriptionId ${{secrets.AZURE_SUBSCRIPTION_ID}} `
-AzureResourceGroupName ${{secrets.AZURE_RESOURCE_GROUP_NAME}} `
-AzureAdVmName ${{secrets.AZURE_AD_VM_NAME}} `
-AzureConnectorVm1Name ${{secrets.AZURE_CONNECTOR_VM1_NAME}} `
-AzureConnectorVm2Name ${{secrets.AZURE_CONNECTOR_VM2_NAME}} `
-OnPremises $false
azPSVersion: "latest"
gotest-cloud:
needs: gotest-prep
# GitHub environment for the job
environment: Go Test - Cloud
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checkout repo
- name: Checkout Repo
uses: actions/checkout@v4
# Set up Go
- name: Setup Go 1.21.x
uses: actions/setup-go@v5
with:
# Semantic version range syntax or exact version of Go
go-version: '1.21.x'
# Install dependencies
- name: Install dependencies
run: |
go get .
# Set env
- name: Set env
run: |
echo "TF_ACC=1" >> $GITHUB_ENV
echo "GOTEST_CONTEXT=${{vars.GOTEST_CONTEXT}}" >> $GITHUB_ENV
echo "CITRIX_CUSTOMER_ID=${{secrets.CITRIX_CUSTOMER_ID}}" >> $GITHUB_ENV
echo "CITRIX_CLIENT_ID=${{secrets.CITRIX_CLIENT_ID}}" >> $GITHUB_ENV
echo "CITRIX_CLIENT_SECRET=${{secrets.CITRIX_CLIENT_SECRET}}" >> $GITHUB_ENV
echo "CITRIX_HOSTNAME=${{secrets.CITRIX_HOSTNAME}}" >> $GITHUB_ENV
echo "CITRIX_ENVIRONMENT=${{secrets.CITRIX_ENVIRONMENT}}" >> $GITHUB_ENV
echo "TEST_ZONE_INPUT_AZURE=${{secrets.TEST_ZONE_INPUT_AZURE}}" >> $GITHUB_ENV
echo "TEST_ZONE_DESCRIPTION=${{vars.TEST_ZONE_DESCRIPTION}}" >> $GITHUB_ENV
echo "TEST_RESOURCE_LOCATION_NAME=${{vars.TEST_RESOURCE_LOCATION_NAME}}" >> $GITHUB_ENV
echo "TEST_HYPERV_NAME_AZURE=${{vars.TEST_HYPERV_NAME_AZURE}}" >> $GITHUB_ENV
echo "TEST_HYPERV_AD_ID=${{secrets.TEST_HYPERV_AD_ID}}" >> $GITHUB_ENV
echo "TEST_HYPERV_SUBSCRIPTION_ID=${{secrets.TEST_HYPERV_SUBSCRIPTION_ID}}" >> $GITHUB_ENV
echo "TEST_HYPERV_APPLICATION_ID=${{secrets.TEST_HYPERV_APPLICATION_ID}}" >> $GITHUB_ENV
echo "TEST_HYPERV_APPLICATION_SECRET=${{secrets.TEST_HYPERV_APPLICATION_SECRET}}" >> $GITHUB_ENV
echo "TEST_HYPERV_APPLICATION_SECRET_EXPIRATION_DATE=${{secrets.TEST_HYPERV_APPLICATION_SECRET_EXPIRATION_DATE}}" >> $GITHUB_ENV
echo "TEST_HYPERV_RP_NAME=${{vars.TEST_HYPERV_RP_NAME}}" >> $GITHUB_ENV
echo "TEST_HYPERV_RP_REGION=${{secrets.TEST_HYPERV_RP_REGION}}" >> $GITHUB_ENV
echo "TEST_HYPERV_RP_VIRTUAL_NETWORK_RESOURCE_GROUP=${{secrets.TEST_HYPERV_RP_VIRTUAL_NETWORK_RESOURCE_GROUP}}" >> $GITHUB_ENV
echo "TEST_HYPERV_RP_VIRTUAL_NETWORK=${{secrets.TEST_HYPERV_RP_VIRTUAL_NETWORK}}" >> $GITHUB_ENV
echo "Test_HYPERV_RP_SUBNETS=${{secrets.Test_HYPERV_RP_SUBNETS}}" >> $GITHUB_ENV
echo "TEST_MC_NAME=${{vars.TEST_MC_NAME}}" >> $GITHUB_ENV
echo "TEST_MC_SERVICE_ACCOUNT=${{secrets.TEST_MC_SERVICE_ACCOUNT}}" >> $GITHUB_ENV
echo "TEST_MC_SERVICE_ACCOUNT_PASS=${{secrets.TEST_MC_SERVICE_ACCOUNT_PASS}}" >> $GITHUB_ENV
echo "TEST_MC_SERVICE_OFFERING=${{secrets.TEST_MC_SERVICE_OFFERING}}" >> $GITHUB_ENV
echo "TEST_MC_MASTER_IMAGE=${{secrets.TEST_MC_MASTER_IMAGE}}" >> $GITHUB_ENV
echo "TEST_MC_MASTER_IMAGE_UPDATED=${{secrets.TEST_MC_MASTER_IMAGE_UPDATED}}" >> $GITHUB_ENV
echo "TEST_MC_IMAGE_RESOURCE_GROUP=${{secrets.TEST_MC_IMAGE_RESOURCE_GROUP}}" >> $GITHUB_ENV
echo "TEST_MC_IMAGE_STORAGE_ACCOUNT=${{secrets.TEST_MC_IMAGE_STORAGE_ACCOUNT}}" >> $GITHUB_ENV
echo "TEST_MC_IMAGE_CONTAINER=${{secrets.TEST_MC_IMAGE_CONTAINER}}" >> $GITHUB_ENV
echo "TEST_MC_SUBNET=${{secrets.TEST_MC_SUBNET}}" >> $GITHUB_ENV
echo "TEST_MC_DOMAIN=${{secrets.TEST_MC_DOMAIN}}" >> $GITHUB_ENV
echo "TEST_MC_NAME_MANUAL=${{vars.TEST_MC_NAME_MANUAL}}" >> $GITHUB_ENV
echo "TEST_MC_ALLOCATION_TYPE_MANUAL_POWER_MANAGED=${{vars.TEST_MC_ALLOCATION_TYPE_MANUAL_POWER_MANAGED}}" >> $GITHUB_ENV
echo "TEST_MC_SESSION_SUPPORT_MANUAL_POWER_MANAGED=${{vars.TEST_MC_SESSION_SUPPORT_MANUAL_POWER_MANAGED}}" >> $GITHUB_ENV
echo "TEST_MC_REGION_MANUAL_POWER_MANAGED=${{secrets.TEST_MC_REGION_MANUAL_POWER_MANAGED}}" >> $GITHUB_ENV
echo "TEST_MC_RESOURCE_GROUP_MANUAL_POWER_MANAGED=${{secrets.TEST_MC_RESOURCE_GROUP_MANUAL_POWER_MANAGED}}" >> $GITHUB_ENV
echo "TEST_MC_MACHINE_NAME_MANUAL_AZURE=${{secrets.TEST_MC_MACHINE_NAME_MANUAL_AZURE}}" >> $GITHUB_ENV
echo "TEST_MC_MACHINE_ACCOUNT_MANUAL_AZURE=${{secrets.TEST_MC_MACHINE_ACCOUNT_MANUAL_AZURE}}" >> $GITHUB_ENV
echo "TEST_MC_MACHINE_PROFILE_VM_NAME=${{secrets.TEST_MC_MACHINE_PROFILE_VM_NAME}}" >> $GITHUB_ENV
echo "TEST_MC_MACHINE_PROFILE_RESOURCE_GROUP=${{secrets.TEST_MC_MACHINE_PROFILE_RESOURCE_GROUP}}" >> $GITHUB_ENV
echo "TEST_DG_NAME=${{vars.TEST_DG_NAME}}" >> $GITHUB_ENV
echo "TEST_POLICY_SET_WITHOUT_DG_NAME=${{vars.TEST_POLICY_SET_WITHOUT_DG_NAME}}" >> $GITHUB_ENV
echo "TEST_POLICY_SET_NAME=${{vars.TEST_POLICY_SET_NAME}}" >> $GITHUB_ENV
echo "TEST_APP_NAME=${{vars.TEST_APP_NAME}}" >> $GITHUB_ENV
echo "TEST_ADMIN_FOLDER_NAME=${{vars.TEST_ADMIN_FOLDER_NAME}}" >> $GITHUB_ENV
echo "TEST_ROLE_NAME=${{vars.TEST_ROLE_NAME}}" >> $GITHUB_ENV
echo "TEST_ADMIN_SCOPE_NAME=${{vars.TEST_ADMIN_SCOPE_NAME}}" >> $GITHUB_ENV
echo "TEST_ADMIN_USER_NAME=${{secrets.TEST_ADMIN_USER_NAME}}" >> $GITHUB_ENV
echo "TEST_ADMIN_USER_DOMAIN=${{secrets.TEST_ADMIN_USER_DOMAIN}}" >> $GITHUB_ENV
# Test PreCheck
- name: Test Precheck
run: go test -v ./internal/test -run "^TestAzureMcsSuitePreCheck$"
# Test
- name: Test
run: go test -v ./internal/test -run "^TestAzureMcs$" -timeout 1h
# Sweep
- name: Sweep
if: always()
run: go test -v ./internal/test -run "^TestAzureMcs$" -timeout 1h -sweep-run "citrix_zone,citrix_zone,citrix_admin_folder,citrix_admin_role,citrix_admin_scope" -sweep="azure"