|
| 1 | +name: Setup WSL Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +jobs: |
| 8 | + leia-tests: |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + env: |
| 11 | + TERM: xterm |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + leia-test: |
| 16 | + - setup-linux |
| 17 | + node-version: |
| 18 | + - "20" |
| 19 | + os: |
| 20 | + - windows-2022 |
| 21 | + defaults: |
| 22 | + run: |
| 23 | + shell: wsl bash --noprofile --norc -euo pipefail "$(script="$(wslpath '{0}')" && sed -i 's/\r$//' "$script" && echo "$script")" |
| 24 | + steps: |
| 25 | + - name: Install Ubuntu in WSL2 |
| 26 | + shell: pwsh |
| 27 | + run: | |
| 28 | + # Manually download and install Ubuntu to avoid the reboot that kills the Actions runner |
| 29 | + Set-Service -Name StorSvc -StartupType Automatic |
| 30 | + wsl.exe --set-default-version 2 |
| 31 | + wsl.exe --update |
| 32 | + $distributionInfo = Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/microsoft/WSL/refs/heads/master/distributions/DistributionInfo.json' |
| 33 | + $downloadUrl = $distributionInfo.Distributions.Where({ $_.Name -eq 'Ubuntu' }).Amd64PackageUrl |
| 34 | + $filename = [System.IO.Path]::GetFileName($downloadUrl) |
| 35 | + Write-Output 'Installing Ubuntu...' |
| 36 | + Set-Location $env:TEMP |
| 37 | + Invoke-WebRequest -Uri $downloadUrl -OutFile $filename |
| 38 | + Expand-Archive -Path $filename -DestinationPath .\ |
| 39 | + .\ubuntu.exe install --root |
| 40 | + - name: Checkout code |
| 41 | + uses: actions/checkout@v4 |
| 42 | + - name: Install node ${{ matrix.node-version }} |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: ${{ matrix.node-version }} |
| 46 | + registry-url: https://registry.npmjs.org |
| 47 | + cache: npm |
| 48 | + - name: Bundle Deps |
| 49 | + uses: lando/prepare-release-action@v3 |
| 50 | + with: |
| 51 | + lando-plugin: true |
| 52 | + version: dev |
| 53 | + sync: false |
| 54 | + - name: Install pkg dependencies |
| 55 | + run: npm clean-install --prefer-offline --frozen-lockfile --production |
| 56 | + - name: Package into node binary |
| 57 | + uses: lando/pkg-action@v5 |
| 58 | + id: pkg-action |
| 59 | + with: |
| 60 | + entrypoint: bin/lando |
| 61 | + node-version: ${{ matrix.node-version }} |
| 62 | + options: --options dns-result-order=ipv4first |
| 63 | + upload: false |
| 64 | + pkg: "@yao-pkg/pkg@5.16.1" |
| 65 | + - name: Install full deps |
| 66 | + run: npm clean-install --prefer-offline --frozen-lockfile |
| 67 | + - name: Setup lando ${{ steps.pkg-action.outputs.file }} |
| 68 | + uses: lando/setup-lando@v3 |
| 69 | + with: |
| 70 | + auto-setup: false |
| 71 | + lando-version: ${{ steps.pkg-action.outputs.file }} |
| 72 | + telemetry: false |
| 73 | + - name: Run Leia Tests |
| 74 | + run: | |
| 75 | + npx leia "examples/${{ matrix.leia-test }}/README.md" -c 'Destroy tests' --stdin --debug |
0 commit comments