Skip to content

Commit 92c0563

Browse files
committed
feat(#19): Make ThermOHL compatible with Python 3.12
- Update sonarCloud Actions to be runnable from fork Signed-off-by: SAINTIER Francois <[email protected]>
1 parent daa2e4a commit 92c0563

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

.github/workflows/sonarcloud-analysis.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,24 @@ on:
2020
jobs:
2121
SonarCloudAnalysis:
2222
runs-on: ubuntu-latest
23-
if: github.event.workflow_run.conclusion == 'success'
23+
if: github.event.workflow_run && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
2424
timeout-minutes: 15
2525

2626
steps:
2727
- name: Download PR number artifact
28-
if: github.event.workflow_run.event == 'pull_request'
2928
uses: dawidd6/action-download-artifact@v3
3029
with:
3130
workflow: SonarCloud Build
3231
run_id: ${{ github.event.workflow_run.id }}
3332
name: PR_NUMBER
3433

3534
- name: Read PR_NUMBER.txt
36-
if: github.event.workflow_run.event == 'pull_request'
3735
id: pr_number
3836
uses: juliangruber/read-file-action@v1
3937
with:
4038
path: ./PR_NUMBER.txt
4139

4240
- name: Request GitHub API for PR data
43-
if: github.event.workflow_run.event == 'pull_request'
4441
uses: octokit/[email protected]
4542
id: get_pr_data
4643
with:
@@ -57,7 +54,6 @@ jobs:
5754
fetch-depth: 0
5855

5956
- name: Checkout base branch
60-
if: github.event.workflow_run.event == 'pull_request'
6157
run: |
6258
git remote add upstream ${{ github.event.repository.clone_url }}
6359
git fetch upstream
@@ -70,9 +66,18 @@ jobs:
7066
with:
7167
python-version: 3.11
7268

69+
- name: Cache Python packages
70+
uses: actions/cache@v4
71+
with:
72+
path: ~/.cache/pip
73+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
74+
restore-keys: |
75+
${{ runner.os }}-pip
76+
7377
- name: Install dependencies
7478
run: |
7579
python -m pip install --upgrade pip
80+
pip install .
7681
pip install -e .[test]
7782
7883
- name: Run tests and generate coverage report
@@ -97,7 +102,7 @@ jobs:
97102
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
98103
99104
- name: Run Sonar analysis (Push)
100-
if: ${{ github.event.workflow_run.event == 'push' }}
105+
if: ${{ github.event.workflow_run.event == 'push' && github.repository == 'phlowers/thermohl'}}
101106
uses: sonarsource/sonarqube-scan-action@v5
102107
env:
103108
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonarcloud-build.yml

+4-24
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
fetch-depth: 0
2424

2525
- name: Cache SonarCloud packages
26-
uses: actions/cache@v3
26+
uses: actions/cache@v4
2727
with:
28-
path: ~/.sonar/cache
29-
key: ${{ runner.os }}-sonar
30-
restore-keys: ${{ runner.os }}-sonar
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
30+
restore-keys: ${{ runner.os }}-pip
3131

3232
- name: Set up Python 3.11
3333
uses: actions/setup-python@v5
@@ -39,18 +39,6 @@ jobs:
3939
python -m pip install --upgrade pip
4040
pip install --upgrade build
4141
42-
- name: Install security check tools
43-
run: |
44-
pip install bandit safety
45-
46-
- name: Security check with bandit
47-
run: |
48-
bandit -r thermohl/ -f json -o bandit-results.json || true
49-
50-
- name: Check dependencies vulnerabilities with safety
51-
run: |
52-
safety check --json --output safety-results.json || true
53-
5442
- name: Build and analyze (Pull Request)
5543
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
5644
env:
@@ -75,11 +63,3 @@ jobs:
7563
with:
7664
name: PR_NUMBER
7765
path: PR_NUMBER.txt
78-
79-
- name: Archive security reports
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: security-reports
83-
path: |
84-
bandit-results.json
85-
safety-results.json

0 commit comments

Comments
 (0)