Skip to content

Use GitHub actions and SonarCloud for testing and analysis #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on:
push:
branches: [master]
paths:
- '.github/workflows/ci.yml'
- 'src/**'
- 'scripts'
- '.eslintignore'
- '.eslintrc'
- '.prettierignore'
- '.prettierrc'
- 'babel.config.json'
- 'jest.config.js'
- 'package.json'
- 'package-lock.json'
- 'sonar-project.properties'
- 'tsconfig.json'
- 'tsconfig.prod.json'
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
paths:
- '.github/workflows/ci.yml'
- 'src/**'
- 'scripts'
- '.eslintignore'
- '.eslintrc'
- '.prettierignore'
- '.prettierrc'
- 'babel.config.json'
- 'jest.config.js'
- 'package.json'
- 'package-lock.json'
- 'sonar-project.properties'
- 'tsconfig.json'
- 'tsconfig.prod.json'
jobs:
testing:
name: Testing and Analysis
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout project code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Installation
run: npm ci
- name: Linting
run: npm run check
- name: Testing
run: npm run test:coverage
env:
CI: true
- name: Analysis
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

155 changes: 0 additions & 155 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"build:lib": "cross-env BUILD_TYPE=lib run-p build:lib:*",
"build:lib:files": "babel -x .ts,.tsx,.js,.jsx src --out-dir dist/lib --ignore \"**/*.d.ts\" --copy-files",
"build:lib:dts": "tsc -p tsconfig.prod.json --emitDeclarationOnly --outDir dist/lib",
"full-prepare": "run-s clean check test:cover build",
"full-prepare": "run-s clean check test:coverage build",
"lint": "eslint \"+(.storybook|__stories__|__tests__|config|src)/**/*.{ts,js}\"",
"precommit": "lint-staged",
"start": "run-s storybook",
"storybook:dev": "start-storybook -p 6006",
"storybook:build": "build-storybook -c .storybook -o docs",
"test": "cross-env NODE_ENV=test jest",
"test:cover": "npm run test -- --coverage",
"test:coverage": "npm run test -- --coverage",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"repository": {
Expand Down Expand Up @@ -74,7 +74,6 @@
"@types/react-window": "^1.8.2",
"babel-jest": "^26.2.2",
"babel-loader": "^8.1.0",
"codecov": "^3.7.2",
"cross-env": "^7.0.2",
"cssnano": "^4.1.10",
"enzyme": "^3.11.0",
Expand Down
6 changes: 6 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sonar.inclusions=src/**/*
sonar.host.url=https://sonarcloud.io
sonar.organization=lodin
sonar.projectKey=Lodin_react-vtree
sonar.sources=src
sonar.javascript.lcov.reportPaths=coverage/lcov.info
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"baseUrl": "./",
"declaration": true,
"jsx": "react",
"lib": ["dom", "es2017"],
"lib": ["dom", "esnext"],
"module": "commonjs",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
Expand All @@ -14,7 +14,7 @@
"sourceMap": true,
"sourceRoot": "./src",
"strict": true,
"target": "es2015",
"target": "esnext",
"typeRoots": ["node_modules/@types"]
},
"include": [
Expand Down