-
Notifications
You must be signed in to change notification settings - Fork 10
53 lines (47 loc) · 1.64 KB
/
sonarcloud-analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: SonarCloud analysis
on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize, reopened]
branches: ['main']
workflow_dispatch:
permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
jobs:
Analysis:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [18.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: yarn
# Generate a .npmrc file with the NPM_TOKEN
- run: echo '${{ secrets.CYPRESS_ENV }}' > cypress.env.json
- run: echo '${{ secrets.ENV_LOCAL }}' > .env.local
# Install dependencies, build and run tests
- name: Test and coverage
uses: cypress-io/github-action@v6
with:
install: yarn install
build: yarn build
start: yarn start
browser: chrome
- name: Cypress artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
path: cypress/videos/**/*
# Analyze with SonarCloud
- name: Analyze with SonarCloud
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)