Skip to content

Commit 4baf64e

Browse files
committed
Adds GH CI
Signed-off-by: Alexis Jeandet <[email protected]>
1 parent 4706eea commit 4baf64e

File tree

4 files changed

+219
-7
lines changed

4 files changed

+219
-7
lines changed

.github/workflows/CI.yml

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: GH Actions
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
pull_request:
8+
9+
jobs:
10+
build_sdist:
11+
name: Build source distribution
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Build sdist
16+
run: pipx run build --sdist
17+
- name: Upload artifact
18+
uses: actions/upload-artifact@v4
19+
with:
20+
name: cibw-sdist
21+
path: dist/*.tar.gz
22+
23+
build_wheels:
24+
name: Build wheels on ${{ matrix.os }}
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
include:
29+
- os: ubuntu-latest
30+
CIBW_ENVIRONMENT: ''
31+
CIBW_ARCHS: "x86_64"
32+
- os: windows-latest
33+
CIBW_ENVIRONMENT: ''
34+
CIBW_ARCHS: "AMD64"
35+
- os: macos-13 # Intel
36+
CIBW_ENVIRONMENT: >
37+
MACOSX_DEPLOYMENT_TARGET='10.15'
38+
CIBW_ARCHS: "x86_64"
39+
- os: macos-14 # Apple Silicon
40+
CIBW_ENVIRONMENT: >
41+
MACOSX_DEPLOYMENT_TARGET='11.0'
42+
CIBW_ARCHS: "arm64"
43+
env:
44+
CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }}
45+
CIBW_SKIP: "*-win32 *i686"
46+
CIBW_ARCHS: ${{ matrix.CIBW_ARCHS }}
47+
CIBW_PRERELEASE_PYTHONS: "True"
48+
steps:
49+
- uses: ilammy/msvc-dev-cmd@v1
50+
if: runner.os == 'Windows'
51+
with:
52+
arch: amd64
53+
- uses: actions/checkout@v4
54+
- name: Build wheels
55+
uses: pypa/[email protected]
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
59+
path: ./wheelhouse/*.whl
60+
61+
test_wheels:
62+
needs: [build_wheels]
63+
strategy:
64+
matrix:
65+
os: [macos-13, windows-latest, ubuntu-latest]
66+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
67+
runs-on: ${{ matrix.os }}
68+
steps:
69+
- name: Setup Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: ${{ matrix.python-version }}
73+
allow-prereleases: true
74+
architecture: x64
75+
- uses: actions/download-artifact@v4
76+
with:
77+
pattern: cibw-wheels-*
78+
path: dist
79+
merge-multiple: true
80+
- name: install wheel (Unix)
81+
if: runner.os != 'Windows'
82+
run: |
83+
pip install numpy pyyaml
84+
pip install --no-index --find-links $GITHUB_WORKSPACE/dist space_ouija
85+
- name: install wheel (Windows)
86+
if: runner.os == 'Windows'
87+
run: |
88+
pip install numpy pyyaml
89+
pip install --no-index --find-links $env:GITHUB_WORKSPACE\dist space_ouija
90+
- uses: actions/checkout@v4
91+
- name: run tests
92+
run: |
93+
pip install ddt requests
94+
python -v tests/full_corpus/test_full_corpus.py
95+
96+
test_wheels_macos_14:
97+
needs: [build_wheels]
98+
strategy:
99+
matrix:
100+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
101+
runs-on: macos-14
102+
steps:
103+
- name: add pyenv to path
104+
run: |
105+
echo "~/.pyenv/shims" >> $GITHUB_PATH
106+
- name: install dependencies
107+
run: |
108+
brew install pyenv
109+
brew upgrade pyenv
110+
pyenv install ${{ matrix.python-version }}
111+
- uses: actions/download-artifact@v4
112+
with:
113+
pattern: cibw-wheels-*
114+
path: dist
115+
merge-multiple: true
116+
- name: install wheel
117+
run: |
118+
pyenv local ${{ matrix.python-version }}
119+
python3 -m pip install --break-system-packages numpy pyyaml
120+
python3 -m pip install --break-system-packages --no-index --find-links $GITHUB_WORKSPACE/dist space_ouija
121+
- uses: actions/checkout@v4
122+
- name: run tests
123+
run: |
124+
pyenv local ${{ matrix.python-version }}
125+
python3 -m pip install --break-system-packages ddt requests
126+
python3 tests/full_corpus/test_full_corpus.py
127+
128+
129+
upload_pypi:
130+
needs: [build_sdist, build_wheels, test_wheels, test_wheels_macos_14]
131+
runs-on: ubuntu-latest
132+
# upload to PyPI only on github releases
133+
if: github.event_name == 'release' && github.event.action == 'published' && github.repository_owner == 'SciQLop'
134+
steps:
135+
- uses: actions/download-artifact@v4
136+
with:
137+
pattern: cibw-*
138+
path: dist
139+
merge-multiple: true
140+
- uses: pypa/gh-action-pypi-publish@release/v1
141+
with:
142+
user: __token__
143+
password: ${{ secrets.PYPI_PASSWORD }}
144+
skip-existing: true
145+
146+
upload_test_pypi:
147+
needs: [build_sdist, build_wheels, test_wheels, test_wheels_macos_14]
148+
runs-on: ubuntu-latest
149+
# upload to test PyPI on github pushes
150+
if: github.event_name == 'push' && github.repository_owner == 'SciQLop'
151+
steps:
152+
- uses: actions/download-artifact@v4
153+
with:
154+
pattern: cibw-*
155+
path: dist
156+
merge-multiple: true
157+
- uses: pypa/gh-action-pypi-publish@release/v1
158+
with:
159+
user: __token__
160+
password: ${{ secrets.PYPI_TEST_PASSWORD }}
161+
repository-url: https://test.pypi.org/legacy/
162+
skip-existing: true
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Tests Linux with coverage
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
name: build an tests with coverage
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
submodules: true
13+
- name: Install dependencies
14+
run: |
15+
sudo apt update
16+
sudo apt install -y python3-pip lcov g++
17+
pip install --upgrade meson ninja numpy meson-python>=0.14.0 build wheel ddt requests
18+
- name: Configure with meson
19+
run: meson -Db_coverage=true -Dwith_tests=true . build
20+
- name: Build (meson)
21+
run: ninja -C build
22+
- name: Run tests (meson)
23+
run: ninja test -C build
24+
- name: Generate Coverage report
25+
run: |
26+
lcov --capture --directory . --output-file coverage.info
27+
lcov --remove coverage.info '/usr/*' --output-file coverage.info
28+
lcov --remove coverage.info '*/catch.hpp' --output-file coverage.info
29+
lcov --list coverage.info
30+
- name: Upload coverage to Codecov
31+
uses: codecov/codecov-action@v4
32+
with:
33+
token: ${{ secrets.CODECOV_TOKEN }}
34+
file: ./coverage.info
35+
flags: unittests
36+
name: codecov-space-ouija
37+
yml: ./codecov.yml
38+
fail_ci_if_error: true

meson.build

+8-5
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ if get_option('buildtype').contains('debug')
1515
add_project_arguments('-DSPACE_OUIJA_HEDLEY', language : ['cpp'])
1616
endif
1717

18+
cpp = meson.get_compiler('cpp')
19+
if('clang'==cpp.get_id())
20+
add_project_arguments('-fsized-deallocation', language : 'cpp')
21+
endif
1822

1923
pybind11_dep = dependency('pybind11')
2024
hedley_dep = dependency('hedley')
2125
fmt_dep = dependency('fmt')
2226
cpp_utils = dependency('cpp_utils', required : true)
2327

24-
cpp = meson.get_compiler('cpp')
25-
if('clang'==cpp.get_id())
26-
add_global_arguments('-fsized-deallocation', language : 'cpp')
27-
endif
28+
2829

2930
if build_machine.system() == 'windows'
3031
link_args = ['-static-libstdc++','-static-libgcc','-static']
@@ -38,7 +39,9 @@ space_ouija_extra_files = files(
3839
'pyproject.toml',
3940
'README.md',
4041
'.bumpversion.cfg',
41-
'version.txt'
42+
'version.txt',
43+
'.github/workflows/CI.yml',
44+
'.github/workflows/tests-with-coverage.yml'
4245
)
4346

4447
space_ouija_doc_extra_files = files(

subprojects/catch2.wrap

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
[wrap-redirect]
2-
filename = cpp_utils/subprojects/catch2.wrap
1+
[wrap-file]
2+
directory = Catch2-3.7.1
3+
source_url = https://github.com/catchorg/Catch2/archive/v3.7.1.tar.gz
4+
source_filename = Catch2-3.7.1.tar.gz
5+
source_hash = c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c
6+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/catch2_3.7.1-1/Catch2-3.7.1.tar.gz
7+
wrapdb_version = 3.7.1-1
8+
9+
[provide]
10+
catch2 = catch2_dep
11+
catch2-with-main = catch2_with_main_dep

0 commit comments

Comments
 (0)