Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,3 @@ comment:
require_base: false # [true :: must have a base report to post]
require_head: false # [true :: must have a head report to post]
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]

# SCons compiles copies of the sources in build/coverage-<arch>/, map them back to src/
fixes:
- "build/coverage-x86_64/::src/"
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/release_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ assignees: ""
- [ ] Locally rendered documentation contains all appropriate pages and other human-written text is up-to-date with any changes in the code.
- [ ] Installation instructions in the README, documentation, and the website are updated.
- [ ] Grammar and writing quality are checked (no typos).
- [ ] Review `FALLBACK_VERSION` in `site_scons/fallback_version.py` for builds without a resolvable release tag.
- [ ] `scons test` passes locally with the latest conda-forge compilers and dependencies.
- [ ] Review `LIBDIFFPY_FALLBACK_VERSION` in `cmake/FallbackVersion.cmake` for builds without a resolvable release tag.
- [ ] The unit tests pass locally (`cmake --preset debug`, `cmake --build --preset debug`, `ctest --preset debug`) with the latest conda-forge compilers and dependencies.
- [ ] Dispatch matrix testing to test the release on all systems. If you do not have permission to run this workflow, tag the maintainer and say `@maintainer, please dispatch matrix testing workflow`. Matrix testing also runs automatically after a GitHub release is published, but it does not block the release, so check that it passes.

Please tag the maintainer (e.g., @username) in the comment here when you are ready for the GitHub release. Include any additional comments necessary, such as version information and details about the pre-release here:
Expand Down
7 changes: 0 additions & 7 deletions .github/actions/setup-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ runs:
shell: bash
run: git fetch --tags https://github.com/diffpy/libdiffpy.git

- name: Check out CxxTest 4.4
uses: actions/checkout@v6
with:
repository: CxxTest/cxxtest
ref: 191adddb3876ab389c0c856e1c03874bf70f8ee4
path: build/cxxtest

- name: Prepare C++ test configuration
shell: python {0}
run: |
Expand Down
35 changes: 2 additions & 33 deletions .github/scripts/configure-tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Configure SCons, CxxTest and the conda environment for CI tests."""
"""Write the conda environment file for the CI tests."""

import json
from pathlib import Path
Expand All @@ -7,7 +7,7 @@
for filename in ("build.txt", "conda.txt", "tests.txt"):
for line in (Path("requirements") / filename).read_text().splitlines():
spec = line.split("#", 1)[0].strip()
if spec and spec != "cxxtest":
if spec:
requirements.append(spec)

Path("build").mkdir(exist_ok=True)
Expand All @@ -22,34 +22,3 @@
)
+ "\n"
)

Path("sconscript.local").write_text("""\
Import('env')
import os
import sys

prefix = os.environ['CONDA_PREFIX']
cxxtest = Dir('#/build/cxxtest').abspath
env.Replace(CXXTEST=os.path.join(cxxtest, 'bin', 'cxxtestgen'),
CXXTEST_INSTALL_DIR=cxxtest, CXXTEST_PYTHON=sys.executable)

if env['PLATFORM'] == 'win32':
from SCons.Platform.win32 import exec_spawn

# The outer CI shell already activates conda and SCons configures MSVC.
# /D stops each compiler/test-generator child from repeating cmd AutoRun.
def spawn_without_autorun(sh, escape, cmd, args, child_env):
return exec_spawn([sh, '/D', '/C', escape(' '.join(args))], child_env)

env['SPAWN'] = spawn_without_autorun
else:
env.Replace(CXX=os.environ.get('CXX', os.path.join(prefix, 'bin', 'c++')))
env.Prepend(CCFLAGS=['-isystem' + os.path.join(prefix, 'include')])
env.Append(LIBPATH=os.path.join(prefix, 'lib'))
env.Append(LINKFLAGS='-Wl,-rpath,' + os.path.join(prefix, 'lib'))
if env['PLATFORM'] == 'darwin':
sdk = os.environ.get('CONDA_BUILD_SYSROOT')
if sdk:
env.Append(CXXFLAGS=['-isysroot', sdk])
env.Append(LINKFLAGS=['-isysroot', sdk])
""")
30 changes: 24 additions & 6 deletions .github/workflows/matrix-and-codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ jobs:
include:
- os: ubuntu-latest
shell: bash -l {0}
build: coverage
build-type: Debug
coverage: "ON"
jobs: 4
- os: windows-latest
shell: cmd /C CALL {0}
build: fast
jobs: 4
- os: macos-latest
shell: bash -l {0}
build: fast
build-type: Release
coverage: "OFF"
jobs: 2
- os: macos-15-intel
shell: bash -l {0}
build: fast
build-type: Release
coverage: "OFF"
jobs: 4
defaults:
run:
Expand All @@ -55,13 +57,29 @@ jobs:
uses: ./.github/actions/setup-tests

- name: Build and run C++ tests
run: scons -j${{ matrix.jobs }} build=${{ matrix.build }} test
if: runner.os != 'Windows'
run: |
cmake -S . -B build/ci -G Ninja $CMAKE_ARGS \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DLIBDIFFPY_COVERAGE=${{ matrix.coverage }} \
-DLIBDIFFPY_BUILD_TESTS=ON
cmake --build build/ci --parallel ${{ matrix.jobs }}
ctest --test-dir build/ci --output-on-failure

# The conda cxx-compiler activation configures MSVC for Ninja in cmd.
- name: Build and run C++ tests (Windows)
if: runner.os == 'Windows'
run: |
where cl.exe || exit /b 1
cmake --preset release -DLIBDIFFPY_BUILD_TESTS=ON || exit /b 1
cmake --build --preset release --parallel ${{ matrix.jobs }} || exit /b 1
ctest --test-dir build\release --output-on-failure --no-tests=error

- name: Generate coverage report
if: runner.os == 'Linux'
run: >-
gcovr --gcov-executable "$CONDA_PREFIX/bin/gcov"
--root . --filter 'build/coverage-.*/diffpy/'
--root . --filter 'src/diffpy/'
--xml coverage.xml

- name: Save coverage report
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ jobs:
- name: Build and run C++ tests with coverage
run: |
"$CONDA_PREFIX/bin/c++" --version
scons -j4 build=coverage test
cmake --preset coverage $CMAKE_ARGS \
-DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu
cmake --build --preset coverage --parallel 4
ctest --preset coverage

- name: Generate coverage report
run: >-
gcovr --gcov-executable "$CONDA_PREFIX/bin/gcov"
--root . --filter 'build/coverage-.*/diffpy/'
--root . --filter 'src/diffpy/'
--xml coverage.xml

- name: Upload coverage to Codecov
Expand Down
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ __pycache__/
*.la
*.a

# SCons build files
.sconf_temp/
.sconsign.dblite
/sconscript.local
/sconsvars.py
# CMake user settings
/CMakeUserPresets.json
.gdb_history
tags

Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ ci:
autoupdate_schedule: monthly
skip: [no-commit-to-branch]
submodules: false
# Leave the vendored CxxTest SCons tool and the data tables untouched.
# Leave the data tables untouched.
exclude: |
(?x)^(
site_scons/site_tools/cxxtest\.py|
.*\.(cif|dat)
)$
repos:
Expand Down
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ build:
os: "ubuntu-22.04"
tools:
python: "latest"
# cmake resolves the documentation version from git tags.
apt_packages:
- cmake

python:
install:
Expand Down
Loading
Loading