Skip to content

Commit 7fea4fc

Browse files
authored
Merge pull request #1 from byu-oit/ci
added more ci tests
2 parents 1898def + c2f8e8c commit 7fea4fc

File tree

17 files changed

+26062
-188
lines changed

17 files changed

+26062
-188
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.eslintrc.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"plugins": ["jest", "@typescript-eslint"],
3+
"extends": ["plugin:github/es6"],
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"ecmaVersion": 9,
7+
"sourceType": "module",
8+
"project": "./tsconfig.json"
9+
},
10+
"rules": {
11+
"eslint-comments/no-use": "off",
12+
"import/no-namespace": "off",
13+
"no-unused-vars": "off",
14+
"@typescript-eslint/no-unused-vars": "error",
15+
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
16+
"@typescript-eslint/no-require-imports": "error",
17+
"@typescript-eslint/array-type": "error",
18+
"@typescript-eslint/await-thenable": "error",
19+
"@typescript-eslint/ban-ts-ignore": "error",
20+
"camelcase": "off",
21+
"@typescript-eslint/camelcase": "warn",
22+
"@typescript-eslint/class-name-casing": "error",
23+
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
24+
"@typescript-eslint/func-call-spacing": ["error", "never"],
25+
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
26+
"@typescript-eslint/no-array-constructor": "error",
27+
"@typescript-eslint/no-empty-interface": "error",
28+
"@typescript-eslint/no-explicit-any": "error",
29+
"@typescript-eslint/no-extraneous-class": "error",
30+
"@typescript-eslint/no-for-in-array": "error",
31+
"@typescript-eslint/no-inferrable-types": "error",
32+
"@typescript-eslint/no-misused-new": "error",
33+
"@typescript-eslint/no-namespace": "error",
34+
"@typescript-eslint/no-non-null-assertion": "warn",
35+
"@typescript-eslint/no-object-literal-type-assertion": "error",
36+
"@typescript-eslint/no-unnecessary-qualifier": "error",
37+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
38+
"@typescript-eslint/no-useless-constructor": "error",
39+
"@typescript-eslint/no-var-requires": "error",
40+
"@typescript-eslint/prefer-for-of": "warn",
41+
"@typescript-eslint/prefer-function-type": "warn",
42+
"@typescript-eslint/prefer-includes": "error",
43+
"@typescript-eslint/prefer-interface": "error",
44+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
45+
"@typescript-eslint/promise-function-async": "error",
46+
"@typescript-eslint/require-array-sort-compare": "error",
47+
"@typescript-eslint/restrict-plus-operands": "error",
48+
"semi": "off",
49+
"@typescript-eslint/semi": ["error", "never"],
50+
"@typescript-eslint/type-annotation-spacing": "error",
51+
"@typescript-eslint/unbound-method": "error"
52+
},
53+
"env": {
54+
"node": true,
55+
"es6": true,
56+
"jest/globals": true
57+
}
58+
}

.github/workflows/ci.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- 'v*'
8+
env:
9+
node_version: "12.x"
10+
11+
jobs:
12+
build: # make sure build/ci work properly
13+
name: Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ env.node_version }}
21+
22+
- name: yarn install
23+
run: yarn install
24+
25+
- name: yarn build
26+
run: yarn build
27+
28+
- name: yarn run pack
29+
run: yarn run pack
30+
31+
audit:
32+
name: Audit
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v1
39+
with:
40+
node-version: ${{ env.node_version }}
41+
42+
- name: yarn audit
43+
run: yarn audit --level critical [[ $? -ge 16 ]] && exit 1 || exit 0 # this last part is needed because yarn audit returns a non-0 code if any vulnerabilities are found
44+
45+
lint:
46+
name: Lint
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
51+
- name: Set up Node.js
52+
uses: actions/setup-node@v1
53+
with:
54+
node-version: ${{ env.node_version }}
55+
56+
- name: yarn install
57+
run: yarn install
58+
59+
- name: yarn lint
60+
run: yarn run lint
61+
62+
test:
63+
name: Test
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v2
67+
68+
- name: Set up Node.js
69+
uses: actions/setup-node@v1
70+
with:
71+
node-version: ${{ env.node_version }}
72+
73+
- name: yarn install
74+
run: yarn install
75+
76+
- name: yarn test
77+
run: yarn test

.github/workflows/test.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
name: "Test"
2-
on:
3-
push:
4-
branches:
5-
- master
1+
name: Test
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- 'v*'
67

7-
jobs:
8-
test:
9-
name: Test
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v1
8+
#jobs:
9+
# test:
10+
# name: Test
11+
# runs-on: ubuntu-latest
12+
# steps:
13+
# - uses: actions/checkout@v1
1314
# - name: CodeDeploy
1415
# uses: ./
1516
# with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ typings/
6464

6565
# next.js build output
6666
.next
67+
68+
lib/

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![Test](https://github.com/byu-oit/github-action-codedeploy/workflows/Test/badge.svg)
2+
13
# ![BYU logo](https://www.hscripts.com/freeimages/logos/university-logos/byu/byu-logo-clipart-128.gif) github-action-codedeploy
24
A GitHub Action for deploying an application with AWS CodeDeploy
35

__tests__/main.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// TODO make tests
2+
test('test', () => {
3+
expect(true).toEqual(true)
4+
})
5+
// import * as process from 'process'
6+
// import * as cp from 'child_process'
7+
// import * as path from 'path'
8+
//
9+
// test('throws invalid number', async () => {
10+
// const input = parseInt('foo', 10)
11+
// await expect(wait(input)).rejects.toThrow('milliseconds not a number')
12+
// })
13+
//
14+
// test('wait 500 ms', async () => {
15+
// const start = new Date()
16+
// await wait(500)
17+
// const end = new Date()
18+
// var delta = Math.abs(end.getTime() - start.getTime())
19+
// expect(delta).toBeGreaterThan(450)
20+
// })
21+
//
22+
// // shows how the runner will run a javascript action with env / stdout protocol
23+
// test('test runs', () => {
24+
// process.env['INPUT_MILLISECONDS'] = '500'
25+
// const ip = path.join(__dirname, '..', 'lib', 'main.js')
26+
// const options: cp.ExecSyncOptions = {
27+
// env: process.env
28+
// }
29+
// console.log(cp.execSync(`node ${ip}`, options).toString())
30+
// })

action.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ inputs:
1010
appspec-file:
1111
description: 'Appspec file'
1212
required: true
13-
#outputs:
14-
# time: # id of output
15-
# description: 'The time we greeted you'
1613
runs:
1714
using: 'node12'
1815
main: 'dist/index.js'

0 commit comments

Comments
 (0)