|
| 1 | +name: Build & Test WSL |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + windows: |
| 7 | + runs-on: windows-latest |
| 8 | + name: Windows (using WSL) |
| 9 | + # Following https://trac.sagemath.org/ticket/25206#comment:63 |
| 10 | + steps: |
| 11 | + - name: Configure git |
| 12 | + run: git config --global core.symlinks true |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + - name: Install Ubuntu 20.04 (in WSL) |
| 15 | + run: | |
| 16 | + (New-Object System.Net.WebClient).DownloadFile("https://aka.ms/wslubuntu2004", "Ubuntu.appx") |
| 17 | + Expand-Archive Ubuntu.appx |
| 18 | + Ubuntu\ubuntu2004.exe install --root |
| 19 | + - name: Install dependencies |
| 20 | + run: | |
| 21 | + Function ExtractPackages |
| 22 | + { |
| 23 | + param($path) |
| 24 | + @(Get-Content $path | Where-Object { !$_.StartsWith("#") }) |
| 25 | + } |
| 26 | + $packages = Get-ChildItem build/pkgs -recurse -Include debian.txt, debian-bootstrap.txt | foreach-object { ExtractPackages $_.FullName } | sort -Unique |
| 27 | + # Add tox which is use to build |
| 28 | + $packages += 'tox' |
| 29 | + echo "Install the following packages:" @packages |
| 30 | + # Add deadsnakes so that libpython3.7-dev is found |
| 31 | + & wsl sudo add-apt-repository ppa:deadsnakes/ppa |
| 32 | + # Install |
| 33 | + & wsl sudo apt-get update -y |
| 34 | + & wsl sudo apt-get install -y @packages |
| 35 | + - name: Build |
| 36 | + run: wsl tox -e local -- SAGE_NUM_THREADS=4 build |
| 37 | + env: |
| 38 | + # WSL runs everything as root, so we have to enable build as root user |
| 39 | + EXTRA_CONFIGURE_ARGS: "--enable-build-as-root" |
| 40 | + # If make is invoked in parellel (i.e. with -jN where N > 1), then we sometimes run into errors for some reason |
| 41 | + # So keep N small in order to minimize the risk |
| 42 | + MAKE: "make -j2" |
| 43 | + WSLENV: EXTRA_CONFIGURE_ARGS:MAKE |
| 44 | + - name: Test |
| 45 | + run: wsl tox -e local -- SAGE_NUM_THREADS=4 ptest |
| 46 | + - name: Prepare logs artifact |
| 47 | + run: mkdir -p "artifacts/logs"; cp -r .tox/*/log "artifacts/logs" |
| 48 | + shell: bash |
| 49 | + if: always() |
| 50 | + - uses: actions/upload-artifact@v1 |
| 51 | + with: |
| 52 | + path: artifacts |
| 53 | + name: logs |
| 54 | + if: always() |
| 55 | + - name: Print out logs for immediate inspection |
| 56 | + # and markup the output with GitHub Actions logging commands |
| 57 | + run: .github/workflows/scan-logs.sh "artifacts/logs" |
| 58 | + shell: bash |
| 59 | + if: always() |
0 commit comments