Skip to content

Commit 081b078

Browse files
authored
Use GitHub actions and SonarCloud for testing and analysis (#24)
1 parent df700fa commit 081b078

File tree

6 files changed

+76
-170
lines changed

6 files changed

+76
-170
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- '.github/workflows/ci.yml'
8+
- 'src/**'
9+
- 'scripts'
10+
- '.eslintignore'
11+
- '.eslintrc'
12+
- '.prettierignore'
13+
- '.prettierrc'
14+
- 'babel.config.json'
15+
- 'jest.config.js'
16+
- 'package.json'
17+
- 'package-lock.json'
18+
- 'sonar-project.properties'
19+
- 'tsconfig.json'
20+
- 'tsconfig.prod.json'
21+
pull_request:
22+
branches: [master]
23+
types: [opened, synchronize, reopened]
24+
paths:
25+
- '.github/workflows/ci.yml'
26+
- 'src/**'
27+
- 'scripts'
28+
- '.eslintignore'
29+
- '.eslintrc'
30+
- '.prettierignore'
31+
- '.prettierrc'
32+
- 'babel.config.json'
33+
- 'jest.config.js'
34+
- 'package.json'
35+
- 'package-lock.json'
36+
- 'sonar-project.properties'
37+
- 'tsconfig.json'
38+
- 'tsconfig.prod.json'
39+
jobs:
40+
testing:
41+
name: Testing and Analysis
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 5
44+
45+
steps:
46+
- name: Checkout project code
47+
uses: actions/checkout@v2
48+
with:
49+
fetch-depth: 0
50+
- name: Use Node.js 14.x
51+
uses: actions/setup-node@v1
52+
with:
53+
node-version: 14.x
54+
- name: Installation
55+
run: npm ci
56+
- name: Linting
57+
run: npm run check
58+
- name: Testing
59+
run: npm run test:coverage
60+
env:
61+
CI: true
62+
- name: Analysis
63+
uses: sonarsource/sonarcloud-github-action@master
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.travis.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

package-lock.json

Lines changed: 0 additions & 155 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
"build:lib": "cross-env BUILD_TYPE=lib run-p build:lib:*",
2222
"build:lib:files": "babel -x .ts,.tsx,.js,.jsx src --out-dir dist/lib --ignore \"**/*.d.ts\" --copy-files",
2323
"build:lib:dts": "tsc -p tsconfig.prod.json --emitDeclarationOnly --outDir dist/lib",
24-
"full-prepare": "run-s clean check test:cover build",
24+
"full-prepare": "run-s clean check test:coverage build",
2525
"lint": "eslint \"+(.storybook|__stories__|__tests__|config|src)/**/*.{ts,js}\"",
2626
"precommit": "lint-staged",
2727
"start": "run-s storybook",
2828
"storybook:dev": "start-storybook -p 6006",
2929
"storybook:build": "build-storybook -c .storybook -o docs",
3030
"test": "cross-env NODE_ENV=test jest",
31-
"test:cover": "npm run test -- --coverage",
31+
"test:coverage": "npm run test -- --coverage",
3232
"typecheck": "tsc -p tsconfig.json --noEmit"
3333
},
3434
"repository": {
@@ -74,7 +74,6 @@
7474
"@types/react-window": "^1.8.2",
7575
"babel-jest": "^26.2.2",
7676
"babel-loader": "^8.1.0",
77-
"codecov": "^3.7.2",
7877
"cross-env": "^7.0.2",
7978
"cssnano": "^4.1.10",
8079
"enzyme": "^3.11.0",

sonar-project.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sonar.inclusions=src/**/*
2+
sonar.host.url=https://sonarcloud.io
3+
sonar.organization=lodin
4+
sonar.projectKey=Lodin_react-vtree
5+
sonar.sources=src
6+
sonar.javascript.lcov.reportPaths=coverage/lcov.info

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"baseUrl": "./",
55
"declaration": true,
66
"jsx": "react",
7-
"lib": ["dom", "es2017"],
7+
"lib": ["dom", "esnext"],
88
"module": "commonjs",
99
"moduleResolution": "node",
1010
"noFallthroughCasesInSwitch": true,
@@ -14,7 +14,7 @@
1414
"sourceMap": true,
1515
"sourceRoot": "./src",
1616
"strict": true,
17-
"target": "es2015",
17+
"target": "esnext",
1818
"typeRoots": ["node_modules/@types"]
1919
},
2020
"include": [

0 commit comments

Comments
 (0)