Skip to content

Commit fcb138d

Browse files
Merge pull request #162 from EasyScience/develop
New release
2 parents 4ac161b + 481f0e1 commit fcb138d

File tree

94 files changed

+9833
-1494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+9833
-1494
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
4-
directory: /
5-
schedule:
6-
interval: daily
7-
open-pull-requests-limit: 10
8-
target-branch: develop
9-
labels:
10-
- dependencies
3+
- package-ecosystem: pip
4+
directory: /
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
target-branch: develop
9+
labels:
10+
- dependencies

.github/release-drafter.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
name-template: 'EasyDiffraction $RESOLVED_VERSION'
55
tag-template: 'v$RESOLVED_VERSION'
66
categories:
7-
- title: 'Added'
8-
labels: # Labels to use to categorize a pull request as a feature
9-
- 'enhancement'
10-
- title: 'Fixed'
11-
labels: # Labels to use to categorize a pull request as a bug fix
12-
- 'bug'
13-
- title: 'Changed'
14-
labels: # Labels to use to categorize a pull request as a maintenance task
15-
- 'chore'
16-
- 'documentation'
17-
- 'refactor'
7+
- title: 'Added'
8+
labels: # Labels to use to categorize a pull request as a feature
9+
- 'enhancement'
10+
- title: 'Fixed'
11+
labels: # Labels to use to categorize a pull request as a bug fix
12+
- 'bug'
13+
- title: 'Changed'
14+
labels: # Labels to use to categorize a pull request as a maintenance task
15+
- 'chore'
16+
- 'documentation'
17+
- 'refactor'
1818
change-template: '- $TITLE (#$NUMBER)'
1919
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
2020
version-resolver:

.github/workflows/ci-testing.yaml

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
# This is the main workflow for testing the code, notebooks and package.
2+
# It is divided into three jobs:
3+
# 1. Code-quality:
4+
# - Check the validity of pyproject.toml
5+
# - Check code linting
6+
# - Check code formatting
7+
# - Check Jupyter notebooks formatting
8+
# - Check formatting of Markdown, YAML, TOML, etc. files
9+
# 2. Test-code:
10+
# - Test the code base and upload coverage to Codecov
11+
# - Create the Python package
12+
# - Upload the Python package for the next job
13+
# 3. Test-package:
14+
# - Download the Python package from the previous job
15+
# - Install the downloaded Python package
16+
# - Test the code base
17+
# - Check if Jupiter Notebooks run without errors
18+
19+
name: Test code, notebooks and package
20+
21+
on:
22+
# Trigger the workflow on push
23+
push:
24+
# Every branch
25+
branches:
26+
- '**'
27+
# But do not run this workflow on creating a new tag starting with 'v', e.g. 'v1.0.3' (see pypi-publish.yml)
28+
tags-ignore:
29+
- 'v*'
30+
# Trigger the workflow on pull request
31+
pull_request:
32+
branches:
33+
- '**'
34+
# Allows you to run this workflow manually from the Actions tab
35+
workflow_dispatch:
36+
37+
# Allow only one concurrent workflow, skipping runs queued between the run in-progress and latest queued.
38+
# And cancel in-progress runs.
39+
concurrency:
40+
group:
41+
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
42+
cancel-in-progress: true
43+
44+
jobs:
45+
# Job 1: Check code quality and consistency
46+
code-quality:
47+
strategy:
48+
matrix:
49+
os: [ubuntu-latest]
50+
python-version: ['3.12']
51+
52+
runs-on: ${{ matrix.os }}
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
with:
58+
fetch-depth: '0' # full history with tags to get the version number by versioningit
59+
60+
- name: Set up Python ${{ matrix.python-version }}
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: ${{ matrix.python-version }}
64+
65+
- name: Install Python dependencies
66+
# Install 'validate-pyproject' for checking pyproject.toml
67+
# Install 'ruff' for code linting and formatting
68+
# Install 'nbqa' for quality assurance of Jupyter notebooks
69+
run: pip install 'validate-pyproject[all]' ruff nbqa
70+
71+
- name: Install npm dependencies
72+
# Install 'prettier' for code formatting of Markdown, YAML, etc. files
73+
# Install 'prettier-plugin-toml' plugin for code formatting of TOML files
74+
run: npm install prettier prettier-plugin-toml --save-dev --save-exact
75+
76+
# Check the validity of pyproject.toml
77+
- name: Check validity of pyproject.toml
78+
id: check_pyproject
79+
continue-on-error: true
80+
run: validate-pyproject pyproject.toml
81+
82+
# Check code linting with Ruff in the project root
83+
- name: Check code linting
84+
id: check_code_linting
85+
continue-on-error: true
86+
run: ruff check .
87+
88+
- name: Suggestion to fix code linting issues (for *.py files)
89+
if: steps.check_code_linting.outcome == 'failure'
90+
run:
91+
echo "In project root run 'ruff check . --fix' and commit changes to
92+
fix issues."
93+
94+
# Check code formatting with Ruff in the project root
95+
- name: Check code formatting
96+
id: check_code_formatting
97+
continue-on-error: true
98+
run: ruff format . --check
99+
100+
- name: Suggestion to fix code formatting issues (for *.py files)
101+
if: steps.check_code_formatting.outcome == 'failure'
102+
run:
103+
echo "In project root run 'ruff format .' and commit changes to fix
104+
issues."
105+
106+
# Check Jupyter notebooks with nbQA in the sample directory
107+
- name: Check Jupyter notebooks formatting
108+
id: check_notebooks
109+
continue-on-error: true
110+
run: nbqa ruff examples/
111+
112+
- name: Suggestion to fix notebook formatting issues (for *.ipynb files)
113+
if: steps.check_notebooks.outcome == 'failure'
114+
run:
115+
echo "In project root run 'nbqa ruff examples/ --fix' and commit
116+
changes to fix issues."
117+
118+
# Check formatting of Markdown, YAML, TOML, etc. files with Prettier in the project root
119+
- name: Check formatting of Markdown, YAML, TOML, etc. files
120+
id: check_others_formatting
121+
continue-on-error: true
122+
run: npx prettier . --check --config=prettierrc.toml
123+
124+
- name: Suggestion to fix non-code formatting issues (for *.md, etc.)
125+
if: steps.check_others_formatting.outcome == 'failure'
126+
run:
127+
echo "In project root run 'npx prettier . --write
128+
--config=prettierrc.toml' and commit changes to fix issues."
129+
130+
- name: Force fail if any of the previous steps failed
131+
if: |
132+
steps.check_pyproject.outcome == 'failure' ||
133+
steps.check_code_linting.outcome == 'failure' ||
134+
steps.check_code_formatting.outcome == 'failure' ||
135+
steps.check_notebooks.outcome == 'failure' ||
136+
steps.check_others_formatting.outcome == 'failure'
137+
run: exit 1
138+
139+
# Job 2: Test code and upload coverage to Codecov.
140+
test-code:
141+
needs: code-quality # previous job 'code-quality' need to be finished first
142+
143+
# current job matrix. if modified, remember to UPDATE the strategy in the next job
144+
strategy:
145+
fail-fast: false
146+
matrix:
147+
os: [ubuntu-24.04, windows-2022, macos-13, macos-14]
148+
python-version: ['3.10', '3.11', '3.12']
149+
150+
runs-on: ${{ matrix.os }}
151+
152+
steps:
153+
- name: Checkout repository
154+
uses: actions/checkout@v4
155+
with:
156+
fetch-depth: '0' # full history with tags to get the version number by versioningit
157+
158+
- name: Set up Python ${{ matrix.python-version }}
159+
uses: actions/setup-python@v5
160+
with:
161+
python-version: ${{ matrix.python-version }}
162+
163+
- name: Upgrade package installer for Python
164+
run: python -m pip install --upgrade pip
165+
166+
- name: Install Python dependencies
167+
run: pip install '.[dev,charts]'
168+
169+
- name: Run Python tests and create coverage report
170+
run: >
171+
pytest tests/ --cov=./ --cov-report=xml:coverage/coverage.xml
172+
--junitxml=./coverage/junit.xml --color=yes -n auto
173+
174+
#- name: Upload test results to Codecov
175+
# if: ${{ !cancelled() }}
176+
# uses: codecov/test-results-action@v1
177+
# with:
178+
# files: ./coverage/junit.xml
179+
# fail_ci_if_error: true # optional (default = false)
180+
# name: Pytest results
181+
# token: ${{ secrets.CODECOV_TOKEN }}
182+
183+
#- name: Upload coverage report to Codecov
184+
# uses: codecov/codecov-action@v4
185+
# with:
186+
# files: ./coverage/coverage.xml
187+
# env_vars: OS,PYTHON
188+
# fail_ci_if_error: true # optional (default = false)
189+
# name: Pytest coverage
190+
# token: ${{ secrets.CODECOV_TOKEN }}
191+
# env:
192+
# OS: ${{ matrix.os }}
193+
# PYTHON: ${{ matrix.python-version }}
194+
195+
- name: Create Python package
196+
run: python -m build --wheel --outdir dist
197+
198+
- name:
199+
Upload zipped Python package (with tests and examples) for next job
200+
uses: actions/upload-artifact@v4
201+
with:
202+
name:
203+
EasyDiffractionLib_py${{ matrix.python-version }}_${{ matrix.os
204+
}}_${{ runner.arch }}
205+
path: |
206+
dist/*.whl
207+
tests/
208+
examples/
209+
if-no-files-found: 'error'
210+
compression-level: 0
211+
212+
# Job 3: Test the package
213+
test-package:
214+
needs: test-code # the previous job needs to be finished first
215+
216+
strategy:
217+
fail-fast: false
218+
matrix:
219+
os: [ubuntu-24.04, windows-2022, macos-13, macos-14]
220+
python-version: ['3.10', '3.11', '3.12']
221+
222+
runs-on: ${{ matrix.os }}
223+
224+
steps:
225+
- name: Set up Python ${{ matrix.python-version }}
226+
uses: actions/setup-python@v5
227+
with:
228+
python-version: ${{ matrix.python-version }}
229+
230+
- name: Upgrade package installer for Python
231+
run: python -m pip install --upgrade pip
232+
233+
- name:
234+
Download zipped Python package (with tests and examples) from previous
235+
job
236+
uses: actions/download-artifact@v4
237+
with: # name or path are taken from the upload step of the previous job
238+
name:
239+
EasyDiffractionLib_py${{ matrix.python-version }}_${{ matrix.os
240+
}}_${{ runner.arch }}
241+
path: . # directory to extract downloaded zipped artifacts
242+
243+
# The local version must be higher than the PyPI version for pip to
244+
# prefer the local version. So, after a new release and a new tag,
245+
# remember to merge the master branch with the develop branch,
246+
# and then create a new feature branch from the develop branch.
247+
- name: Install Python package from previous job with 'dev' extras
248+
run: pip install 'easydiffraction[dev]' --find-links=dist
249+
250+
- name: Run Python tests
251+
run: >
252+
pytest tests/ --color=yes -n auto
253+
254+
- name: Check if Jupiter Notebooks run without errors
255+
shell: bash
256+
run: >
257+
pytest --nbmake examples/ --ignore-glob='examples/*emcee*'
258+
--nbmake-timeout=300 --color=yes -n=auto

.github/workflows/delete-old-runs.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ on:
1111

1212
# Allows you to run this workflow manually from the Actions tab
1313
workflow_dispatch:
14-
1514
inputs:
1615
days:
1716
description: 'Number of days.'
@@ -22,26 +21,32 @@ on:
2221
required: true
2322
default: 6
2423
delete_workflow_pattern:
25-
description: 'The name or filename of the workflow. if not set then it will target all workflows.'
24+
description:
25+
'The name or filename of the workflow. if not set then it will target
26+
all workflows.'
2627
required: false
2728
delete_workflow_by_state_pattern:
28-
description: 'Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
29+
description:
30+
'Remove workflow by state: active, deleted, disabled_fork,
31+
disabled_inactivity, disabled_manually'
2932
required: true
30-
default: "All"
33+
default: 'All'
3134
type: choice
3235
options:
33-
- "All"
36+
- 'All'
3437
- active
3538
- deleted
3639
- disabled_inactivity
3740
- disabled_manually
3841
delete_run_by_conclusion_pattern:
39-
description: 'Remove workflow by conclusion: action_required, cancelled, failure, skipped, success'
42+
description:
43+
'Remove workflow by conclusion: action_required, cancelled, failure,
44+
skipped, success'
4045
required: true
41-
default: "All"
46+
default: 'All'
4247
type: choice
4348
options:
44-
- "All"
49+
- 'All'
4550
- action_required
4651
- cancelled
4752
- failure
@@ -53,7 +58,6 @@ on:
5358

5459
jobs:
5560
del-runs:
56-
5761
runs-on: ubuntu-latest
5862

5963
permissions:
@@ -67,7 +71,10 @@ jobs:
6771
repository: ${{ github.repository }}
6872
retain_days: ${{ github.event.inputs.days }}
6973
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
70-
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
71-
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
72-
delete_run_by_conclusion_pattern: ${{ github.event.inputs.delete_run_by_conclusion_pattern }}
74+
delete_workflow_pattern:
75+
${{ github.event.inputs.delete_workflow_pattern }}
76+
delete_workflow_by_state_pattern:
77+
${{ github.event.inputs.delete_workflow_by_state_pattern }}
78+
delete_run_by_conclusion_pattern:
79+
${{ github.event.inputs.delete_run_by_conclusion_pattern }}
7380
dry_run: ${{ github.event.inputs.dry_run }}

0 commit comments

Comments
 (0)