Skip to content

Commit a2f462b

Browse files
committed
Add support for Ubuntu 24.04 (#57)
1 parent 9be6f77 commit a2f462b

File tree

6 files changed

+98
-23
lines changed

6 files changed

+98
-23
lines changed

.github/workflows/test.main.kts

+17-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ val openSuseLeap15_2 = mapOf(
7878
"default-absent-tool" to "which"
7979
)
8080

81+
val ubuntu2404 = mapOf(
82+
"wsl-id" to "Ubuntu-24.04",
83+
"user-id" to "Ubuntu-24.04",
84+
"match-pattern" to "*Ubuntu*24.04*",
85+
"default-absent-tool" to "dos2unix"
86+
)
87+
8188
val ubuntu2204 = mapOf(
8289
"wsl-id" to "Ubuntu",
8390
"user-id" to "Ubuntu-22.04",
@@ -111,6 +118,7 @@ val distributions = listOf(
111118
alpine,
112119
kali,
113120
openSuseLeap15_2,
121+
ubuntu2404,
114122
ubuntu2204,
115123
ubuntu2004,
116124
ubuntu1804,
@@ -554,7 +562,8 @@ workflowWithCopyright(
554562
)
555563
runAfterSuccess(
556564
name = "Test - /etc/wsl.conf should not exist",
557-
command = "[ ! -f /etc/wsl.conf ] || { cat /etc/wsl.conf; false; }"
565+
command = "[ ! -f /etc/wsl.conf ] || { cat /etc/wsl.conf; false; }",
566+
conditionTransformer = { executeActionStep.successNotOnUbuntu2404Condition }
558567
)
559568
runAfterSuccess(
560569
name = "Test - C: should be mounted at /mnt/c",
@@ -1057,6 +1066,13 @@ val Step.successOnAlpineCondition
10571066
&& (matrix.distribution.user-id == 'Alpine')
10581067
""".trimIndent()
10591068

1069+
val Step.successNotOnUbuntu2404Condition
1070+
get() = """
1071+
always()
1072+
&& (${outcome.eq(Success)})
1073+
&& (matrix.distribution.user-id != 'Ubuntu-24.04')
1074+
""".trimIndent()
1075+
10601076
fun Step.getSuccessNotOnDistributionCondition(i: Int, distribution: String) = """
10611077
always()
10621078
&& (${outcome.eq(Success)})

.github/workflows/test.yaml

+66-20
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ jobs:
348348
user-id: 'openSUSE-Leap-15.2'
349349
match-pattern: '*openSUSE*Leap*15.2*'
350350
default-absent-tool: 'which'
351+
- wsl-id: 'Ubuntu-24.04'
352+
user-id: 'Ubuntu-24.04'
353+
match-pattern: '*Ubuntu*24.04*'
354+
default-absent-tool: 'dos2unix'
351355
- wsl-id: 'Ubuntu'
352356
user-id: 'Ubuntu-22.04'
353357
match-pattern: '*Ubuntu*22.04*'
@@ -840,6 +844,10 @@ jobs:
840844
user-id: 'openSUSE-Leap-15.2'
841845
match-pattern: '*openSUSE*Leap*15.2*'
842846
default-absent-tool: 'which'
847+
- wsl-id: 'Ubuntu-24.04'
848+
user-id: 'Ubuntu-24.04'
849+
match-pattern: '*Ubuntu*24.04*'
850+
default-absent-tool: 'dos2unix'
843851
- wsl-id: 'Ubuntu'
844852
user-id: 'Ubuntu-22.04'
845853
match-pattern: '*Ubuntu*22.04*'
@@ -940,6 +948,10 @@ jobs:
940948
user-id: 'openSUSE-Leap-15.2'
941949
match-pattern: '*openSUSE*Leap*15.2*'
942950
default-absent-tool: 'which'
951+
- wsl-id: 'Ubuntu-24.04'
952+
user-id: 'Ubuntu-24.04'
953+
match-pattern: '*Ubuntu*24.04*'
954+
default-absent-tool: 'dos2unix'
943955
- wsl-id: 'Ubuntu'
944956
user-id: 'Ubuntu-22.04'
945957
match-pattern: '*Ubuntu*22.04*'
@@ -996,6 +1008,7 @@ jobs:
9961008
if: |-
9971009
always()
9981010
&& (steps.step-1.outcome == 'success')
1011+
&& (matrix.distribution.user-id != 'Ubuntu-24.04')
9991012
- id: 'step-5'
10001013
name: 'Test - C: should be mounted at /mnt/c'
10011014
shell: 'wsl-bash {0}'
@@ -1073,6 +1086,10 @@ jobs:
10731086
user-id: 'openSUSE-Leap-15.2'
10741087
match-pattern: '*openSUSE*Leap*15.2*'
10751088
default-absent-tool: 'which'
1089+
- wsl-id: 'Ubuntu-24.04'
1090+
user-id: 'Ubuntu-24.04'
1091+
match-pattern: '*Ubuntu*24.04*'
1092+
default-absent-tool: 'dos2unix'
10761093
- wsl-id: 'Ubuntu'
10771094
user-id: 'Ubuntu-22.04'
10781095
match-pattern: '*Ubuntu*22.04*'
@@ -1302,6 +1319,10 @@ jobs:
13021319
user-id: 'openSUSE-Leap-15.2'
13031320
match-pattern: '*openSUSE*Leap*15.2*'
13041321
default-absent-tool: 'which'
1322+
- wsl-id: 'Ubuntu-24.04'
1323+
user-id: 'Ubuntu-24.04'
1324+
match-pattern: '*Ubuntu*24.04*'
1325+
default-absent-tool: 'dos2unix'
13051326
- wsl-id: 'Ubuntu'
13061327
user-id: 'Ubuntu-22.04'
13071328
match-pattern: '*Ubuntu*22.04*'
@@ -1514,16 +1535,21 @@ jobs:
15141535
match-pattern: '*openSUSE*Leap*15.2*'
15151536
default-absent-tool: 'which'
15161537
distribution5:
1538+
wsl-id: 'Ubuntu-24.04'
1539+
user-id: 'Ubuntu-24.04'
1540+
match-pattern: '*Ubuntu*24.04*'
1541+
default-absent-tool: 'dos2unix'
1542+
distribution6:
15171543
wsl-id: 'Ubuntu'
15181544
user-id: 'Ubuntu-20.04'
15191545
match-pattern: '*Ubuntu*20.04*'
15201546
default-absent-tool: 'dos2unix'
1521-
distribution6:
1547+
distribution7:
15221548
wsl-id: 'Ubuntu-18.04'
15231549
user-id: 'Ubuntu-18.04'
15241550
match-pattern: '*Ubuntu*18.04*'
15251551
default-absent-tool: 'dos2unix'
1526-
distribution7:
1552+
distribution8:
15271553
wsl-id: 'Ubuntu-16.04'
15281554
user-id: 'Ubuntu-16.04'
15291555
match-pattern: '*Ubuntu*16.04*'
@@ -1549,16 +1575,21 @@ jobs:
15491575
match-pattern: '*openSUSE*Leap*15.2*'
15501576
default-absent-tool: 'which'
15511577
distribution5:
1578+
wsl-id: 'Ubuntu-24.04'
1579+
user-id: 'Ubuntu-24.04'
1580+
match-pattern: '*Ubuntu*24.04*'
1581+
default-absent-tool: 'dos2unix'
1582+
distribution6:
15521583
wsl-id: 'Ubuntu'
15531584
user-id: 'Ubuntu-22.04'
15541585
match-pattern: '*Ubuntu*22.04*'
15551586
default-absent-tool: 'dos2unix'
1556-
distribution6:
1587+
distribution7:
15571588
wsl-id: 'Ubuntu-18.04'
15581589
user-id: 'Ubuntu-18.04'
15591590
match-pattern: '*Ubuntu*18.04*'
15601591
default-absent-tool: 'dos2unix'
1561-
distribution7:
1592+
distribution8:
15621593
wsl-id: 'Ubuntu-16.04'
15631594
user-id: 'Ubuntu-16.04'
15641595
match-pattern: '*Ubuntu*16.04*'
@@ -1615,6 +1646,12 @@ jobs:
16151646
distribution: '${{ matrix.distributions.distribution7.user-id }}'
16161647
set-as-default: 'false'
16171648
- id: 'step-8'
1649+
name: 'Execute action for ${{ matrix.distributions.distribution8.user-id }}'
1650+
uses: './'
1651+
with:
1652+
distribution: '${{ matrix.distributions.distribution8.user-id }}'
1653+
set-as-default: 'false'
1654+
- id: 'step-9'
16181655
name: 'Test - wsl-bash_${{ matrix.distributions.distribution1.user-id }} should use the correct distribution'
16191656
shell: 'wsl-bash_Debian {0}'
16201657
run: |-
@@ -1623,7 +1660,7 @@ jobs:
16231660
if: |-
16241661
always()
16251662
&& (steps.step-1.outcome == 'success')
1626-
- id: 'step-9'
1663+
- id: 'step-10'
16271664
name: 'Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution'
16281665
shell: 'wsl-bash_Alpine {0}'
16291666
run: |-
@@ -1632,7 +1669,7 @@ jobs:
16321669
if: |-
16331670
always()
16341671
&& (steps.step-2.outcome == 'success')
1635-
- id: 'step-10'
1672+
- id: 'step-11'
16361673
name: 'Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution'
16371674
shell: 'wsl-bash_kali-linux {0}'
16381675
run: |-
@@ -1641,7 +1678,7 @@ jobs:
16411678
if: |-
16421679
always()
16431680
&& (steps.step-3.outcome == 'success')
1644-
- id: 'step-11'
1681+
- id: 'step-12'
16451682
name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution'
16461683
shell: 'wsl-bash_openSUSE-Leap-15.2 {0}'
16471684
run: |-
@@ -1650,41 +1687,50 @@ jobs:
16501687
if: |-
16511688
always()
16521689
&& (steps.step-4.outcome == 'success')
1653-
- id: 'step-12'
1690+
- id: 'step-13'
16541691
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
1655-
shell: 'wsl-bash_Ubuntu-22.04 {0}'
1692+
shell: 'wsl-bash_Ubuntu-24.04 {0}'
16561693
run: |-
16571694
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)
16581695
[[ "$(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 }} ]]
16591696
if: |-
16601697
always()
16611698
&& (steps.step-5.outcome == 'success')
1662-
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04')
1663-
- id: 'step-13'
1664-
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
1665-
shell: 'wsl-bash_Ubuntu-20.04 {0}'
1699+
- id: 'step-14'
1700+
name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution'
1701+
shell: 'wsl-bash_Ubuntu-22.04 {0}'
16661702
run: |-
16671703
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)
1668-
[[ "$(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 }} ]]
1704+
[[ "$(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 }} ]]
16691705
if: |-
16701706
always()
1671-
&& (steps.step-5.outcome == 'success')
1672-
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04')
1673-
- id: 'step-14'
1707+
&& (steps.step-6.outcome == 'success')
1708+
&& (matrix.distributions.distribution6.user-id != 'Ubuntu-20.04')
1709+
- id: 'step-15'
16741710
name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution'
1675-
shell: 'wsl-bash_Ubuntu-18.04 {0}'
1711+
shell: 'wsl-bash_Ubuntu-20.04 {0}'
16761712
run: |-
16771713
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)
16781714
[[ "$(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 }} ]]
16791715
if: |-
16801716
always()
16811717
&& (steps.step-6.outcome == 'success')
1682-
- id: 'step-15'
1718+
&& (matrix.distributions.distribution6.user-id != 'Ubuntu-22.04')
1719+
- id: 'step-16'
16831720
name: 'Test - wsl-bash_${{ matrix.distributions.distribution7.user-id }} should use the correct distribution'
1684-
shell: 'wsl-bash_Ubuntu-16.04 {0}'
1721+
shell: 'wsl-bash_Ubuntu-18.04 {0}'
16851722
run: |-
16861723
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)
16871724
[[ "$(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 }} ]]
16881725
if: |-
16891726
always()
16901727
&& (steps.step-7.outcome == 'success')
1728+
- id: 'step-17'
1729+
name: 'Test - wsl-bash_${{ matrix.distributions.distribution8.user-id }} should use the correct distribution'
1730+
shell: 'wsl-bash_Ubuntu-16.04 {0}'
1731+
run: |-
1732+
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)
1733+
[[ "$(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.distribution8.match-pattern }} ]]
1734+
if: |-
1735+
always()
1736+
&& (steps.step-8.outcome == 'success')

action-types.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ inputs:
2121
- Debian
2222
- kali-linux
2323
- openSUSE-Leap-15.2
24+
- Ubuntu-24.04
2425
- Ubuntu-22.04
2526
- Ubuntu-20.04
2627
- Ubuntu-18.04

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ inputs:
2727
'Ubuntu-22.04' and 'Ubuntu-20.04' can not be used together at the same time.
2828
They use the same WSL distribution ID, so the second that is used will not be installed
2929
as the first one will be found as already installed by WSL distribution ID.
30-
Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-22.04', 'Ubuntu-20.04', 'Ubuntu-18.04', 'Ubuntu-16.04'
30+
Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-24.04', 'Ubuntu-22.04', 'Ubuntu-20.04', 'Ubuntu-18.04', 'Ubuntu-16.04'
3131
required: false
3232
default: Debian
3333

readme/README_template.md

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ The values currently supported by this action are:
156156
* `Alpine`
157157
* `kali-linux`
158158
* `openSUSE-Leap-15.2`
159+
* `Ubuntu-24.04`
159160
* `Ubuntu-22.04`
160161
* `Ubuntu-20.04`
161162
* `Ubuntu-18.04`

src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt

+12-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ val distributions = listOf(
4040
Ubuntu1604,
4141
Ubuntu1804,
4242
Ubuntu2004,
43-
Ubuntu2204
43+
Ubuntu2204,
44+
Ubuntu2404
4445
).associateBy { it.userId }
4546

4647
sealed class Distribution(
@@ -246,6 +247,16 @@ abstract class AptGetBasedDistribution : Distribution {
246247
}
247248
}
248249

250+
object Ubuntu2404 : AptGetBasedDistribution(
251+
wslId = "Ubuntu-24.04",
252+
distributionName = "Ubuntu",
253+
version = SemVer("24.4.0", jso<SemVerRangeOptions>()),
254+
// work-around for missing shortlink on https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
255+
//downloadUrl = URL("https://aka.ms/wslubuntu2404"),
256+
productId = "9nz3klhxdjp5",
257+
installerFile = "ubuntu2404.exe"
258+
)
259+
249260
object Ubuntu2204 : AptGetBasedDistribution(
250261
wslId = "Ubuntu",
251262
userId = "Ubuntu-22.04",

0 commit comments

Comments
 (0)