Skip to content

Commit

Permalink
Add github action boilerplate with typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
yukin01 committed Apr 4, 2020
1 parent 5774d13 commit 7a623c5
Show file tree
Hide file tree
Showing 16 changed files with 4,421 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
plugins: ['@typescript-eslint', 'jest'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:jest/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module'
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off'
},
env: {
node: true,
es6: true,
'jest/globals': true
}
}
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and test
on:
pull_request:
push:
branches:
- master
- releases/*

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
yarn --frozen-lockfile
yarn all
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
numbers: 1,2,3
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ typings/

# Nuxt.js build / generate output
.nuxt
dist
# dist

# Gatsby files
.cache/
Expand All @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# Ignore output files
lib/
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 80,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSaveTimeout": 2000,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "./node_modules/typescript/lib"
}
9 changes: 9 additions & 0 deletions __tests__/sum.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { sum } from '../src/sum'

test('sum up numbers', () => {
expect(sum(1, 2)).toBe(3)
})

test('sum up numbers with NaN', () => {
expect(sum(NaN, 1, 2)).toBe(3)
})
10 changes: 10 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Typescript Action Template"
description: "Provide a description here"
author: "yukin01"
inputs:
numbers:
description: "Comma separated numbers that you want to sum"
required: true
runs:
using: "node12"
main: "dist/index.js"
Loading

0 comments on commit 7a623c5

Please sign in to comment.