Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor nit and GH action version updates #102

Merged
merged 1 commit into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/defaultLabels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/stale@v3
- uses: actions/stale@v6
name: Setting issue as idle
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -24,7 +24,7 @@ jobs:
operations-per-run: 100
exempt-issue-labels: 'backlog'

- uses: actions/stale@v3
- uses: actions/stale@v6
name: Setting PR as idle
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: npm install and build
id: action-npm-build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prettify-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Enforce Prettier
uses: actionsx/prettier@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build: # make sure build/ci works properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Run L0 tests.
run: |
Expand Down
24 changes: 11 additions & 13 deletions src/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,39 @@ describe('run.ts', () => {
test('getHelmDownloadURL() - return the URL to download helm for Linux', () => {
jest.spyOn(os, 'type').mockReturnValue('Linux')
jest.spyOn(os, 'arch').mockReturnValueOnce('unknown')
const kubectlLinuxUrl = 'https://get.helm.sh/helm-v3.8.0-linux-amd64.zip'
const helmLinuxUrl = 'https://get.helm.sh/helm-v3.8.0-linux-amd64.zip'

expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlLinuxUrl)
expect(run.getHelmDownloadURL('v3.8.0')).toBe(helmLinuxUrl)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()

// arm64
jest.spyOn(os, 'type').mockReturnValue('Linux')
jest.spyOn(os, 'arch').mockReturnValueOnce('arm64')
const kubectlLinuxArm64Url =
const helmLinuxArm64Url =
'https://get.helm.sh/helm-v3.8.0-linux-arm64.zip'

expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlLinuxArm64Url)
expect(run.getHelmDownloadURL('v3.8.0')).toBe(helmLinuxArm64Url)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()
})

test('getHelmDownloadURL() - return the URL to download helm for Darwin', () => {
jest.spyOn(os, 'type').mockReturnValue('Darwin')
jest.spyOn(os, 'arch').mockReturnValueOnce('unknown')
const kubectlDarwinUrl =
'https://get.helm.sh/helm-v3.8.0-darwin-amd64.zip'
const helmDarwinUrl = 'https://get.helm.sh/helm-v3.8.0-darwin-amd64.zip'

expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlDarwinUrl)
expect(run.getHelmDownloadURL('v3.8.0')).toBe(helmDarwinUrl)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()

// arm64
jest.spyOn(os, 'type').mockReturnValue('Darwin')
jest.spyOn(os, 'arch').mockReturnValueOnce('arm64')
const kubectlDarwinArm64Url =
const helmDarwinArm64Url =
'https://get.helm.sh/helm-v3.8.0-darwin-arm64.zip'

expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlDarwinArm64Url)
expect(run.getHelmDownloadURL('v3.8.0')).toBe(helmDarwinArm64Url)
expect(os.type).toBeCalled()
expect(os.arch).toBeCalled()
})
Expand All @@ -68,14 +67,13 @@ describe('run.ts', () => {
test('getHelmDownloadURL() - return the URL to download helm for Windows', () => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT')

const kubectlWindowsUrl =
'https://get.helm.sh/helm-v3.8.0-windows-amd64.zip'
expect(run.getHelmDownloadURL('v3.8.0')).toBe(kubectlWindowsUrl)
const helmWindowsUrl = 'https://get.helm.sh/helm-v3.8.0-windows-amd64.zip'
expect(run.getHelmDownloadURL('v3.8.0')).toBe(helmWindowsUrl)
expect(os.type).toBeCalled()
})

test('getLatestHelmVersion() - return the stable version of HELM since its not authenticated', async () => {
expect(await run.getLatestHelmVersion()).toBe('v3.9.0')
expect(await run.getLatestHelmVersion()).toBe('v3.10.2')
})

test('walkSync() - return path to the all files matching fileToFind in dir', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import * as toolCache from '@actions/tool-cache'
import * as core from '@actions/core'
import {graphql} from '@octokit/graphql'
import {createActionAuth} from '@octokit/auth-action'
import {create} from 'domain'

const helmToolName = 'helm'
const stableHelmVersion = 'v3.9.0'
const stableHelmVersion = 'v3.10.2'

export async function run() {
let version = core.getInput('version', {required: true})
Expand Down