-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
9,361 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const { exec } = require('child_process'); | ||
|
||
const version = process.argv[2]; | ||
|
||
exec('kustomize version --short', (error, stdout, stderr) => { | ||
let ver; | ||
ver = stdout.split(' ')[0]; | ||
ver = ver.replace(/^{/g, ''); | ||
ver = ver.replace(/^Version\//g, ''); | ||
ver = ver.replace(/^kustomize\//g, ''); | ||
ver = ver.replace(/^v/g, ''); | ||
|
||
if (ver !== version) { | ||
process.exit(1); | ||
} | ||
}); |
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,135 @@ | ||
name: Integration Test | ||
on: [push] | ||
jobs: | ||
test_jq: | ||
name: Run Test (jq) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
jq: '1.6' | ||
|
||
- name: Check Version | ||
run: | | ||
test "$(jq --version)" == "jq-1.6" | ||
test_yq: | ||
name: Run Test (yq) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
yq: '2.4.1' | ||
|
||
- name: Check Version | ||
run: | | ||
test "$(yq --version)" == "yq version 2.4.1" | ||
test_kubectl: | ||
name: Run Test (kubectl) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
kubectl: '1.17.0' | ||
|
||
- name: Check Version | ||
run: | | ||
test "$(kubectl version --client --short)" == "Client Version: v1.17.0" | ||
test_kustomize: | ||
name: Run Test (kustomize) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
kustomize: '3.5.4' | ||
|
||
- name: Check Version | ||
run: | | ||
node .github/workflows/check_version/kustomize.js 3.5.4 | ||
test_skaffold: | ||
name: Run Test (skaffold) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
skaffold: '1.2.0' | ||
|
||
- name: Check Version | ||
run: | | ||
test "$(skaffold version)" == "v1.2.0" | ||
test_helm: | ||
name: Run Test (helm) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
helm: '3.0.2' | ||
|
||
- name: Check Version | ||
run: | | ||
test "$(helm version --client --template '{{.Version}}')" == "v3.0.2" | ||
test_hub: | ||
name: Run Test (hub) | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Run Target Action | ||
uses: ./ | ||
with: | ||
hub: '2.14.0' | ||
|
||
- name: Check Version | ||
run: | | ||
test "$(hub version |grep hub)" == "hub version 2.14.0" |
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,26 @@ | ||
name: Test | ||
on: [push] | ||
jobs: | ||
run: | ||
name: Run Test | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: [ubuntu-latest, windows-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- name: Set Node.js 10.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
version: 10.x | ||
|
||
- name: Install | ||
run: yarn install | ||
|
||
- name: Lint | ||
run: yarn format-check | ||
|
||
- name: Test | ||
run: yarn test |
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,15 @@ | ||
/node_modules | ||
|
||
.npm | ||
|
||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
.env | ||
.envrc | ||
|
||
.cache |
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,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"semi": true | ||
} |
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,24 @@ | ||
MIT License | ||
----------- | ||
|
||
Copyright (c) 2020 Daichi Sakai | ||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
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,30 @@ | ||
A Github Action to set up a variety of tools for Continous Delivery. | ||
|
||
## Supported Tools | ||
|
||
- [jq](https://stedolan.github.io/jq/) | ||
- [yq](https://github.com/mikefarah/yq) | ||
- kubectl | ||
- [kustomize](https://github.com/kubernetes-sigs/kustomize) | ||
- [skaffold](https://github.com/GoogleContainerTools/skaffold) | ||
- [helm](https://github.com/helm/helm) | ||
- [hub](https://github.com/github/hub) | ||
|
||
## Usage | ||
|
||
``` | ||
name: Deployment | ||
on: [push] | ||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
... | ||
- name: Set up tools | ||
uses: daisaru11/setup-cd-tools@master | ||
with: | ||
kubectl: '1.6.0' | ||
kustomize: '3.5.4' | ||
... | ||
``` |
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,27 @@ | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { HelmInstaller } from '../../src/installers/helm'; | ||
|
||
const toolDir = process.env['RUNNER_TOOL_CACHE'] as string; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
|
||
describe('helm installer tests', () => { | ||
const installer = new HelmInstaller(); | ||
|
||
const versions = ['3.0.2', '2.16.1']; | ||
|
||
for (const version of versions) { | ||
it('Acquires the specified version of helm', async () => { | ||
await installer.install(version); | ||
|
||
const dir = path.join(toolDir, 'helm', version, os.arch()); | ||
|
||
if (IS_WINDOWS) { | ||
expect(fs.existsSync(path.join(dir, 'helm.exe'))).toBe(true); | ||
} else { | ||
expect(fs.existsSync(path.join(dir, 'helm'))).toBe(true); | ||
} | ||
}, 100000); | ||
} | ||
}); |
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,27 @@ | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { HubInstaller } from '../../src/installers/hub'; | ||
|
||
const toolDir = process.env['RUNNER_TOOL_CACHE'] as string; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
|
||
describe('hub installer tests', () => { | ||
const installer = new HubInstaller(); | ||
|
||
const versions = ['2.14.0']; | ||
|
||
for (const version of versions) { | ||
it('Acquires the specified version of hub', async () => { | ||
await installer.install(version); | ||
|
||
const dir = path.join(toolDir, 'hub', version, os.arch()); | ||
|
||
if (IS_WINDOWS) { | ||
expect(fs.existsSync(path.join(dir, 'hub.exe'))).toBe(true); | ||
} else { | ||
expect(fs.existsSync(path.join(dir, 'hub'))).toBe(true); | ||
} | ||
}, 100000); | ||
} | ||
}); |
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,27 @@ | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { JqInstaller } from '../../src/installers/jq'; | ||
|
||
const toolDir = process.env['RUNNER_TOOL_CACHE'] as string; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
|
||
describe('jq installer tests', () => { | ||
const installer = new JqInstaller(); | ||
|
||
const versions = ['1.6']; | ||
|
||
for (const version of versions) { | ||
it('Acquires the specified version of jq', async () => { | ||
await installer.install(version); | ||
|
||
const dir = path.join(toolDir, 'jq', version, os.arch()); | ||
|
||
if (IS_WINDOWS) { | ||
expect(fs.existsSync(path.join(dir, 'jq.exe'))).toBe(true); | ||
} else { | ||
expect(fs.existsSync(path.join(dir, 'jq'))).toBe(true); | ||
} | ||
}, 100000); | ||
} | ||
}); |
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,27 @@ | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { KubectlInstaller } from '../../src/installers/kubectl'; | ||
|
||
const toolDir = process.env['RUNNER_TOOL_CACHE'] as string; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
|
||
describe('kubectl installer tests', () => { | ||
const installer = new KubectlInstaller(); | ||
|
||
const versions = ['1.17.2', '1.16.6']; | ||
|
||
for (const version of versions) { | ||
it('Acquires the specified version of kubectl', async () => { | ||
await installer.install(version); | ||
|
||
const dir = path.join(toolDir, 'kubectl', version, os.arch()); | ||
|
||
if (IS_WINDOWS) { | ||
expect(fs.existsSync(path.join(dir, 'kubectl.exe'))).toBe(true); | ||
} else { | ||
expect(fs.existsSync(path.join(dir, 'kubectl'))).toBe(true); | ||
} | ||
}, 100000); | ||
} | ||
}); |
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,27 @@ | ||
import * as fs from 'fs'; | ||
import * as os from 'os'; | ||
import * as path from 'path'; | ||
import { KustomizeInstaller } from '../../src/installers/kustomize'; | ||
|
||
const toolDir = process.env['RUNNER_TOOL_CACHE'] as string; | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
|
||
describe('kustomize installer tests', () => { | ||
const installer = new KustomizeInstaller(); | ||
|
||
const versions = ['3.5.4']; | ||
|
||
for (const version of versions) { | ||
it('Acquires the specified version of kustomize', async () => { | ||
await installer.install(version); | ||
|
||
const dir = path.join(toolDir, 'kustomize', version, os.arch()); | ||
|
||
if (IS_WINDOWS) { | ||
expect(fs.existsSync(path.join(dir, 'kustomize.exe'))).toBe(true); | ||
} else { | ||
expect(fs.existsSync(path.join(dir, 'kustomize'))).toBe(true); | ||
} | ||
}, 100000); | ||
} | ||
}); |
Oops, something went wrong.