-
Notifications
You must be signed in to change notification settings - Fork 6
136 lines (123 loc) · 4.74 KB
/
qa-azure.yaml
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
name: QA on Azure
# QA checks on Azure, allowing the use of a real WSL back-en
concurrency: azure-vm
on:
pull_request:
workflow_dispatch:
push:
branches: [main]
env:
az_name: wsl-ci-3
az_resource_group: wsl
jobs:
vm-setup:
name: Set up Azure VM
runs-on: [self-hosted, do-not-use]
steps:
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_VM_CREDS }}
- name: Start the Runner
shell: bash
run: |
az vm start --name ${{ env.az_name }} --resource-group ${{ env.az_resource_group }}
qa:
name: Run end-to-end tests on the Azure VM
runs-on: [self-hosted, Windows]
needs: vm-setup
steps:
- name: Set up git
uses: canonical/ubuntu-pro-for-windows/.github/actions/setup-git@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ubuntu
uses: Ubuntu/WSL/.github/actions/wsl-install@main
with:
distro: "Ubuntu"
- name: Set up Ubuntu-Preview
uses: Ubuntu/WSL/.github/actions/wsl-install@main
with:
distro: "Ubuntu-Preview"
- name: Set up Go
shell: powershell
run: |
winget install GoLang.Go
Exit(0)
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.13.x'
- name: Set up MSBuild
uses: microsoft/[email protected]
- name: Set up the certfificate
shell: powershell
run: |
New-Item -ItemType directory -Path certificate
Set-Content -Path certificate\certificate.txt -Value '${{ secrets.CERTIFICATE }}'
certutil -decode certificate\certificate.txt certificate\certificate.pfx
$pwd = ConvertTo-SecureString '${{ secrets.CERTIFICATE_PASSWORD }}' -AsPlainText -Force
Import-PfxCertificate -Password $pwd -CertStoreLocation Cert:LocalMachine\Trust -FilePath certificate\certificate.pfx
Import-PfxCertificate -Password $pwd -CertStoreLocation Cert:CurrentUser\My -FilePath certificate\certificate.pfx
- name: Build WSL-Pro-Service
shell: powershell
run: |
Copy-Item -Path "${HOME}/.gitconfig" -Destination "\\wsl$\Ubuntu-Preview\etc\gitconfig"
Write-Output "::group::Point internal dependencies to this branch"
$want_version = "${{ github.event.pull_request.head.sha }}".Substring(0, 12)
$dependencies = $(go.exe mod edit -json | jq -r @"
.Require[]
| select(.Path | startswith("github.com/${{ github.repository }}"))
| select(.Version | endswith("${want_version}") | not )
| (.Path) + "@${want_version}"
"@)
go.exe get $dependencies
go.exe mod tidy
Write-Output "::endgroup::"
New-Item -ItemType Directory "ci-build/wsl-pro-service"
.\tools\build\build-deb.ps1 -OutputDir "ci-build/wsl-pro-service"
- name: Build Appx
shell: powershell
run: |
New-Item -ItemType Directory "ci-build/windows-agent"
Get-AppxPackage -Name "CanonicalGroupLimited.UbuntuProForWindows" | Remove-AppxPackage
.\tools\build\build-appx.ps1 -OutputDir "ci-build/windows-agent" -SkipInstall
- name: Test
shell: powershell
env:
GIT_TERMINAL_PROMPT: "0"
UP4W_TEST_OVERRIDE_DESTRUCTIVE_CHECKS: "1"
UP4W_TEST_BUILD_PATH: "ci-build"
UP4W_TEST_PRO_TOKEN: "${{ secrets.UBUNTU_PRO_TOKEN }}"
run: |
go env -w "GOPRIVATE=github.com/${{ github.repository }}"
go test .\end-to-end -shuffle=on -timeout 20m
if ( "$LastExitCode" -ne "0" ) { Exit(1) }
- name: Clean up
if: always()
shell: powershell
run: |
# Clean up artifacts
# For some reason, this file interferes with setup-go
Remove-Item -Recurse -Path 'C:\actions-runner\_work\_tool\go' -ErrorAction Ignore
# Remove .gitconfig so that the github URL overrides do not stack
Remove-Item -Recurse -Path "${HOME}\.gitconfig" -ErrorAction Ignore
# Uninstall Appx
Get-AppxPackage -Name "CanonicalGroupLimited.UbuntuProForWindows" | Remove-AppxPackage -ErrorAction Ignore
stop-vm:
name: Clean up the Azure VM
runs-on: [self-hosted, do-not-use]
needs: [vm-setup, qa]
if: always()
steps:
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_VM_CREDS }}
- name: Deallocate the Runner
shell: bash
run: |
az vm deallocate --name ${{ env.az_name }} --resource-group ${{ env.az_resource_group }}