Run End-To-End tests in our CI #17
Workflow file for this run
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: 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: ubuntu-latest | |
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: Clean up Go | |
shell: powershell | |
# For some reason, this file interferes with setup-go | |
run: | | |
$p = 'D:\actions-runner\_work\_tool\go' | |
if ( Test-Path -Path "${p}" ) { | |
Write-Output "Removing old Go install" | |
Remove-Item -Recurse -Path "${p}" | |
} | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "go.work" | |
- name: Test | |
id: test | |
shell: powershell | |
env: | |
UP4W_TEST_OVERRIDE_DESTRUCTIVE_CHECKS: "1" | |
UP4W_TEST_PRO_TOKEN: "${{ secrets.UBUNTU_PRO_TOKEN }}" | |
run: | | |
go env -w "GOPRIVATE=github.com/${{ github.repository }}" | |
export GIT_TERMINAL_PROMPT: "0" | |
go test .\end-to-end -shuffle=on -timeout 20m | |
if ( "$LastExitCode" -ne "0" ) { Exit(1) } | |
- name: Build WSL-Pro-Service log | |
if: steps.test.outcome == 'failure' | |
shell: powershell | |
run: Get-Content ".\end-to-end\BuildWslProService.log" | |
- name: Build Appx log | |
if: steps.test.outcome == 'failure' | |
shell: powershell | |
run: Get-Content ".\end-to-end\BuildWindowsAgent.log" | |
stop-vm: | |
name: Clean up the Azure VM | |
runs-on: ubuntu-latest | |
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 }} |