Skip to content

Commit 9ee8ef4

Browse files
authored
feat:fix: support for Ubuntu 24.04.1 (#126)
1 parent a4e4e6a commit 9ee8ef4

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Set up your GitHub Actions workflow with a specific version of
88
[Minikube](https://github.com/kubernetes/minikube)
99
and [Kubernetes](https://github.com/kubernetes/kubernetes).
1010

11-
_Currently only Linux Ubuntu 18.04, 20.04, or 22.04
11+
_Currently only Linux Ubuntu 18.04, 20.04, 22.04, or 24.04
1212
[CI environment](https://help.github.com/en/github/automating-your-workflow-with-github-actions/virtual-environments-for-github-actions)
1313
is supported._
1414

src/__tests__/check-environment.test.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('check-environment module test suite', () => {
1414
process.platform = 'win32';
1515
// When - Then
1616
expect(checkEnvironment).toThrow(
17-
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
17+
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
1818
);
1919
});
2020
test('OS is Linux but not Ubuntu, should throw Error', () => {
@@ -24,7 +24,7 @@ describe('check-environment module test suite', () => {
2424
fs.readFileSync.mockImplementation(() => 'SOME DIFFERENT OS');
2525
// When - Then
2626
expect(checkEnvironment).toThrow(
27-
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
27+
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
2828
);
2929
expect(fs.existsSync).toHaveBeenCalled();
3030
expect(fs.readFileSync).toHaveBeenCalledTimes(0);
@@ -36,7 +36,7 @@ describe('check-environment module test suite', () => {
3636
fs.readFileSync.mockImplementation(() => 'SOME DIFFERENT OS');
3737
// When - Then
3838
expect(checkEnvironment).toThrow(
39-
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
39+
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
4040
);
4141
expect(fs.existsSync).toHaveBeenCalled();
4242
expect(fs.readFileSync).toHaveBeenCalled();
@@ -80,5 +80,18 @@ describe('check-environment module test suite', () => {
8080
// When - Then
8181
expect(checkEnvironment).not.toThrow();
8282
});
83+
test('OS is Linux and Ubuntu 24, should not throw Error', () => {
84+
// Given
85+
Object.defineProperty(process, 'platform', {value: 'linux'});
86+
fs.existsSync.mockImplementation(() => true);
87+
fs.readFileSync.mockImplementation(
88+
() => `
89+
NAME="Ubuntu"
90+
VERSION="24.04.1 LTS (Noble Numbat)"
91+
`
92+
);
93+
// When - Then
94+
expect(checkEnvironment).not.toThrow();
95+
});
8396
});
8497
});

src/check-environment.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ const isUbuntu = version => () => {
1212
osInfo.indexOf(`VERSION="${version}`) >= 0
1313
);
1414
};
15-
['18', '20', '22'].some(v => isUbuntu(v)())
16-
const isValidLinux = () => isLinux() && ['18', '20', '22'].some(v => isUbuntu(v)());
15+
['18', '20', '22', '24'].some(v => isUbuntu(v)())
16+
const isValidLinux = () => isLinux() && ['18', '20', '22', '24'].some(v => isUbuntu(v)());
1717
const checkOperatingSystem = () => {
1818
if (!isValidLinux()) {
19-
throw Error('Unsupported OS, action only works in Ubuntu 18, 20, or 22');
19+
throw Error('Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24');
2020
}
2121
};
2222

0 commit comments

Comments
 (0)