start-workflow-run-tests #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run integration tests | |
on: | |
repository_dispatch: | |
types: | |
- start-workflow-run-tests | |
workflow_dispatch: | |
inputs: | |
SPSE: | |
sharepoint_version: 'SE' | |
dtl_poolName: 'AzureCP-Tests-Subscription' | |
SP2013: | |
sharepoint_version: '2013' | |
dtl_poolName: 'AzureCP-Tests-2013' | |
jobs: | |
create-test-environment: | |
if: github.event.client_payload.skip_create_environment != true | |
runs-on: ubuntu-latest | |
env: | |
# ternary 'else' is not supported, so use this workaround: https://github.com/orgs/community/discussions/25725#discussioncomment-3248924 | |
dtl_provisionSharePointSubscription: ${{ contains(github.event.client_payload.sharepoint_versions, 'SE') && 'Subscription-RTM' || 'No' }} | |
dtl_provisionSharePoint2019: ${{ contains(github.event.client_payload.sharepoint_versions, '2019') }} | |
dtl_provisionSharePoint2016: ${{ contains(github.event.client_payload.sharepoint_versions, '2016') }} | |
dtl_provisionSharePoint2013: ${{ contains(github.event.client_payload.sharepoint_versions, '2013') }} | |
steps: | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Create DevTest Labs environment | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az lab environment create --lab-name ${{ vars.dtl_serviceName }} --name ${{ vars.dtl_environmentName }} --resource-group ${{ vars.dtl_rgName }} --artifact-source-name "Public Repo" \ | |
--arm-template "/subscriptions/${{ vars.dtl_subscriptionId }}/resourceGroups/${{ vars.dtl_rgName }}/providers/Microsoft.DevTestLab/labs/${{ vars.dtl_serviceName }}/artifactSources/Public Environment Repo/armTemplates/SharePoint-AllVersions" \ | |
--parameters "[ { \"name\": \"provisionSharePoint2013\", \"value\": \"${{ env.dtl_provisionSharePoint2013 }}\" }, { \"name\": \"provisionSharePoint2016\", \"value\": \"${{ env.dtl_provisionSharePoint2016 }}\" }, { \"name\": \"provisionSharePoint2019\", \"value\": \"${{ env.dtl_provisionSharePoint2019 }}\" }, { \"name\": \"provisionSharePointSubscription\", \"value\": \"${{ env.dtl_provisionSharePointSubscription }}\" }, { \"name\": \"configureADFS\", \"value\": \"true\" }, { \"name\": \"enableHybridBenefitServerLicenses\", \"value\": \"true\" }, { \"name\": \"enableAutomaticUpdates\", \"value\": \"${{ vars.dtl_enableAutomaticUpdates }}\" }, { \"name\": \"adminUserName\", \"value\": \"${{ vars.dtl_adminUserName }}\" }, { \"name\": \"adminPassword\", \"value\": \"${{ secrets.dtl_accountsPassword }}\" }, { \"name\": \"serviceAccountsPassword\", \"value\": \"${{ secrets.dtl_accountsPassword }}\" }, { \"name\": \"addPublicIPAddress\", \"value\": \"${{ vars.dtl_addPublicIPAddress }}\" }, { \"name\": \"RDPTrafficAllowed\", \"value\": \"${{ vars.dtl_RDPTrafficAllowed }}\" }, { \"name\": \"addAzureBastion\", \"value\": \"${{ vars.dtl_addAzureBastion }}\" } ]" | |
#apply-artifacts-spse: | |
apply-artifacts: | |
runs-on: ubuntu-latest | |
needs: create-test-environment | |
if: | | |
always() && | |
!contains(needs.*.result, 'failure') && | |
!contains(needs.*.result, 'cancelled') | |
#if: startsWith(vars.dtl_provisionSharePointSubscription, 'Subscription-') | |
strategy: | |
matrix: | |
sharepoint_version: ${{ github.event.client_payload.sharepoint_versions }} | |
# include: | |
# - sharepoint_version: Subscription-RTM #${{ startsWith(matrix.sharepoint_version, 'Subscription-') }} | |
# sps_version: 'SE' | |
# dtl_poolName: 'AzureCP-Tests-Subscription' | |
# - sharepoint_version: 2019 | |
# sps_version: '2019' | |
# dtl_poolName: 'AzureCP-Tests-2019' | |
# - sharepoint_version: 2016 | |
# sps_version: '2016' | |
# dtl_poolName: 'AzureCP-Tests-2016' | |
# - sharepoint_version: 2013 | |
# sps_version: '2013' | |
# dtl_poolName: 'AzureCP-Tests-2013' | |
env: | |
vm_name: ${{ format('SP{0}', matrix.sharepoint_version) }} #${{ format('SP{0}', matrix.sps_version) }} #SPSE | |
dtl_poolName: ${{ format('AzureCP-Tests-{0}', matrix.sharepoint_version) }} | |
steps: | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Apply artifact - Register a VSTS agent in DevOps agent pools | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az lab vm apply-artifacts --lab-name ${{ vars.dtl_serviceName }} --name ${{ env.vm_name }} --resource-group ${{ vars.dtl_rgName }} \ | |
--artifacts "[ { \"artifactId\": \"/subscriptions/${{ vars.dtl_subscriptionId }}/resourceGroups/${{ vars.dtl_rgName }}/providers/Microsoft.DevTestLab/labs/${{ vars.dtl_serviceName }}/artifactSources/public repo/artifacts/windows-vsts-build-agent\", \"parameters\": [ { \"name\": \"vstsAccount\", \"value\": \"${{ vars.dtl_azdevopsAccount }}\" }, { \"name\": \"vstsPassword\", \"value\": \"${{ secrets.dtl_azdevopsPassword }}\" }, { \"name\": \"poolName\", \"value\": \"${{ env.dtl_poolName }}\" }, { \"name\": \"windowsLogonAccount\", \"value\": \"${{ format('{0}@contoso.local', vars.dtl_adminUserName) }}\" }, { \"name\": \"windowsLogonPassword\", \"value\": \"${{ secrets.dtl_accountsPassword }}\" }, { \"name\": \"agentName\", \"value\": \"${{ env.vm_name }}\" }, { \"name\": \"agentNameSuffix\", \"value\": \"${{ vars.dtl_agentNameSuffix }}\" }, { \"name\": \"RunAsAutoLogon\", \"value\": \"false\" }, { \"name\": \"driveLetter\", \"value\": \"C\" }, { \"name\": \"workDirectory\", \"value\": \"\" } ] } ]" |