Skip to content

Commit a4549d5

Browse files
Merge pull request #4 from breimanntools/my-local-changes
Update Workflows (add build_wheels, codeql, main, test_coverage)
2 parents fe7cef0 + c94c75d commit a4549d5

36 files changed

+1882
-908
lines changed

.github/workflows/build_wheels.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build wheels
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
generate-wheels-matrix:
10+
name: Generate wheels matrix
11+
runs-on: ubuntu-latest
12+
outputs:
13+
include: ${{ steps.set-matrix.outputs.include }}
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Install cibuildwheel
17+
run: pipx install cibuildwheel==2.14.0
18+
- id: set-matrix
19+
run: |
20+
# ... (Keep this section as is in the original SHAP example)
21+
22+
build_wheels:
23+
name: Build ${{ matrix.only }}
24+
needs: generate-wheels-matrix
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
29+
runs-on: ${{ matrix.os }}
30+
steps:
31+
- name: Check out the repo
32+
uses: actions/checkout@v3
33+
34+
- name: Set up QEMU
35+
if: runner.os == 'Linux'
36+
uses: docker/setup-qemu-action@v2
37+
with:
38+
platforms: all
39+
40+
- name: Build wheels
41+
uses: pypa/cibuildwheel@v2.14.0
42+
with:
43+
only: ${{ matrix.only }}
44+
45+
- uses: actions/upload-artifact@v3
46+
with:
47+
path: ./wheelhouse/*.whl
48+
name: bdist_files
49+
50+
build_sdist:
51+
name: Build source distribution
52+
runs-on: ubuntu-20.04
53+
steps:
54+
- name: Check out the repo
55+
uses: actions/checkout@v3
56+
- name: Set up Python 3.11
57+
uses: actions/setup-python@v4
58+
with:
59+
python-version: '3.11'
60+
- name: Build sdist (pep517)
61+
run: |
62+
python -m pip install build
63+
python -m build --sdist
64+
- name: Upload sdist
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: sdist_files
68+
path: dist/*.tar.gz
69+
70+
publish_wheels:
71+
name: Publish wheels on pypi
72+
needs: [build_wheels, build_sdist]
73+
runs-on: ubuntu-latest
74+
if: startsWith(github.ref, 'refs/tags')
75+
steps:
76+
- uses: actions/download-artifact@v3
77+
with:
78+
name: bdist_files
79+
path: dist
80+
- uses: actions/download-artifact@v3
81+
with:
82+
name: sdist_files
83+
path: dist
84+
- name: Publish package to TestPyPI
85+
uses: pypa/gh-action-pypi-publish@release/v1
86+
with:
87+
password: ${{ secrets.TEST_PYPI_TOKEN }}
88+
repository-url: https://test.pypi.org/legacy/
89+
- name: Publish package to PyPI
90+
uses: pypa/gh-action-pypi-publish@release/v1
91+
with:
92+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/codeql_analysis.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
schedule:
11+
- cron: '0 0 * * 0'
12+
13+
jobs:
14+
analyze:
15+
name: Analyze
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
- name: Initialize CodeQL
22+
uses: github/codeql-action/init@v3
23+
with:
24+
languages: "python"
25+
- name: Perform CodeQL Analysis
26+
uses: github/codeql-action/analyze@v3
27+
28+
code-quality:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: 3.9
36+
37+
- name: Cache Python dependencies
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.cache/pip
41+
key: ${{ runner.os }}-pip-3.9-${{ hashFiles('**/requirements.txt') }}
42+
restore-keys: |
43+
${{ runner.os }}-pip-3.9-
44+
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install flake8 mypy pylint
49+
50+
- name: Run flake8 (check style)
51+
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
52+
53+
- name: Run mypy (check static typing)
54+
run: mypy xomics/__init__.py --follow-imports=skip

.github/workflows/main.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest]
17+
python-version: ['3.9', '3.10', '3.11', '3.12']
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Cache Python dependencies
23+
uses: actions/cache@v4
24+
with:
25+
path: ~/.cache/pip
26+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
27+
restore-keys: |
28+
${{ runner.os }}-pip-${{ matrix.python-version }}-
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Install dependencies
36+
run: |
37+
python -m pip install --upgrade pip
38+
pip install -r requirements.txt
39+
pip install pytest
40+
41+
- name: Run Tests
42+
run: pytest tests
43+
env:
44+
HYPOTHESIS_DEADLINE: 10000000
45+
MPLBACKEND: Agg

.github/workflows/python-package.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/test_coverage.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test Coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.9'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
pip install pytest pytest-cov
28+
29+
- name: Run tests with coverage and generate XML report
30+
run: |
31+
pytest --cov=./ --cov-report=xml
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v3
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}
37+
file: ./coverage.xml
38+
fail_ci_if_error: true
39+
env:
40+
MPLBACKEND: Agg

xomics/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
plot_enrich_map,
88
plot_prank,
99
plot_prank_scatter,
10-
plot_imput_histo,
11-
plot_settings,
12-
plot_legend,
13-
plot_get_clist,
14-
plot_gcfs)
10+
plot_imput_histo)
1511

1612
__all__ = [
1713
"pRank",
@@ -24,8 +20,4 @@
2420
"plot_prank",
2521
"plot_prank_scatter",
2622
"plot_imput_histo",
27-
"plot_settings",
28-
"plot_legend",
29-
"plot_get_clist",
30-
"plot_gcfs"
3123
]

xomics/_utils/_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""This is a script for utility functions for utility functions."""
2+
3+
4+
# Helper functions
5+
# This function is only used in utility check function
6+
def add_str(str_error=None, str_add=None):
7+
"""Add additional error message 'str_add' to default error message ('add_str')"""
8+
if str_add:
9+
str_error += "\n " + str_add
10+
return str_error

0 commit comments

Comments
 (0)