Skip to content

Merge pull request #302 from thib3113/dependabot/npm_and_yarn/types/n… #786

Merge pull request #302 from thib3113/dependabot/npm_and_yarn/types/n…

Merge pull request #302 from thib3113/dependabot/npm_and_yarn/types/n… #786

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [ lts/*, 16]
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: npm install, build, and test
run: |
yarn install
yarn build
echo start tests
env:
CI: true
- uses: mattallty/jest-github-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI: true
with:
test-command: yarn run ci:test:coverage
coverage-comment: false
- name: replace path in coverage files
run: find ./coverage -type f -exec sed -i -e "s@$(pwd)@<root>@g" {} \;
if: always()
- uses: actions/upload-artifact@v3
with:
name: coverage
path: |
./coverage/clover.xml
./coverage/coverage-final.json
./coverage/lcov.info
./coverage/junit.xml
./coverage/test-report.xml
if: always()
eslint:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install eslint
run: npm install
- name: run eslint
run: |
echo start eslint
mkdir coverage
npm run ci:eslint
continue-on-error: true
env:
CI: true
- name: replace path in coverage files
run: find ./coverage -type f -exec sed -i -e "s@$(pwd)@<root>@g" {} \;
- uses: actions/upload-artifact@v3
with:
name: coverage
path: ./coverage/eslint-report.json
send-coverage:
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: coverage
path: ./coverage/
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false # optional (default = false)
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: [ build, eslint ]
if: always()
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/download-artifact@v3
with:
name: coverage
path: ./coverage/
- name: change coverage path in file
run: find ./coverage -type f -exec sed -i -e "s@<root>@/github/workspace@g" {} \;
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}