@@ -3,64 +3,83 @@ name: CI - Release Check
33on :
44 pull_request :
55 branches : [master]
6+ push :
7+ branches : [master]
8+ workflow_dispatch :
9+ inputs :
10+ sonar :
11+ description : " Run SonarCloud analysis"
12+ required : true
13+ default : " false"
14+ type : choice
15+ options :
16+ - " false"
17+ - " true"
618
7- permissions :
8- contents : read
9-
10- env :
11- SONAR_ENABLED : ' true'
19+ concurrency :
20+ group : ci-release-${{ github.ref }}
21+ cancel-in-progress : true
1222
1323jobs :
14- release-check :
15- name : CI - Release Check
16- # Only run when PR is from develop -> master
17- if : github.head_ref == 'develop'
24+ ci :
25+ name : release checks
1826 runs-on : ubuntu-latest
27+ timeout-minutes : 25
28+
29+ # Config stays in the workflow file (token stays in repo secrets)
30+ env :
31+ SONAR_HOST_URL : " https://sonarcloud.io"
32+ SONAR_ORGANIZATION : " ciscode"
33+ SONAR_PROJECT_KEY : " CISCODE-MA_WidgetKit-UI"
1934
2035 steps :
21- - name : Checkout (full history for Sonar)
36+ - name : Checkout
2237 uses : actions/checkout@v4
2338 with :
2439 fetch-depth : 0
2540
2641 - name : Setup Node
2742 uses : actions/setup-node@v4
2843 with :
29- node-version : 20
30- cache : npm
44+ node-version : " 22 "
45+ cache : " npm"
3146
3247 - name : Install
3348 run : npm ci
3449
35- - name : Format (check)
36- run : npm run format
37-
38- - name : Lint
39- run : npm run lint
50+ - name : Format
51+ run : npm run format
4052
4153 - name : Typecheck
4254 run : npm run typecheck
4355
44- - name : Test
45- run : npm test
56+ - name : Lint
57+ run : npm run lint
58+
59+ - name : Test (with coverage)
60+ run : npm run test:cov
4661
4762 - name : Build
4863 run : npm run build
4964
50- # --- SonarQube scan + Quality Gate ---
51- - name : SonarQube Scan
52- if : env.SONAR_ENABLED == 'true' && (github.event.pull_request.head.repo.fork == false)
53- uses : sonarsource/sonarqube-scan-action@v4
65+ - name : SonarCloud Scan
66+ if : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sonar == 'true' }}
67+ uses : SonarSource/sonarqube-scan-action@v6
5468 env :
5569 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
56- SONAR_HOST_URL : ${{ secrets .SONAR_HOST_URL }}
70+ SONAR_HOST_URL : ${{ env .SONAR_HOST_URL }}
5771 with :
5872 args : >
59- -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
73+ -Dsonar.organization=${{ env.SONAR_ORGANIZATION }} \
74+ -Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \
75+ -Dsonar.sources=src \
76+ -Dsonar.tests=test \
77+ -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
6078
61- - name : SonarQube Quality Gate
62- if : env.SONAR_ENABLED == 'true' && (github.event.pull_request.head.repo.fork == false)
63- uses : sonarsource/sonarqube-quality-gate-action@v1.1.0
79+ - name : SonarCloud Quality Gate
80+ if : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sonar == 'true' }}
81+ uses : SonarSource/sonarqube-quality-gate-action@v1
82+ timeout-minutes : 10
6483 env :
6584 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
66- SONAR_HOST_URL : ${{ secrets .SONAR_HOST_URL }}
85+ SONAR_HOST_URL : ${{ env .SONAR_HOST_URL }}
0 commit comments