Skip to content

Commit

Permalink
Merge pull request #2 from mostafahussein/update-dependencies
Browse files Browse the repository at this point in the history
chore: bump @actions/core to prevent warning output.
  • Loading branch information
mostafahussein authored Apr 9, 2023
2 parents 3aed459 + eaabcff commit b19cf80
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
- name: Setup aws-iam-authenticator
uses: ./
with:
version: 'v0.5.9'
version: 'v0.6.2'

- name: Fetch aws-iam-authenticator latest version dynamically and validate the setup
run: python test/validate-aws-iam-authenticator.py latest

- name: Set specific aws-iam-authenticator version and validate the setup
run: python test/validate-aws-iam-authenticator.py 'v0.5.9'
run: python test/validate-aws-iam-authenticator.py 'v0.6.2'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### Sample workflow to install a specific version of aws-iam-authenticator binary on the runner.

Acceptable values are latest or any semantic version string like `0.5.9`. Use this action in workflow to define which version of aws-iam-authenticator will be used.
Acceptable values are latest or any semantic version string like `0.6.2`. Use this action in workflow to define which version of aws-iam-authenticator will be used.

```yaml
- uses: mostafahussein/setup-aws-iam-authenticator@v1
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.9.1",
"@actions/core": "^v1.10.0",
"@actions/exec": "^1.0.0",
"@actions/tool-cache": "^1.0.0"
},
Expand Down
40 changes: 20 additions & 20 deletions src/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ describe('Testing all functions in run file.', () => {
(arch) => {
jest.spyOn(os, 'type').mockReturnValue('Linux')
const iamAuthLinuxUrl = util.format(
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.9/aws-iam-authenticator_0.5.9_linux_%s',
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.6.2/aws-iam-authenticator_0.6.2_linux_%s',
arch
)

expect(getiamAuthDownloadURL('0.5.9', arch)).toBe(iamAuthLinuxUrl)
expect(getiamAuthDownloadURL('0.6.2', arch)).toBe(iamAuthLinuxUrl)
expect(os.type).toBeCalled()
}
)
Expand All @@ -59,11 +59,11 @@ describe('Testing all functions in run file.', () => {
(arch) => {
jest.spyOn(os, 'type').mockReturnValue('Darwin')
const iamAuthDarwinUrl = util.format(
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.9/aws-iam-authenticator_0.5.9_darwin_%s',
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.6.2/aws-iam-authenticator_0.6.2_darwin_%s',
arch
)

expect(getiamAuthDownloadURL('0.5.9', arch)).toBe(iamAuthDarwinUrl)
expect(getiamAuthDownloadURL('0.6.2', arch)).toBe(iamAuthDarwinUrl)
expect(os.type).toBeCalled()
}
)
Expand All @@ -74,10 +74,10 @@ describe('Testing all functions in run file.', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')

const iamAuthWindowsUrl = util.format(
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.5.9/aws-iam-authenticator_0.5.9_windows_%s.exe',
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.6.2/aws-iam-authenticator_0.6.2_windows_%s.exe',
arch
)
expect(getiamAuthDownloadURL('0.5.9', arch)).toBe(iamAuthWindowsUrl)
expect(getiamAuthDownloadURL('0.6.2', arch)).toBe(iamAuthWindowsUrl)
expect(os.type).toBeCalled()
}
)
Expand All @@ -86,30 +86,30 @@ describe('Testing all functions in run file.', () => {
jest
.spyOn(toolCache, 'downloadTool')
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('{"tag_name":"v0.5.9"}')
jest.spyOn(fs, 'readFileSync').mockReturnValue('{"tag_name":"v0.6.2"}')

expect(await run.getStableiamAuthVersion()).toBe('0.5.9')
expect(await run.getStableiamAuthVersion()).toBe('0.6.2')
expect(toolCache.downloadTool).toBeCalled()
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8')
})

test('getStableiamAuthVersion() - return default v0.5.9 if version read is empty', async () => {
test('getStableiamAuthVersion() - return default v0.6.2 if version read is empty', async () => {
jest
.spyOn(toolCache, 'downloadTool')
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('{}')

expect(await run.getStableiamAuthVersion()).toBe('0.5.9')
expect(await run.getStableiamAuthVersion()).toBe('0.6.2')
expect(toolCache.downloadTool).toBeCalled()
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8')
})

test('getStableiamAuthVersion() - return default v0.5.9 if unable to download file', async () => {
test('getStableiamAuthVersion() - return default v0.6.2 if unable to download file', async () => {
jest
.spyOn(toolCache, 'downloadTool')
.mockRejectedValue('Unable to download.')

expect(await run.getStableiamAuthVersion()).toBe('0.5.9')
expect(await run.getStableiamAuthVersion()).toBe('0.6.2')
expect(toolCache.downloadTool).toBeCalled()
})

Expand All @@ -124,10 +124,10 @@ describe('Testing all functions in run file.', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})

expect(await run.downloadiamAuth('0.5.9')).toBe(
expect(await run.downloadiamAuth('0.6.2')).toBe(
path.join('pathToCachedTool', 'aws-iam-authenticator.exe')
)
expect(toolCache.find).toBeCalledWith('aws-iam-authenticator', '0.5.9')
expect(toolCache.find).toBeCalledWith('aws-iam-authenticator', '0.6.2')
expect(toolCache.downloadTool).toBeCalled()
expect(toolCache.cacheFile).toBeCalled()
expect(os.type).toBeCalled()
Expand All @@ -143,10 +143,10 @@ describe('Testing all functions in run file.', () => {
.spyOn(toolCache, 'downloadTool')
.mockRejectedValue('Unable to download aws-iam-authenticator.')

await expect(run.downloadiamAuth('0.5.9')).rejects.toThrow(
await expect(run.downloadiamAuth('0.6.2')).rejects.toThrow(
'DownloadiamAuthFailed'
)
expect(toolCache.find).toBeCalledWith('aws-iam-authenticator', '0.5.9')
expect(toolCache.find).toBeCalledWith('aws-iam-authenticator', '0.6.2')
expect(toolCache.downloadTool).toBeCalled()
})

Expand Down Expand Up @@ -181,10 +181,10 @@ describe('Testing all functions in run file.', () => {
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {})
jest.spyOn(toolCache, 'downloadTool')

expect(await run.downloadiamAuth('0.5.9')).toBe(
expect(await run.downloadiamAuth('0.6.2')).toBe(
path.join('pathToCachedTool', 'aws-iam-authenticator.exe')
)
expect(toolCache.find).toBeCalledWith('aws-iam-authenticator', '0.5.9')
expect(toolCache.find).toBeCalledWith('aws-iam-authenticator', '0.6.2')
expect(os.type).toBeCalled()
expect(fs.chmodSync).toBeCalledWith(
path.join('pathToCachedTool', 'aws-iam-authenticator.exe'),
Expand All @@ -194,7 +194,7 @@ describe('Testing all functions in run file.', () => {
})

test('run() - download specified version and set output', async () => {
jest.spyOn(core, 'getInput').mockReturnValue('0.5.9')
jest.spyOn(core, 'getInput').mockReturnValue('0.6.2')
jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool')
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(fs, 'chmodSync').mockImplementation()
Expand All @@ -216,7 +216,7 @@ describe('Testing all functions in run file.', () => {
jest
.spyOn(toolCache, 'downloadTool')
.mockReturnValue(Promise.resolve('pathToTool'))
jest.spyOn(fs, 'readFileSync').mockReturnValue('{"tag_name":"v0.5.9"}')
jest.spyOn(fs, 'readFileSync').mockReturnValue('{"tag_name":"v0.6.2"}')
jest.spyOn(toolCache, 'find').mockReturnValue('pathToCachedTool')
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')
jest.spyOn(fs, 'chmodSync').mockImplementation()
Expand Down
2 changes: 1 addition & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from './helpers'

const iamAuthToolName = 'aws-iam-authenticator'
const stableiamAuthVersion = '0.5.9'
const stableiamAuthVersion = '0.6.2'
const stableVersionUrl =
'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/latest'

Expand Down

0 comments on commit b19cf80

Please sign in to comment.