Skip to content

Commit 0452476

Browse files
authored
put test steps with build steps
1 parent b19bbb8 commit 0452476

File tree

1 file changed

+26
-51
lines changed

1 file changed

+26
-51
lines changed

.github/workflows/build_and_test.yml

Lines changed: 26 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
with:
3636
python-version: ${{ matrix.python-version }}
3737

38+
- run: df -h
39+
3840
- name: Install dependencies
3941
run: |
4042
python -m pip install --upgrade pip
@@ -46,18 +48,33 @@ jobs:
4648
echo -e "\n##### Running pip install #####"
4749
pip install -e '.[dev]' --config-settings=cmake.args="-DENABLE_COVERAGE=ON"
4850
49-
- name: Lint with ruff
51+
- name: Test with pytest with coverage enabled
5052
run: |
51-
pip install ruff
52-
ruff check .
53-
ruff format --check .
53+
# Run all tests with coverage (Python and C++)
54+
echo -e "\n##### Running Python tests with coverage #####"
55+
coverage run --source=src/ml_flashpoint --branch -m pytest -v -s
5456
55-
- name: Lint with clang-format
57+
- name: Check Python test coverage
5658
run: |
57-
# Install and run C++ linter
58-
echo -e "\n##### Installing and running clang-format linter #####"
59-
apt-get update && apt-get install -y clang-format
60-
find src -name '*.cpp' -o -name '*.h' | xargs clang-format --dry-run --Werror
59+
# Verify python coverage thresholds
60+
echo -e "\n##### Verifying Python coverage thresholds #####"
61+
coverage report
62+
63+
- name: Check C++ test coverage
64+
run: |
65+
# Run C++ coverage check
66+
echo -e "\n##### Running C++ coverage check #####"
67+
mkdir -p htmlcov/cpp
68+
gcovr --root=. \
69+
--filter=src/ml_flashpoint \
70+
--exclude=".*/_deps/.*" \
71+
--gcov-executable=gcov \
72+
--txt-metric branch \
73+
--html-details htmlcov/cpp/index.html \
74+
--xml-pretty -o cxx-coverage.xml \
75+
--sort uncovered-number \
76+
--gcov-ignore-parse-errors negative_hits.warn \
77+
--gcov-ignore-parse-errors suspicious_hits.warn
6178
6279
lint:
6380
runs-on: ubuntu-latest
@@ -85,45 +102,3 @@ jobs:
85102
echo -e "\n##### Installing and running clang-format linter #####"
86103
apt-get update && apt-get install -y clang-format
87104
find src -name '*.cpp' -o -name '*.h' | xargs clang-format --dry-run --Werror
88-
89-
test:
90-
runs-on: ubuntu-latest
91-
strategy:
92-
matrix:
93-
python-version: [ "3.10" ]
94-
95-
steps:
96-
- uses: actions/checkout@v3
97-
98-
- name: Set up Python ${{ matrix.python-version }}
99-
uses: actions/setup-python@v3
100-
with:
101-
python-version: ${{ matrix.python-version }}
102-
103-
- name: Test with pytest
104-
run: |
105-
# Run all tests with coverage (Python and C++)
106-
echo -e "\n##### Running Python tests with coverage #####"
107-
coverage run --source=src/ml_flashpoint --branch -m pytest -v -s
108-
109-
- name: Check Python test coverage
110-
run: |
111-
# Verify python coverage thresholds
112-
echo -e "\n##### Verifying Python coverage thresholds #####"
113-
coverage report
114-
115-
- name: Check C++ test coverage
116-
run: |
117-
# Run C++ coverage check
118-
echo -e "\n##### Running C++ coverage check #####"
119-
mkdir -p htmlcov/cpp
120-
gcovr --root=. \
121-
--filter=src/ml_flashpoint \
122-
--exclude=".*/_deps/.*" \
123-
--gcov-executable=gcov \
124-
--txt-metric branch \
125-
--html-details htmlcov/cpp/index.html \
126-
--xml-pretty -o cxx-coverage.xml \
127-
--sort uncovered-number \
128-
--gcov-ignore-parse-errors negative_hits.warn \
129-
--gcov-ignore-parse-errors suspicious_hits.warn

0 commit comments

Comments
 (0)