Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 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
61 changes: 61 additions & 0 deletions .github/workflows/test-pdf-pack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test PDF Pack Scripts

on:
push:
branches: main
pull_request:
workflow_dispatch:

jobs:
test-conda:
name: conda-${{ matrix.python-version }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.11, 3.12, 3.13] # requires manual update
steps:
- uses: actions/checkout@v4
- name: Set up conda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Install diffpy.cmi
run: |
conda install -y diffpy.cmi
- name: Run diffpy.cmi scripts from docs/examples
shell: bash
run: |
set -e
export MPLBACKEND=Agg
for script in docs/examples/ch*/solutions/diffpy-cmi/*.py; do
python "$script"
done

test-pip:
name: pip-${{ matrix.python-version }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.11, 3.12, 3.13] # requires manual update
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install diffpy.cmi (pip)
run: |
python -m pip install --upgrade pip
pip install diffpy.cmi
- name: Run diffpy.cmi scripts from docs/examples
shell: bash
run: |
set -e
export MPLBACKEND=Agg
for script in docs/examples/ch*/solutions/diffpy-cmi/*.py; do
python "$script"
done
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ __pycache__/
# C extensions
*.so

# ignore any data saved by the diffpy.cmi examples
docs/examples/ch*/solutions/diffpy-cmi/fig/*
docs/examples/ch*/solutions/diffpy-cmi/fit/*
docs/examples/ch*/solutions/diffpy-cmi/res/*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples create these dirs. This prevents any accidental commits of the data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not good. This is precisely what we want to avoid (test-generated junk). How do the examples decide where to write these files? Can you copy the files to tmpdir and then run them?

# Distribution / packaging
.Python
env/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

# If we want to run using multiprocessors, we can switch this to 'True'.
# This requires that the 'psutil' python package installed.
RUN_PARALLEL = True
RUN_PARALLEL = False
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires psutil to be installed or it throws an error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to do this either. Is there a reason not to install psutil? or make it conditional on whether psutil is installed? We don't want to change the behavior of the examples just so the CI will run.



# Functions that will carry out the refinement ##################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ def plot_results(recipe, figname):
diff = g - gcalc + diffzero

mpl.rcParams.update(mpl.rcParamsDefault)
plt.style.use(
str(PWD.parent.parent.parent / "utils" / "billinge.mplstyle")
)

fig, ax1 = plt.subplots(1, 1)

Expand Down
23 changes: 23 additions & 0 deletions news/test-tutorial-CI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Add CI for testing examples of the PDF pack.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
Loading