Skip to content

Commit 4b5e228

Browse files
committed
ci: create custom CI workflow for testing on PR
1 parent 3203857 commit 4b5e228

1 file changed

Lines changed: 60 additions & 7 deletions

File tree

‎.github/workflows/tests-on-pr.yml‎

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,63 @@ on:
66

77
jobs:
88
tests-on-pr:
9-
uses: scikit-package/release-scripts/.github/workflows/_tests-on-pr.yml@v0
10-
with:
11-
project: libdiffpy
12-
c_extension: true
13-
headless: false
14-
secrets:
15-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
9+
runs-on: ubuntu-latest
10+
defaults:
11+
run:
12+
shell: bash -l {0}
13+
14+
steps:
15+
- name: Check out libdiffpy
16+
uses: actions/checkout@v6
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Initialize miniconda
21+
uses: conda-incubator/setup-miniconda@v3
22+
with:
23+
activate-environment: test
24+
channels: conda-forge
25+
auto-update-conda: true
26+
auto-activate-base: false
27+
python-version: "3.14" # cxxtest has no Python 3.15 build yet
28+
29+
- name: Conda config
30+
run: >-
31+
conda config --set always_yes yes
32+
--set changeps1 no
33+
34+
- name: Install requirements
35+
run: >-
36+
conda install
37+
--file requirements/build.txt
38+
--file requirements/conda.txt
39+
--file requirements/tests.txt
40+
41+
- name: Configure SCons for the conda environment
42+
run: |
43+
cat > sconscript.local <<'EOF'
44+
Import('env')
45+
import os
46+
prefix = os.environ['CONDA_PREFIX']
47+
env.Replace(CXX=os.environ['CXX'])
48+
env.Prepend(CCFLAGS=['-isystem' + os.path.join(prefix, 'include')])
49+
env.Append(LIBPATH=os.path.join(prefix, 'lib'))
50+
env.Append(LINKFLAGS='-Wl,-rpath,' + os.path.join(prefix, 'lib'))
51+
EOF
52+
53+
- name: Build and run C++ tests with coverage
54+
run: scons build=coverage test
55+
56+
- name: Generate coverage report
57+
run: >-
58+
gcovr --gcov-executable "${CXX%c++}gcov"
59+
--root . --filter 'build/coverage-.*/diffpy/'
60+
--xml coverage.xml
61+
62+
- name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v5
64+
with:
65+
files: coverage.xml
66+
verbose: true
67+
fail_ci_if_error: true
68+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)