Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
support standalone mode and display version
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
CrazyMax
committed
Apr 17, 2022
1 parent
2a6fbda
commit 3472856
Showing
9 changed files
with
223 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {describe, expect, it, jest} from '@jest/globals'; | ||
import * as docker from '../src/docker'; | ||
import * as exec from '@actions/exec'; | ||
|
||
describe('isAvailable', () => { | ||
it('cli', () => { | ||
const execSpy = jest.spyOn(exec, 'getExecOutput'); | ||
docker.isAvailable(); | ||
|
||
// eslint-disable-next-line jest/no-standalone-expect | ||
expect(execSpy).toHaveBeenCalledWith(`docker`, undefined, { | ||
silent: true, | ||
ignoreReturnCode: true | ||
}); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as exec from '@actions/exec'; | ||
|
||
export async function isAvailable(): Promise<boolean> { | ||
return await exec | ||
.getExecOutput('docker', undefined, { | ||
ignoreReturnCode: true, | ||
silent: true | ||
}) | ||
.then(res => { | ||
if (res.stderr.length > 0 && res.exitCode != 0) { | ||
return false; | ||
} | ||
return res.exitCode == 0; | ||
}) | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
.catch(error => { | ||
return false; | ||
}); | ||
} |
Oops, something went wrong.