From 7b8ba9b53ba1c36b9f561c7ce39e9b667e0f0b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Wed, 7 Feb 2024 17:03:57 +0100 Subject: [PATCH 1/3] Disable testing on Alpine for the time being --- .github/workflows/test.main.kts | 40 +++++++------- .github/workflows/test.yaml | 95 +++++++++------------------------ 2 files changed, 45 insertions(+), 90 deletions(-) diff --git a/.github/workflows/test.main.kts b/.github/workflows/test.main.kts index 7d6933d0..a2760974 100755 --- a/.github/workflows/test.main.kts +++ b/.github/workflows/test.main.kts @@ -41,6 +41,7 @@ import it.krzeminski.githubactions.domain.triggers.Schedule import it.krzeminski.githubactions.dsl.JobBuilder import it.krzeminski.githubactions.dsl.WorkflowBuilder import it.krzeminski.githubactions.dsl.expressions.expr +import kotlin.math.min val environments = listOf( "windows-2019", @@ -106,7 +107,8 @@ val ubuntu1604 = mapOf( val distributions = listOf( debian, - alpine, + // disable testing on Alpine for the time being due to https://github.com/Vampire/setup-wsl/issues/50 + //alpine, kali, openSuseLeap15_2, ubuntu2204, @@ -834,20 +836,20 @@ workflowWithCopyright( executeActionStep = localExecuteActionStep verifyInstalledDistribution( name = "Test - wsl-bash_${expr("matrix.distributions.distribution$i.user-id")} should use the correct distribution", - conditionTransformer = if (i == 5) { - { executeActionStep.successNotOnUbuntu2004Condition } + conditionTransformer = if (distributions[i] == ubuntu2004) { + { executeActionStep.getSuccessNotOnUbuntu2004Condition(i) } } else { { it } }, - // the formula adds 1 to the indices after 5 - // to mitigate the double entry for index 5 - shell = Shell.Custom("wsl-bash_${distributions[(i / 6) + i - 1]["user-id"]} {0}"), + // the formula adds 1 to the indices from ubuntu2004 on + // to mitigate the double entry for the previous index + shell = Shell.Custom("wsl-bash_${distributions[min(1, i / (distributions.indexOf(ubuntu2004) + 1)) + i - 1]["user-id"]} {0}"), expectedPatternExpression = "matrix.distributions.distribution$i.match-pattern" ) - if (i == 5) { + if (distributions[i] == ubuntu2004) { verifyInstalledDistribution( name = "Test - wsl-bash_${expr("matrix.distributions.distribution$i.user-id")} should use the correct distribution", - conditionTransformer = { executeActionStep.successNotOnUbuntu2204Condition }, + conditionTransformer = { executeActionStep.getSuccessNotOnUbuntu2204Condition(i) }, shell = Shell.Custom("wsl-bash_${distributions[i]["user-id"]} {0}"), expectedPatternExpression = "matrix.distributions.distribution$i.match-pattern" ) @@ -1055,18 +1057,16 @@ val Step.successOnAlpineCondition && (matrix.distribution.user-id == 'Alpine') """.trimIndent() -val Step.successNotOnUbuntu2004Condition - get() = """ - always() - && ($outcome == 'success') - && (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04') - """.trimIndent() +fun Step.getSuccessNotOnUbuntu2004Condition(i: Int) = """ + always() + && ($outcome == 'success') + && (matrix.distributions.distribution$i.user-id != 'Ubuntu-20.04') +""".trimIndent() -val Step.successNotOnUbuntu2204Condition - get() = """ - always() - && ($outcome == 'success') - && (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04') - """.trimIndent() +fun Step.getSuccessNotOnUbuntu2204Condition(i: Int) = """ + always() + && ($outcome == 'success') + && (matrix.distributions.distribution$i.user-id != 'Ubuntu-22.04') +""".trimIndent() val Step.outcome get() = "steps.$id.outcome" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3a1f3be2..61e63ac6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -336,10 +336,6 @@ 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*' @@ -828,10 +824,6 @@ 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*' @@ -928,10 +920,6 @@ 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*' @@ -1061,10 +1049,6 @@ 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*' @@ -1290,10 +1274,6 @@ 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*' @@ -1499,31 +1479,26 @@ 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 - distribution4: + distribution3: wsl-id: openSUSE-Leap-15.2 user-id: openSUSE-Leap-15.2 match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: which - distribution5: + distribution4: wsl-id: Ubuntu user-id: Ubuntu-20.04 match-pattern: '*Ubuntu*20.04*' default-absent-tool: dos2unix - distribution6: + distribution5: wsl-id: Ubuntu-18.04 user-id: Ubuntu-18.04 match-pattern: '*Ubuntu*18.04*' default-absent-tool: dos2unix - distribution7: + distribution6: wsl-id: Ubuntu-16.04 user-id: Ubuntu-16.04 match-pattern: '*Ubuntu*16.04*' @@ -1534,31 +1509,26 @@ 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 - distribution4: + distribution3: wsl-id: openSUSE-Leap-15.2 user-id: openSUSE-Leap-15.2 match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: which - distribution5: + distribution4: wsl-id: Ubuntu user-id: Ubuntu-22.04 match-pattern: '*Ubuntu*22.04*' default-absent-tool: dos2unix - distribution6: + distribution5: wsl-id: Ubuntu-18.04 user-id: Ubuntu-18.04 match-pattern: '*Ubuntu*18.04*' default-absent-tool: dos2unix - distribution7: + distribution6: wsl-id: Ubuntu-16.04 user-id: Ubuntu-16.04 match-pattern: '*Ubuntu*16.04*' @@ -1609,12 +1579,6 @@ 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: |- @@ -1623,68 +1587,59 @@ jobs: if: |- always() && (steps.step-1.outcome == 'success') - - id: step-9 + - id: step-8 name: Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution - shell: wsl-bash_Alpine {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.distribution2.match-pattern }} ]] if: |- always() && (steps.step-2.outcome == 'success') - - id: step-10 + - id: step-9 name: Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution - shell: wsl-bash_kali-linux {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.distribution3.match-pattern }} ]] if: |- always() && (steps.step-3.outcome == 'success') - - id: step-11 + - id: step-10 name: Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution - shell: wsl-bash_openSUSE-Leap-15.2 {0} + 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 }} ]] if: |- always() && (steps.step-4.outcome == 'success') - - id: step-12 - name: Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution - shell: wsl-bash_Ubuntu-22.04 {0} + && (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} 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 }} ]] + [[ "$(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-5.outcome == 'success') - && (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04') - - id: step-13 + && (steps.step-4.outcome == 'success') + && (matrix.distributions.distribution4.user-id != 'Ubuntu-22.04') + - id: step-12 name: Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution - shell: wsl-bash_Ubuntu-20.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.distribution5.match-pattern }} ]] if: |- always() && (steps.step-5.outcome == 'success') - && (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04') - - id: step-14 + - id: step-13 name: Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution - shell: wsl-bash_Ubuntu-18.04 {0} + 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.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') From 1cedd12ca9c9d4140e00d9f261b2b2cb860630cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Wed, 7 Feb 2024 17:05:36 +0100 Subject: [PATCH 2/3] Increase version to 3.0.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ca3ca00e..87aa0338 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ # limitations under the License. group = net.kautler -version = 2.0.3-SNAPSHOT +version = 3.0.0-SNAPSHOT description = A GitHub action to install and setup a Linux distribution for the Windows Subsystem for Linux (WSL) org.gradle.caching = true From f482facecf4dcdfcc381606ee3a9b737b5cd709a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Wed, 7 Feb 2024 17:26:58 +0100 Subject: [PATCH 3/3] Update Node.js to 20 (#52) --- action.yml | 2 +- gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index ca6c59ec..ea82c69d 100644 --- a/action.yml +++ b/action.yml @@ -108,5 +108,5 @@ outputs: wsl-shell-command is not set explicitly and the script already exists, this output will be set. runs: - using: node16 + using: node20 main: build/distributions/index.js diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ebef93a1..87202ab9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,7 +22,7 @@ build-gradle-plugin-release = "3.0.2" build-gradle-plugin-versions = "0.46.0" build-inject = "1" build-kotlinx-serialization = "1.5.0" -build-node = "16.18.1" +build-node = "20.11.0" build-snakeyaml = "2.0" build-vercel-ncc = "0.36.1" kotlin = "1.8.20"