diff --git a/README.md b/README.md index 895dcc32..c2a081a6 100644 --- a/README.md +++ b/README.md @@ -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._ diff --git a/src/__tests__/check-environment.test.js b/src/__tests__/check-environment.test.js index 3103d020..a7939842 100644 --- a/src/__tests__/check-environment.test.js +++ b/src/__tests__/check-environment.test.js @@ -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', () => { @@ -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); @@ -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(); @@ -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(); + }); }); }); diff --git a/src/check-environment.js b/src/check-environment.js index e67a1e99..399a888f 100644 --- a/src/check-environment.js +++ b/src/check-environment.js @@ -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'); } };