Skip to content

Commit 8b9fb00

Browse files
committed
fixing python project
1 parent 9e43c3c commit 8b9fb00

File tree

97 files changed

+1113
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1113
-448
lines changed

.github/workflows/build.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master ]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ubuntu-latest]
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
19+
cuda-version: ["11.8", "12.1"]
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
submodules: recursive
25+
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install CUDA Toolkit
32+
if: matrix.os == 'ubuntu-latest'
33+
uses: Jimver/[email protected]
34+
with:
35+
cuda: ${{ matrix.cuda-version }}
36+
37+
- name: Install system dependencies
38+
if: matrix.os == 'ubuntu-latest'
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y cmake build-essential ninja-build libboost-all-dev
42+
43+
- name: Install Python dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
pip install build wheel setuptools cmake pybind11 ninja
47+
pip install pytest pytest-cov numpy matplotlib scipy
48+
49+
- name: Build package (superbuild)
50+
run: |
51+
python -m build --wheel
52+
53+
- name: Install package
54+
run: |
55+
pip install dist/*.whl
56+
57+
- name: Run tests
58+
run: |
59+
pytest odevis/python/tests/ -v
60+
61+
build-wheel:
62+
if: github.event_name == 'release'
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
with:
67+
submodules: recursive
68+
69+
- name: Set up Python
70+
uses: actions/setup-python@v4
71+
with:
72+
python-version: "3.10"
73+
74+
- name: Install CUDA Toolkit
75+
uses: Jimver/[email protected]
76+
with:
77+
cuda: "12.1"
78+
79+
- name: Install system dependencies
80+
run: |
81+
sudo apt-get update
82+
sudo apt-get install -y cmake build-essential ninja-build libboost-all-dev
83+
84+
- name: Install build dependencies
85+
run: |
86+
python -m pip install --upgrade pip
87+
pip install build twine cmake pybind11 ninja
88+
89+
- name: Build wheel
90+
run: |
91+
python -m build
92+
93+
- name: Upload to PyPI
94+
env:
95+
TWINE_USERNAME: __token__
96+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
97+
run: |
98+
twine upload dist/*

.github/workflows/ci.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: C++ CI
22

33
on:
44
# We run CI on pushes to the main branch
@@ -14,31 +14,35 @@ on:
1414

1515
jobs:
1616
build-and-test:
17-
name: Testing on ${{matrix.os}}
17+
name: C++ Testing on ${{matrix.os}}
1818
runs-on: ${{matrix.os}}
1919
strategy:
2020
matrix:
21-
os: [ubuntu-18.04, macos-10.15]
21+
os: [ubuntu-latest, macos-latest]
2222

2323
steps:
24-
- uses: actions/checkout@v2
25-
24+
- uses: actions/checkout@v4
2625
with:
2726
submodules: 'recursive'
2827

29-
- name: upgrade g++ compiler on ubuntu
30-
run: |
31-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 10
32-
sudo update-alternatives --set g++ /usr/bin/g++-9
28+
- name: Install system dependencies (Ubuntu)
3329
if: runner.os == 'Linux'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y cmake build-essential ninja-build libboost-all-dev
33+
34+
- name: Install system dependencies (macOS)
35+
if: runner.os == 'macOS'
36+
run: |
37+
brew install cmake ninja boost
3438
3539
- name: make build directory
3640
run: cmake -E make_directory ${{runner.workspace}}/build
3741

3842
- name: configure cmake
3943
shell: bash
4044
working-directory: ${{runner.workspace}}/build
41-
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DBUILD_DOCS=OFF
45+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DBUILD_DOCS=OFF -DBUILD_PYTHON_BINDINGS=OFF
4246

4347
- name: build
4448
shell: bash
@@ -52,30 +56,26 @@ jobs:
5256

5357

5458
coverage-test:
55-
name: Coverage Testing
56-
runs-on: ubuntu-18.04
59+
name: C++ Coverage Testing
60+
runs-on: ubuntu-latest
5761

5862
steps:
59-
- uses: actions/checkout@v2
63+
- uses: actions/checkout@v4
6064
with:
6165
submodules: 'recursive'
6266

63-
- name: Install LCov
64-
run: |
65-
sudo apt-get install -y lcov
66-
67-
- name: upgrade g++ compiler on ubuntu
67+
- name: Install dependencies
6868
run: |
69-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 10
70-
sudo update-alternatives --set g++ /usr/bin/g++-9
69+
sudo apt-get update
70+
sudo apt-get install -y lcov cmake build-essential ninja-build libboost-all-dev
7171
7272
- name: make build directory
7373
run: cmake -E make_directory ${{runner.workspace}}/build
7474

7575
- name: configure cmake
7676
shell: bash
7777
working-directory: ${{runner.workspace}}/build
78-
run: cmake $GITHUB_WORKSPACE -DCMAKE_CXX_FLAGS="--coverage" -DBUILD_DOCS=OFF
78+
run: cmake $GITHUB_WORKSPACE -DCMAKE_CXX_FLAGS="--coverage" -DBUILD_DOCS=OFF -DBUILD_PYTHON_BINDINGS=OFF
7979

8080
- name: build
8181
shell: bash

.github/workflows/pypi.yml

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

.github/workflows/sonarcloud.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: SonarCloud
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2424
submodules: 'recursive'

.gitignore

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,75 @@
1+
# Python build artifacts
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
*.egg-info/
7+
dist/
8+
build/
9+
.eggs/
10+
*.egg
11+
12+
# LaTeX build artifacts
113
*.aux
214
*.log
315
*.out
416
*.synctex.gz
517
*.toc
618
*.pyc
719

20+
# CMake build artifacts
21+
CMakeCache.txt
22+
CMakeFiles/
23+
cmake_install.cmake
24+
Makefile
25+
install_manifest.txt
26+
*.cmake
27+
!*Config.cmake.in
28+
*-prefix/
29+
*-build/
830

9-
doc/source/*
10-
!doc/source/figures/
11-
!doc/source/report.tex
12-
!doc/source/references.bib
31+
# Compiled extensions
32+
*.dll
33+
*.dylib
34+
*.pyd
1335

14-
build/
15-
install/
36+
# IDE files
1637
.vscode/
1738
.idea/
18-
__pychache__/
39+
*.swp
40+
*.swo
41+
42+
# OS files
43+
.DS_Store
44+
Thumbs.db
45+
46+
# Testing
47+
.pytest_cache/
48+
.coverage
49+
htmlcov/
50+
51+
# Virtual environments
52+
venv/
53+
env/
54+
.env
55+
56+
# Temporary files
57+
*.tmp
58+
*.bak
59+
*~
60+
61+
# Build directories
62+
build/
63+
install/
64+
cmake_install/
1965
ODEVisualizationLib.egg-info/
2066

67+
# Documentation source (keep only specific files)
68+
doc/source/*
69+
!doc/source/figures/
70+
!doc/source/report.tex
71+
!doc/source/references.bib
72+
2173
examples/applications/c++/*
2274
!examples/applications/c++/CMakeLists.txt
2375
!examples/applications/c++/include

0 commit comments

Comments
 (0)