Add Github actions (#9)

* First try

Signed-off-by: Avior <florian.bouillon@delta-wings.net>

* Removed Nodejs 15.x from tests

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-06-22 20:27:25 +02:00 committed by GitHub
parent 7014e0c511
commit a2f7018aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 882 additions and 19 deletions

View File

@ -1,6 +1,4 @@
dist/
src/tcgdex.browser.ts
__tests__
.eslintrc.js
webpack.config.js
tsconfig.json
*.js

47
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,47 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Build & Test
on:
push:
branches:
- master
# Run on any pull request
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn
- run: yarn build
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn && yarn build
- run: yarn test
# You may pin to the exact commit or the version.
# uses: codecov/codecov-action@6004246f47ab62d32be025ce173b241cd84ac58e
- uses: codecov/codecov-action@v1.0.13
with:
# Comma-separated list of files to upload
files: ./coverage/coverage-final.json

27
.github/workflows/code-quality.yml vendored Normal file
View File

@ -0,0 +1,27 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Code Quality Checks
on:
push:
branches:
- master
# Run on any pull request
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '16.x'
- name: Lint
run: yarn && yarn lint

View File

@ -1,4 +1,4 @@
const TCGdex = require("../dist/cjs/tcgdex.js").default
const TCGdex = require("../src/tcgdex").default
const fetch = require('node-fetch')
const fakeFetch = (response, status = 200) => jest.fn(() =>

7
babel.config.js Normal file
View File

@ -0,0 +1,7 @@
// Babel config for Jest
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript'
],
};

View File

@ -6,6 +6,9 @@
"repository": "https://github.com/tcgdex/javascript-sdk.git",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@babel/preset-typescript": "^7.14.5",
"@types/node-fetch": "^2.5.10",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
@ -29,7 +32,9 @@
"build:cjs": "tsc --project tsconfig.json",
"build:es2015": "tsc --project tsconfig.es2015.json",
"build:browser": "wp --config webpack.config.js",
"prepublishOnly": "yarn build"
"prepublishOnly": "yarn build",
"lint": "eslint",
"test": "jest --coverage"
},
"files": [
"dist"

807
yarn.lock

File diff suppressed because it is too large Load Diff