Skip to content

Commit

Permalink
Make procuctId to URL translation work again (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed May 27, 2024
1 parent a6c8b14 commit e5717e2
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ val ubuntu1604 = mapOf(

val distributions = listOf(
debian,
// disable testing on Alpine for the time being due to https://github.com/Vampire/setup-wsl/issues/50
//alpine,
alpine,
kali,
openSuseLeap15_2,
ubuntu2204,
Expand Down
95 changes: 70 additions & 25 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ jobs:
user-id: 'Debian'
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
- wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
Expand Down Expand Up @@ -824,6 +828,10 @@ jobs:
user-id: 'Debian'
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
- wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
Expand Down Expand Up @@ -920,6 +928,10 @@ jobs:
user-id: 'Debian'
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
- wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
Expand Down Expand Up @@ -1049,6 +1061,10 @@ jobs:
user-id: 'Debian'
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
- wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
Expand Down Expand Up @@ -1274,6 +1290,10 @@ jobs:
user-id: 'Debian'
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
- wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
- wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
Expand Down Expand Up @@ -1479,26 +1499,31 @@ jobs:
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
distribution2:
wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
distribution3:
wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
default-absent-tool: 'dos2unix'
distribution3:
distribution4:
wsl-id: 'openSUSE-Leap-15.2'
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
distribution4:
distribution5:
wsl-id: 'Ubuntu'
user-id: 'Ubuntu-20.04'
match-pattern: '*Ubuntu*20.04*'
default-absent-tool: 'dos2unix'
distribution5:
distribution6:
wsl-id: 'Ubuntu-18.04'
user-id: 'Ubuntu-18.04'
match-pattern: '*Ubuntu*18.04*'
default-absent-tool: 'dos2unix'
distribution6:
distribution7:
wsl-id: 'Ubuntu-16.04'
user-id: 'Ubuntu-16.04'
match-pattern: '*Ubuntu*16.04*'
Expand All @@ -1509,26 +1534,31 @@ jobs:
match-pattern: '*Debian*'
default-absent-tool: 'dos2unix'
distribution2:
wsl-id: 'Alpine'
user-id: 'Alpine'
match-pattern: '*Alpine*'
default-absent-tool: 'dos2unix'
distribution3:
wsl-id: 'kali-linux'
user-id: 'kali-linux'
match-pattern: '*Kali*'
default-absent-tool: 'dos2unix'
distribution3:
distribution4:
wsl-id: 'openSUSE-Leap-15.2'
user-id: 'openSUSE-Leap-15.2'
match-pattern: '*openSUSE*Leap*15.2*'
default-absent-tool: 'which'
distribution4:
distribution5:
wsl-id: 'Ubuntu'
user-id: 'Ubuntu-22.04'
match-pattern: '*Ubuntu*22.04*'
default-absent-tool: 'dos2unix'
distribution5:
distribution6:
wsl-id: 'Ubuntu-18.04'
user-id: 'Ubuntu-18.04'
match-pattern: '*Ubuntu*18.04*'
default-absent-tool: 'dos2unix'
distribution6:
distribution7:
wsl-id: 'Ubuntu-16.04'
user-id: 'Ubuntu-16.04'
match-pattern: '*Ubuntu*16.04*'
Expand Down Expand Up @@ -1579,6 +1609,12 @@ jobs:
distribution: '${{ matrix.distributions.distribution6.user-id }}'
set-as-default: 'false'
- id: 'step-7'
name: 'Execute action for ${{ matrix.distributions.distribution7.user-id }}'
uses: './'
with:
distribution: '${{ matrix.distributions.distribution7.user-id }}'
set-as-default: 'false'
- id: 'step-8'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution1.user-id }} should use the correct distribution'
shell: 'wsl-bash_Debian {0}'
run: |-
Expand All @@ -1587,59 +1623,68 @@ jobs:
if: |-
always()
&& (steps.step-1.outcome == 'success')
- id: 'step-8'
- id: 'step-9'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution'
shell: 'wsl-bash_kali-linux {0}'
shell: 'wsl-bash_Alpine {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution2.match-pattern }} ]]
if: |-
always()
&& (steps.step-2.outcome == 'success')
- id: 'step-9'
- id: 'step-10'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution'
shell: 'wsl-bash_openSUSE-Leap-15.2 {0}'
shell: 'wsl-bash_kali-linux {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution3.match-pattern }} ]]
if: |-
always()
&& (steps.step-3.outcome == 'success')
- id: 'step-10'
- id: 'step-11'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-22.04 {0}'
shell: 'wsl-bash_openSUSE-Leap-15.2 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution4.match-pattern }} ]]
if: |-
always()
&& (steps.step-4.outcome == 'success')
&& (matrix.distributions.distribution4.user-id != 'Ubuntu-20.04')
- id: 'step-11'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-20.04 {0}'
- id: 'step-12'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-22.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution4.match-pattern }} ]]
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]]
if: |-
always()
&& (steps.step-4.outcome == 'success')
&& (matrix.distributions.distribution4.user-id != 'Ubuntu-22.04')
- id: 'step-12'
&& (steps.step-5.outcome == 'success')
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04')
- id: 'step-13'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-18.04 {0}'
shell: 'wsl-bash_Ubuntu-20.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]]
if: |-
always()
&& (steps.step-5.outcome == 'success')
- id: 'step-13'
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04')
- id: 'step-14'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-16.04 {0}'
shell: 'wsl-bash_Ubuntu-18.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]]
if: |-
always()
&& (steps.step-6.outcome == 'success')
- id: 'step-15'
name: 'Test - wsl-bash_${{ matrix.distributions.distribution7.user-id }} should use the correct distribution'
shell: 'wsl-bash_Ubuntu-16.04 {0}'
run: |-
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution7.match-pattern }} ]]
if: |-
always()
&& (steps.step-7.outcome == 'success')
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ sealed class Distribution(
requestUrl = "https://store.rg-adguard.net/api/GetFiles",
data = "type=ProductId&url=$productId",
additionalHeaders = recordOf(
"Content-Type" to "application/x-www-form-urlencoded"
"Content-Type" to "application/x-www-form-urlencoded",
"User-Agent" to "Setup WSL GitHub Action"
)
).await()

Expand All @@ -73,7 +74,8 @@ sealed class Distribution(
requestUrl = "https://echo.free.beeceptor.com/api/GetFiles",
data = "type=ProductId&url=$productId",
additionalHeaders = recordOf(
"Content-Type" to "application/x-www-form-urlencoded"
"Content-Type" to "application/x-www-form-urlencoded",
"User-Agent" to "Setup WSL GitHub Action"
)
).await()
if (echoResponse.message.statusCode == 200) {
Expand Down

0 comments on commit e5717e2

Please sign in to comment.