Skip to content

Commit db52612

Browse files
chore: update SonarQube integration in CI workflow with improved setup and dependencies
1 parent a5fcaa0 commit db52612

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

.github/workflows/python-selenium-ci-workflow.yaml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,37 @@ on:
1717

1818

1919
jobs:
20-
# sonarcloud:
21-
# runs-on: ubuntu-latest
22-
# env:
23-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
25-
# permissions:
26-
# contents: read
27-
# steps:
28-
# - name: Checkout code
29-
# uses: actions/checkout@v2
30-
31-
# - name: SonarCloud Scan
32-
# uses: sonarsource/sonarcloud-github-action@master
33-
# with:
34-
# args: sonar-scanner -Dsonar.projectKey=your_project_key -Dsonar.organization=your_organization_name -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_TOKEN }}
35-
# env:
36-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
20+
sonarqube:
21+
name: SonarQube
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '18'
32+
cache: 'npm'
33+
cache-dependency-path: react/package-lock.json
34+
35+
- name: Run npm install
36+
run: |
37+
cd react
38+
npm ci
39+
40+
- name: SonarQube Scan
41+
uses: SonarSource/sonarqube-scan-action@v5
42+
env:
43+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3844

3945
selenium:
4046
runs-on: ubuntu-latest
47+
needs: sonarqube
4148

4249
env:
43-
APP_URL: ${{ secrets.APP_URL || 'http://localhost:3000' }}
50+
APP_URL: 'http://localhost:3000'
4451
DISPLAY: :99
4552

4653
steps:
@@ -106,7 +113,7 @@ jobs:
106113
# Add HTML report generation
107114
python -m pytest -v test_home_page.py --html=report.html
108115
env:
109-
APP_URL: ${{ secrets.APP_URL || 'http://localhost:3000' }}
116+
APP_URL: 'http://localhost:3000'
110117
PYTHONPATH: ${{ github.workspace }}
111118

112119
- name: Upload test results

tests/test_home_page.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def test_home_page_functional_flow(self, driver):
6969
)
7070
final_grade_rows = driver.find_elements(By.CSS_SELECTOR, ".home__grade-row")
7171
assert len(final_grade_rows) == initial_count, "Grade row was not removed!"
72-
73-
assert True == False, "Intentional failure to test screenshot functionality." #TODO: Remove this line after testing
72+
7473

7574
except Exception as e:
7675
# Take screenshot on any failure

0 commit comments

Comments
 (0)