From 70ab029d6b98605cbf930d2f8b403a6e9b78e00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Mon, 30 Dec 2024 19:17:57 +0100 Subject: [PATCH] Add support for windows-2025 runner images (#65) --- .github/workflows/test.main.kts | 1 + .github/workflows/test.yaml | 35 +++++++++++++++++++ .../github/action/setup_wsl/SetupWsl.kt | 16 +++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.main.kts b/.github/workflows/test.main.kts index 7ad32ef8..09ccae62 100755 --- a/.github/workflows/test.main.kts +++ b/.github/workflows/test.main.kts @@ -56,6 +56,7 @@ import kotlin.math.min val environments = listOf( "windows-2019", "windows-2022", + "windows-2025", "windows-latest" ) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7742c65a..d7e22c14 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -86,6 +86,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - user-id: 'invalid' @@ -127,6 +128,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' wsl-version: - '-1' @@ -167,6 +169,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -372,6 +375,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -936,6 +940,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -1045,6 +1050,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -1190,6 +1196,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -1326,6 +1333,7 @@ jobs: matrix: environment: - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -1407,6 +1415,7 @@ jobs: matrix: environment: - 'windows-2022' + - 'windows-2025' - 'windows-latest' steps: - id: 'step-0' @@ -1457,6 +1466,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -1538,6 +1548,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distributions: - distribution1: @@ -1694,6 +1705,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distribution: - wsl-id: 'Debian' @@ -1760,6 +1772,17 @@ jobs: user-id: 'Debian' match-pattern: '*Debian*' default-absent-tool: 'dos2unix' + - environment: 'windows-2025' + distribution: + wsl-id: 'Debian' + user-id: 'Debian' + match-pattern: '*Debian*' + default-absent-tool: 'dos2unix' + distribution2: + wsl-id: 'Debian' + user-id: 'Debian' + match-pattern: '*Debian*' + default-absent-tool: 'dos2unix' - environment: 'windows-latest' distribution: wsl-id: 'Debian' @@ -1794,6 +1817,17 @@ jobs: user-id: 'Ubuntu-20.04' match-pattern: '*Ubuntu*20.04*' default-absent-tool: 'dos2unix' + - environment: 'windows-2025' + distribution: + wsl-id: 'Debian' + user-id: 'Debian' + match-pattern: '*Debian*' + default-absent-tool: 'dos2unix' + distribution2: + wsl-id: 'Ubuntu' + user-id: 'Ubuntu-20.04' + match-pattern: '*Ubuntu*20.04*' + default-absent-tool: 'dos2unix' - environment: 'windows-latest' distribution: wsl-id: 'Debian' @@ -1981,6 +2015,7 @@ jobs: environment: - 'windows-2019' - 'windows-2022' + - 'windows-2025' - 'windows-latest' distributions: - incompatibleUbuntu: 'Ubuntu-22.04' diff --git a/src/jsMain/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt b/src/jsMain/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt index b89a785d..98aa1d0f 100644 --- a/src/jsMain/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt +++ b/src/jsMain/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt @@ -102,7 +102,8 @@ val wslHelp = GlobalScope.async(start = LAZY) { } val wslStatus = GlobalScope.async(start = LAZY) { - wslOutput("--status") + warning("Querying WSL Status") + wslOutput("--status").also { warning(it) } } val distribution by lazy { @@ -371,11 +372,22 @@ suspend fun verifyWindowsEnvironment() { } suspend fun installDistribution() { + // on windows-2025 WSL is not installed at all currently, + // so install it without distribution if `--install` is available + // work-around for https://github.com/actions/runner-images/issues/11265 + if (wslStatus().contains("is not installed")) { + retry(5) { + executeWslCommand( + wslArguments = arrayOf("--install", "--no-distribution") + ) + } + } + executeWslCommand( wslArguments = arrayOf("--set-default-version", "${wslVersion()}") ) if (wslVersion() != 1u) { - retry(5) { + retry(10) { executeWslCommand( wslArguments = arrayOf("--update") )