Skip to content

Commit

Permalink
feat:fix: support for Ubuntu 24.04.1 (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa authored Oct 10, 2024
1 parent a4e4e6a commit 9ee8ef4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Set up your GitHub Actions workflow with a specific version of
[Minikube](https://github.com/kubernetes/minikube)
and [Kubernetes](https://github.com/kubernetes/kubernetes).

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

Expand Down
19 changes: 16 additions & 3 deletions src/__tests__/check-environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('check-environment module test suite', () => {
process.platform = 'win32';
// When - Then
expect(checkEnvironment).toThrow(
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
);
});
test('OS is Linux but not Ubuntu, should throw Error', () => {
Expand All @@ -24,7 +24,7 @@ describe('check-environment module test suite', () => {
fs.readFileSync.mockImplementation(() => 'SOME DIFFERENT OS');
// When - Then
expect(checkEnvironment).toThrow(
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
);
expect(fs.existsSync).toHaveBeenCalled();
expect(fs.readFileSync).toHaveBeenCalledTimes(0);
Expand All @@ -36,7 +36,7 @@ describe('check-environment module test suite', () => {
fs.readFileSync.mockImplementation(() => 'SOME DIFFERENT OS');
// When - Then
expect(checkEnvironment).toThrow(
'Unsupported OS, action only works in Ubuntu 18, 20, or 22'
'Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24'
);
expect(fs.existsSync).toHaveBeenCalled();
expect(fs.readFileSync).toHaveBeenCalled();
Expand Down Expand Up @@ -80,5 +80,18 @@ describe('check-environment module test suite', () => {
// When - Then
expect(checkEnvironment).not.toThrow();
});
test('OS is Linux and Ubuntu 24, should not throw Error', () => {
// Given
Object.defineProperty(process, 'platform', {value: 'linux'});
fs.existsSync.mockImplementation(() => true);
fs.readFileSync.mockImplementation(
() => `
NAME="Ubuntu"
VERSION="24.04.1 LTS (Noble Numbat)"
`
);
// When - Then
expect(checkEnvironment).not.toThrow();
});
});
});
6 changes: 3 additions & 3 deletions src/check-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const isUbuntu = version => () => {
osInfo.indexOf(`VERSION="${version}`) >= 0
);
};
['18', '20', '22'].some(v => isUbuntu(v)())
const isValidLinux = () => isLinux() && ['18', '20', '22'].some(v => isUbuntu(v)());
['18', '20', '22', '24'].some(v => isUbuntu(v)())
const isValidLinux = () => isLinux() && ['18', '20', '22', '24'].some(v => isUbuntu(v)());
const checkOperatingSystem = () => {
if (!isValidLinux()) {
throw Error('Unsupported OS, action only works in Ubuntu 18, 20, or 22');
throw Error('Unsupported OS, action only works in Ubuntu 18, 20, 22, or 24');
}
};

Expand Down

0 comments on commit 9ee8ef4

Please sign in to comment.