Skip to content

Commit 4971c71

Browse files
PYSCAN-32 Setup basic CI (run black, tests and generate coverage) for PRs
1 parent 13d6752 commit 4971c71

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

.github/workflows/build-pr.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: build-pr
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: |
22+
3.8
23+
3.9
24+
3.10
25+
3.11
26+
3.12
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install hatch
31+
- name: Check tests and generate coverage
32+
run: |
33+
hatch run test:cov_xml
34+
- name: Check formatting
35+
run: |
36+
hatch run tool:format
37+
# - name: SonarCloud Scan
38+
# uses: SonarSource/sonarcloud-github-action@master
39+
# env:
40+
# SONAR_TOKEN: FIXME PYSCAN-33: Enable SonarCloud analysis

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ authors = [
1313
description = "Sonar Scanner for the Python Ecosystem"
1414
readme = "README.md"
1515
license = {file = "LICENSE"}
16-
requires-python = ">=3.12"
16+
requires-python = ">=3.8"
1717
classifiers = [
1818
"Programming Language :: Python :: 3",
1919
"Operating System :: OS Independent",
@@ -66,6 +66,7 @@ dependencies = [
6666
[tool.hatch.envs.tool.scripts]
6767
license = 'python -m licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2023 -n "Sonar Scanner Python" -E .py'
6868
format = 'python -m black src/ tests/ --check'
69+
apply_format = 'python -m black src/ tests/'
6970
type_check = "python -m mypy src/ tests/ --ignore-missing-imports"
7071

7172
[tool.pytest.ini_options]

sonar-project.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sonar.projectKey=SonarSource_sonar-scanner-python
2+
sonar.projectName=sonar-scanner-python
3+
sonar.organization=sonarsource
4+
sonar.python.version=3.8,3.9,3.10,3.11,3.12
5+
sonar.python.coverage.reportPaths=coverage.xml
6+
sonar.sources=src
7+
sonar.tests=tests

0 commit comments

Comments
 (0)