Skip to content

Commit 52c1420

Browse files
authored
Addition of some software maintenance tools (#71)
* add codeql action * Add codecov report upload to CI.yml * fix environment to handle testing * add secret token for uploading codecov reports
1 parent 135fceb commit 52c1420

File tree

5 files changed

+76
-3
lines changed

5 files changed

+76
-3
lines changed

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: "41 4 * * 6"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ python ]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: +security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v3
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v3
40+
with:
41+
category: "/language:${{ matrix.language }}"

.github/workflows/run_test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,12 @@ jobs:
4646
- name: Install package
4747
run: micromamba run -n grouper-dev pip install -e .
4848

49-
- name: Run tests with pytest
50-
run: micromamba run -n grouper-dev pytest Grouper/tests
49+
- name: Test (OS -> ${{ matrix.os }} / Python -> ${{ matrix.python-version }})
50+
run: micromamba run -n grouper-dev python -m pytest -v --cov-append --cov-config=pyproject.toml --color yes --pyargs Grouper
51+
52+
- name: Upload coverage reports to Codecov
53+
uses: codecov/codecov-action@v5
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
verbose: true
57+
files: ./coverage.xml

Grouper/codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ignore:
2+
- "Grouper/tests"
3+
- "Grouper/images"
4+
- "Grouper/packages"
5+
- "Grouper/submission_scripts"
6+
- "Grouper/.github/ISSUE_TEMPLATE"
7+
- "Grouper/.github/PULL_REQUEST_TEMPLATE.md"
8+
- "run_random_generate.py"
9+
- "run_exhaustive_generate.py"

environment.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ dependencies:
2323
- pytorch
2424
- pytest-benchmark
2525
- pytest
26+
- pytest-cov
27+
- coverage
28+
- codecov
2629
- nlohmann_json
2730
- python-igraph
2831
- dash

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,17 @@ cmake.minimum-version = "3.15"
1414
wheel.expand-macos-universal-tags = true
1515

1616
[tool.setuptools]
17-
packages = ["Grouper"]
17+
packages = ["Grouper"]
18+
19+
[tool.pytest.ini_options]
20+
addopts = "--cov=Grouper --cov-report=xml:coverage.xml"
21+
22+
[tool.coverage.run]
23+
source = ["Grouper"] # Adjust based on your project structure
24+
branch = true # Include branch coverage
25+
26+
[tool.coverage.report]
27+
exclude_lines = [
28+
"pragma: no cover",
29+
"if TYPE_CHECKING:",
30+
]

0 commit comments

Comments
 (0)