Skip to content

Commit 646ab84

Browse files
committed
test ci workflow action
1 parent 7d0ae52 commit 646ab84

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI Build & Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
env:
15+
# Make sure parallel builds use all available cores
16+
NUM_CORES: ${{ runner.ncpu }}
17+
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v3
21+
22+
# ---------------------------
23+
# Part 1: C++ Build & CTest
24+
# ---------------------------
25+
26+
- name: Install C++ build dependencies
27+
run: |
28+
sudo apt-get update -y
29+
sudo apt-get install -y build-essential cmake git python3-dev python3-pip
30+
31+
- name: Configure and build C++ code
32+
working-directory: ${{ github.workspace }}
33+
run: |
34+
mkdir -p build
35+
cd build
36+
cmake .. -DCMAKE_BUILD_TYPE=Release
37+
cmake --build . --parallel "${NUM_CORES}"
38+
39+
- name: Run C++ unit tests with CTest
40+
working-directory: ${{ github.workspace }}/build
41+
run: |
42+
ctest --output-on-failure
43+
44+
# -----------------------------
45+
# Part 2: Python install & tests
46+
# -----------------------------
47+
48+
- name: Set up Python 3.10
49+
uses: actions/setup-python@v4
50+
with:
51+
python-version: "3.10"
52+
53+
- name: Create & activate virtualenv
54+
run: |
55+
python -m venv venv
56+
source venv/bin/activate
57+
python -m pip install --upgrade pip setuptools scikit-build pytest
58+
59+
- name: Install package (C++ + Python wrapper) via pip
60+
working-directory: ${{ github.workspace }}
61+
run: |
62+
source venv/bin/activate
63+
pip install .
64+
65+
- name: Run Python unit tests
66+
working-directory: ${{ github.workspace }}
67+
run: |
68+
source venv/bin/activate
69+
pytest -q

0 commit comments

Comments
 (0)