Skip to content
Myr

[actions] fix WSL tests: properly handle Debian apt sources issue

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The Debian WSL image has stale apt sources pointing to ftp.debian.org which no longer hosts bullseye-backports. The previous fix ran sed after the first setup-wsl call, but that call already failed because additional-packages triggers apt-get update internally. For wsl_matrix (Debian, Ubuntu): - Ubuntu: install with additional-packages directly (no apt issue) - Debian: install without packages first, fix sources.list with sed, then run apt-get update/upgrade/install manually with retries - Exclude Debian and Ubuntu-20.04 --lts since node v24+ has exec format errors on WSL1 For wsl_matrix_unofficial (Alpine): - Remove the Debian-specific fix entirely (Alpine uses apk, not apt) See https://github.com/Vampire/setup-wsl/issues/76

authored by Jordan Harband · committed by Jordan Harband · parent 630a01f · Browse files · 1 file+39 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+39 added−16 removed

  • other:+39 added−16 removed

1 file+39 added−16 removed

modified:.github/workflows/windows-npm.yml+39 added-16 removed
123 unmodified lines
124 - wsl-distrib: Ubuntu-18.04125 npm-node-version: '21'126 - wsl-distrib: Ubuntu-18.04127 npm-node-version: '18'128 # node v24+ doesn't work on WSL1 (exec format error)129 - wsl-distrib: Debian130 npm-node-version: '--lts'131 - wsl-distrib: Ubuntu-20.04132 npm-node-version: '--lts'133 method:134 - ''135 - 'script'136 steps:137 # For Ubuntu: install with packages directly138 - if: matrix.wsl-distrib != 'Debian'132 - uses: Vampire/setup-wsl@v3139 uses: Vampire/setup-wsl@v3140 with:141 distribution: ${{ matrix.wsl-distrib }}142 additional-packages: bash git curl ca-certificates wget143137 # see https://github.com/Vampire/setup-wsl/issues/76#issuecomment-3258201135138 - shell: 'wsl-bash {0}'139 run: 'sed -i s/ftp.debian.org/archive.debian.org/ /etc/apt/sources.list'140 - uses: Vampire/setup-wsl@v3144 # For Debian: install without packages first (apt-get update fails due to stale sources.list)145 # see https://github.com/Vampire/setup-wsl/issues/76146 - if: matrix.wsl-distrib == 'Debian'147 uses: Vampire/setup-wsl@v3148 with:149 distribution: ${{ matrix.wsl-distrib }}143 additional-packages: bash git curl ca-certificates wget144 update: 'true'150 - if: matrix.wsl-distrib == 'Debian'151 shell: 'wsl-bash {0}'152 run: 'sed -i s/ftp.debian.org/archive.debian.org/ /etc/apt/sources.list'153 - if: matrix.wsl-distrib == 'Debian'154 name: 'Install packages with retries'155 shell: 'wsl-bash {0}'156 run: |157 retry() {158 local n=0159 local max=3160 local delay=5161 while true; do162 "$@" && break || {163 n=$((n+1))164 if [ $n -lt $max ]; then165 echo "Command failed. Attempt $n/$max. Retrying in $delay seconds..."166 sleep $delay167 else168 echo "Command failed after $max attempts."169 return 1170 fi171 }172 done173 }174 retry apt-get update175 retry apt-get upgrade --yes176 retry apt-get install --yes bash git curl ca-certificates wget177178 - name: Retrieve nvm on WSL179 run: |180 if [ -z "${{ matrix.method }}" ]; then
37 unmodified lines
218 with:219 distribution: ${{ matrix.wsl-distrib }}220 additional-packages: bash git curl ca-certificates wget221190 # see https://github.com/Vampire/setup-wsl/issues/76#issuecomment-3258201135191 - shell: 'wsl-bash {0}'192 run: 'sed -i s/ftp.debian.org/archive.debian.org/ /etc/apt/sources.list'193 - uses: Vampire/setup-wsl@v3194 with:195 distribution: ${{ matrix.wsl-distrib }}196 additional-packages: bash git curl ca-certificates wget197 update: 'true'198222 - name: Retrieve nvm on WSL223 run: |224 if [ -z "${{ matrix.method }}" ]; then225 curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash
14 unmodified lines