Skip to content

Commit 0a54f12

Browse files
authored
ci: replace deprecated sonarqube action (#688)
ci: add debug step to print report files
1 parent b4492bf commit 0a54f12

File tree

6 files changed

+15
-69
lines changed

6 files changed

+15
-69
lines changed

.github/actions/download-lint-report/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ runs:
77
- name: Download lint report
88
uses: actions/download-artifact@v4
99
with:
10-
name: lint-report
10+
name: lint-report.info
1111
path: reports

.github/workflows/basic-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Archive lint report results
1919
uses: actions/upload-artifact@v4
2020
with:
21-
name: lint-report
21+
name: lint-report.info
2222
path: reports
2323

2424
build:

.github/workflows/pr.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,16 @@ jobs:
4949
# - uses: actions/checkout@v4
5050
# with:
5151
# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
52-
#
5352
# # Download reports
5453
# - uses: ./.github/actions/download-coverage-report
5554
# - uses: ./.github/actions/download-lint-report
56-
#
55+
# - name: 'Verify reports'
56+
# run: |
57+
# pwd
58+
# echo 'Lint report'
59+
# ls -la ./coverage/packages/ngx-deploy-npm/lcov.info
60+
# echo 'Coverage report'
61+
# ls -la ./reports/ngx-deploy-npm/lint-report.info
5762
# - name: SonarCloud Scan
5863
# uses: SonarSource/[email protected]
5964
# env:

.github/workflows/sonar-pr.yml

+2-53
Original file line numberDiff line numberDiff line change
@@ -35,59 +35,8 @@ jobs:
3535
JSON.stringify(${{ github.event.workflow_run }}, null, 2)
3636
3737
# Download reports
38-
- name: 'Download reports'
39-
uses: actions/github-script@v6
40-
with:
41-
script: |
42-
async function downloadArtifact(artifactName) {
43-
console.log(`Looking for artifact: ${artifactName}`);
44-
45-
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
46-
owner: context.repo.owner,
47-
repo: context.repo.repo,
48-
run_id: context.payload.workflow_run.id,
49-
});
50-
51-
console.log('Available artifacts:', allArtifacts.data.artifacts.map(a => a.name));
52-
53-
let matchArtifact = allArtifacts.data.artifacts.find((artifact) => {
54-
return artifact.name === artifactName;
55-
});
56-
57-
if (!matchArtifact) {
58-
throw new Error(`Artifact "${artifactName}" not found!`);
59-
}
60-
61-
let download = await github.rest.actions.downloadArtifact({
62-
owner: context.repo.owner,
63-
repo: context.repo.repo,
64-
artifact_id: matchArtifact.id,
65-
archive_format: 'zip',
66-
});
67-
68-
let fs = require('fs');
69-
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${artifactName}.zip`, Buffer.from(download.data));
70-
71-
return artifactName;
72-
}
73-
74-
const sha = context.payload.workflow_run.head_sha;
75-
76-
// Download both artifacts
77-
await Promise.all([
78-
downloadArtifact('ngx-deploy-npm-coverage-report'),
79-
downloadArtifact('lint-report')
80-
]);
81-
82-
- name: 'Extract reports'
83-
run: |
84-
# Extract coverage report
85-
mkdir -p coverage/packages/ngx-deploy-npm
86-
unzip ngx-deploy-npm-coverage-report.zip -d coverage/packages/ngx-deploy-npm
87-
88-
# Extract lint report
89-
mkdir -p reports
90-
unzip lint-report.zip -d reports
38+
- uses: ./.github/actions/download-coverage-report
39+
- uses: ./.github/actions/download-lint-report
9140

9241
- name: SonarCloud Scan
9342
uses: SonarSource/[email protected]

packages/ngx-deploy-npm/project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint-report": {
1212
"executor": "nx:run-commands",
1313
"options": {
14-
"command": "npx nx lint ngx-deploy-npm --outputFile reports/ngx-deploy-npm/lint-report --format=./tools/sonarqube-linter-reporter.js || true"
14+
"command": "npx nx lint ngx-deploy-npm --outputFile reports/ngx-deploy-npm/lint-report.info --format=./tools/sonarqube-linter-reporter.js || true"
1515
}
1616
},
1717
"test": {

sonar-project.properties

+3-11
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@ sonar.sourceEncoding=UTF-8
55
sonar.project.monorepo.enabled=true
66

77
# List of module indedtifiers
8-
sonar.modules=ngx-deploy-npm-e2e,ngx-deploy-npm
8+
sonar.modules=ngx-deploy-npm
99

1010
# Common settings
1111
# Files to exclude
1212
sonar.exclusions=**/node_modules/**
1313
# How to find the test
1414
sonar.test.inclusions=**/*.spec.ts,**/__mocks__/**
1515

16-
# ------- ngx-deploy-npm e2e -------
17-
ngx-deploy-npm-e2e.sonar.projectBaseDir=packages/ngx-deploy-npm-e2e
18-
ngx-deploy-npm-e2e.sonar.tests=src
19-
ngx-deploy-npm.sonar.typescript.tsconfigPath=tsconfig.spec.json
20-
# The coverage report
21-
# ngx-deploy-npm-e2e.sonar.javascript.lcov.reportPaths=/github/workspace/coverage/packages/ngx-deploy-npm-e2e/lcov.info
22-
# ------- ngx-deploy-npm e2e off -------
23-
2416
# ------- ngx-deploy-npm -------
2517
ngx-deploy-npm.sonar.projectBaseDir=packages/ngx-deploy-npm
2618
ngx-deploy-npm.sonar.sources=src
@@ -29,11 +21,11 @@ ngx-deploy-npm.sonar.typescript.tsconfigPath=tsconfig.lib.json
2921

3022
# Linter Report
3123
# We standardize all the Sonar Analysis using dockerization to be able to provide absolute paths
32-
ngx-deploy-npm.sonar.eslint.reportPaths=/github/workspace/reports/ngx-deploy-npm/lint-report
24+
ngx-deploy-npm.sonar.eslint.reportPaths=../../reports/ngx-deploy-npm/lint-report.info
3325

3426
# The coverage report
3527
# We standardize all the Sonar Analysis using dockerization to be able to provide absolute paths
36-
ngx-deploy-npm.sonar.javascript.lcov.reportPaths=/github/workspace/coverage/packages/ngx-deploy-npm/lcov.info
28+
ngx-deploy-npm.sonar.javascript.lcov.reportPaths=../../coverage/packages/ngx-deploy-npm/lcov.info
3729
# ------- ngx-deploy-npm off -------
3830

3931
# For more information visit

0 commit comments

Comments
 (0)