-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 2.47 KB
/
Copy pathsonarcloud.yml
File metadata and controls
65 lines (62 loc) · 2.47 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 2023 Rob Spoor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: SonarCloud
on:
workflow_dispatch:
push:
# only run for branches, not tags
branches: ['**']
pull_request:
schedule:
- cron: '0 6 23 1,7 *'
jobs:
scan:
runs-on: ubuntu-latest
concurrency: sonar-${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0
- name: Set up Node.js 24
uses: actions/setup-node@v7
with:
node-version: '24'
cache: 'npm'
- name: Install packages
run: npm ci --ignore-scripts
- name: Run tests
run: npm run test
- name: Create Sonar properties
run: |
echo "sonar.organization=robtimus-github" > sonar-project.properties
echo "sonar.projectKey=robtimus:`jq -r .name package.json`" >> sonar-project.properties
echo "sonar.projectDescription=`jq -r .description package.json`" >> sonar-project.properties
echo "sonar.links.homepage=`jq -r .homepage package.json`" >> sonar-project.properties
echo "sonar.links.issue=`jq -r .bugs.url package.json`" >> sonar-project.properties
echo "sonar.links.scm=`jq -r .repository.url package.json | sed 's/git+//'`" >> sonar-project.properties
echo "sonar.sources=src" >> sonar-project.properties
echo "sonar.tests=test" >> sonar-project.properties
echo "sonar.javascript.lcov.reportPaths=./coverage/lcov.info" >> sonar-project.properties
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SonarCloudToken }}
SONAR_HOST_URL: https://sonarcloud.io
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SonarCloudToken }}
SONAR_HOST_URL: https://sonarcloud.io