Skip to content

Commit 28c73fe

Browse files
Standardize Pixi and CI workflow configurations (#82)
* Move tests directory inside the package structure * Update PyPI install command * Update workflow to trigger only on the master branch * Fix default values in delete-old-runs workflow to be strings * Update build-docs workflow to restrict branch triggers and adjust Pixi version * Update pixi lock file * Refactor test paths in workflows and update dependencies in pixi.toml files * Remove step to move tests inside the package in the publish to PyPI workflow * Add tests directory to the package distribution * Update test command paths in pixi.toml for consistency * Move pixi-kernel dependency to the pypi-dependencies section in pixi.toml * Reorganize pixi.toml files: move libcblas dependency to target section and ensure pixi-kernel is listed under pypi-dependencies * Refactor pixi.toml: standardize formatting for libcblas dependency * Update pixi.toml * Update test-package-pypi.yaml: enhance download steps for pixi configuration and tests * Remove step to move tests inside the package in the workflow * Fix formatting in test-package-pypi.yaml: adjust line endings for consistency in download steps * Rename test script commands for consistency in pixi.toml and update workflow references in test-tutorials.yaml * Update workflows: change default values to integers in delete-old-runs.yml and streamline curl command in test-package-pypi.yaml * Refactor Pixi commands for consistency across workflows and documentation * Refactor workflow scripts and documentation for consistency * Updates pixi.lock * Removes test __init__.py files * Add SPDX license headers to __main__.py
1 parent 8dc6c64 commit 28c73fe

File tree

28 files changed

+1006
-1122
lines changed

28 files changed

+1006
-1122
lines changed

.github/workflows/build-docs.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
# Trigger the workflow on push
55
push:
66
# Selected branches
7-
branches: [develop, master, docs, patch, pixi]
7+
branches: [master, develop, docs, patch]
88
# Runs on creating a new tag starting with 'v', e.g. 'v1.0.3'
99
tags:
1010
- 'v*'
@@ -82,39 +82,34 @@ jobs:
8282
git clone https://github.com/easyscience/assets-branding.git
8383
8484
- name: Add files from cloned repositories
85-
run: pixi run add-assets-to-docs
85+
run: pixi run docs-assets
8686

8787
# Convert python scripts in the notebooks directory to Jupyter notebooks
8888
# Strip output from the notebooks
8989
# Prepare the notebooks for documentation (add colab cell, etc.)
9090
# Run the notebooks to generate the output cells using multiple cores
9191
# The notebooks are then used to build the documentation site
9292
- name: Convert tutorial scripts to notebooks
93-
run: pixi run make-notebooks
93+
run: pixi run notebook-prepare
9494

9595
- name: Run notebooks
96-
run: pixi run run-notebooks
96+
run: pixi run notebook-exec
9797

9898
- name: Move notebooks to docs/tutorials
99-
run: pixi run move-notebooks-to-docs
100-
101-
# The following step is needed to avoid the following message during the build:
102-
# "Matplotlib is building the font cache; this may take a moment"
103-
#- name: Pre-build site step
104-
# run: pixi run python -c "import easydiffraction"
99+
run: pixi run docs-notebooks
105100

106101
# Create the mkdocs.yml configuration file
107102
# The file is created by merging two files:
108103
# - assets-docs/mkdocs.yml - the common configuration (theme, plugins, etc.)
109104
# - docs/mkdocs.yml - the project-specific configuration (project name, TOC, etc.)
110105
- name: Create mkdocs.yml file
111-
run: pixi run create-mkdocs-yml
106+
run: pixi run docs-config
112107

113108
# Build the static files
114109
# Input: docs/ directory containing the Markdown files
115110
# Output: site/ directory containing the generated HTML files
116111
- name: Build site with MkDocs
117-
run: pixi run build-docs
112+
run: pixi run docs-build
118113

119114
# Set up the Pages action to configure the static files to be deployed
120115
# NOTE: The repository must have GitHub Pages enabled and configured to build using GitHub Actions

.github/workflows/draft-release-notes.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ name: Update release draft
66
on:
77
# Runs on pushes targeting the default branch (updates the real draft release)
88
push:
9-
branches:
10-
- main
11-
- master
9+
branches: [master]
1210

1311
jobs:
1412
draft-release-notes:

.github/workflows/test-code.yaml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,52 +76,55 @@ jobs:
7676
shell: bash
7777
run: |
7878
pixi run npm config set registry https://registry.npmjs.org/
79-
pixi run install-prettier
79+
pixi run prettier-install
8080
8181
# Check the validity of pyproject.toml
8282
- name: Check validity of pyproject.toml
8383
id: check_pyproject
8484
continue-on-error: true
8585
shell: bash
86-
run: pixi run check-pyproject
86+
run: pixi run pyproject-check
8787

8888
# Check code linting with Ruff in the project root
8989
- name: Check code linting
9090
id: check_code_linting
9191
continue-on-error: true
9292
shell: bash
93-
run: pixi run check-lint-py
93+
run: pixi run py-lint-check
9494

9595
- name: Suggestion to fix code linting issues (*.py files)
9696
if: steps.check_code_linting.outcome == 'failure'
9797
shell: bash
98-
run: echo "In project root run 'pixi run lint-py' and commit changes"
98+
run:
99+
echo "In project root run 'pixi run py-lint-fix' and commit changes"
99100

100101
# Check code formatting with Ruff in the project root
101102
- name: Check code formatting
102103
id: check_code_formatting
103104
continue-on-error: true
104105
shell: bash
105-
run: pixi run check-format-py
106+
run: pixi run py-format-check
106107

107108
- name: Suggestion to fix code formatting issues (*.py files)
108109
if: steps.check_code_formatting.outcome == 'failure'
109110
shell: bash
110-
run: echo "In project root run 'pixi run format-py' and commit changes"
111+
run:
112+
echo "In project root run 'pixi run py-format-fix' and commit changes"
111113

112114
# Check formatting of Markdown, YAML, TOML, etc. files with Prettier in
113115
# the project root
114116
- name: Check formatting of Markdown, YAML, TOML, etc. files
115117
id: check_others_formatting
116118
continue-on-error: true
117119
shell: bash
118-
run: pixi run check-format-non-py
120+
run: pixi run nonpy-format-check
119121

120122
- name: Suggestion to fix non-code formatting issues (*.md, *.yml, etc.)
121123
if: steps.check_others_formatting.outcome == 'failure'
122124
shell: bash
123125
run:
124-
echo "In project root run 'pixi run format-non-py' and commit changes"
126+
echo "In project root run 'pixi run nonpy-format-fix' and commit
127+
changes"
125128

126129
- name: Force fail if any of the previous steps failed
127130
if: |
@@ -185,16 +188,12 @@ jobs:
185188
if: startsWith(github.ref , 'refs/tags/v') != true
186189
run: git tag --delete $(git tag)
187190

188-
- name: Move tests inside the package
189-
shell: bash
190-
run: mv tests/ src/easydiffraction/tests/
191-
192191
- name: Create Python package
193192
shell: bash
194193
run: |
195194
for env in ${{ env.PIXI_ENVS }}; do
196195
echo "🔹🔸🔹🔸🔹 Current env: $env 🔹🔸🔹🔸🔹"
197-
pixi run -e $env build
196+
pixi run -e $env dist-build
198197
env_prefix="${env%%-*}"
199198
echo "📦 Moving built wheel to dist/$env_prefix/"
200199
pixi run mkdir -p dist/$env_prefix
@@ -209,6 +208,7 @@ jobs:
209208
name: edl_${{ matrix.os }}_${{ runner.arch }}
210209
path: |
211210
dist/
211+
tests/
212212
pixi/wheel/pixi.toml
213213
if-no-files-found: 'error'
214214
compression-level: 0
@@ -225,7 +225,6 @@ jobs:
225225
runs-on: ${{ matrix.os }}
226226

227227
env:
228-
PIXI_PROJECT_MANIFEST: 'pixi/wheel/pixi.toml'
229228
PIXI_ENVS: 'py311-wheel py312-wheel py313-wheel'
230229

231230
steps:

.github/workflows/test-package-pypi.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,16 @@ jobs:
3030
cache: false
3131
post-cleanup: false
3232

33-
- name: Download the pixi configuration file for EasyDiffraction
34-
run:
35-
curl -LO
36-
https://raw.githubusercontent.com/easyscience/diffraction-lib/master/pixi/prod/pixi.toml
33+
- name: Download the pixi configuration file from the master branch
34+
run: |
35+
curl -LO https://raw.githubusercontent.com/easyscience/diffraction-lib/master/pixi/prod/pixi.toml
36+
37+
- name: Download the tests from the master branch
38+
run: |
39+
curl -LO https://github.com/easyscience/diffraction-lib/archive/refs/heads/master.zip
40+
unzip master.zip "diffraction-lib-master/tests/*" -d .
41+
mv diffraction-lib-master/tests ./tests
42+
rm -rf master.zip diffraction-lib-master
3743
3844
- name: Create the environment and install dependencies
3945
run: pixi install
@@ -45,10 +51,10 @@ jobs:
4551
run: pixi run func-tests
4652

4753
- name: List the available EasyDiffraction tutorials
48-
run: pixi run list-tutorials
54+
run: pixi run tutorials-list
4955

5056
- name: Fetch the EasyDiffraction tutorials
51-
run: pixi run fetch-tutorials
57+
run: pixi run tutorials-fetch
5258

5359
- name: Test tutorials as notebooks
54-
run: pixi run test-notebooks
60+
run: pixi run notebook-tests

.github/workflows/test-tutorials.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ jobs:
5454

5555
- name: Convert tutorial scripts to notebooks
5656
shell: bash
57-
run: pixi run make-notebooks
57+
run: pixi run notebook-prepare
5858

5959
- name: Check notebooks formatting
6060
id: check_formatting
6161
continue-on-error: true
6262
shell: bash
63-
run: pixi run check-format-notebooks
63+
run: pixi run notebook-format-check
6464

6565
- name: Suggestion to fix notebook formatting
6666
if: steps.check_formatting.outcome == 'failure'
6767
shell: bash
6868
run: |
69-
echo "Run 'pixi run fix-format-notebooks' and commit changes."
69+
echo "Run 'pixi run notebook-format-fix' and commit changes."
7070
exit 1
7171
7272
# Job 2: Test tutorials as Python scripts and Jupyter Notebooks
@@ -97,12 +97,12 @@ jobs:
9797

9898
- name: Test tutorials as python scripts
9999
shell: bash
100-
run: pixi run test-scripts
100+
run: pixi run script-tests
101101

102102
- name: Convert tutorial scripts to notebooks
103103
shell: bash
104-
run: pixi run make-notebooks
104+
run: pixi run notebook-prepare
105105

106106
- name: Test tutorials as notebooks
107107
shell: bash
108-
run: pixi run test-notebooks
108+
run: pixi run notebook-tests

.github/workflows/validate-pixi.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ jobs:
5555

5656
- name: Add PyPI dependencies
5757
run: >
58-
pixi add --pypi "easydiffraction[visualization] @
59-
git+https://github.com/easyscience/diffraction-lib@${{env.CI_BRANCH}}"
58+
pixi add --pypi 'easydiffraction[dev, visualization]' --git
59+
https://github.com/easyscience/diffraction-lib.git --branch ${{
60+
env.CI_BRANCH }}
6061
6162
- name: Add a task to run EasyDiffraction from the command line
6263
run: pixi task add easydiffraction "python -m easydiffraction"

DEVELOPMENT.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This is an example of a workflow that describes the development process.
2626
```
2727
- Install Prettier for non-Python files formatting
2828
```bash
29-
pixi run install-prettier
29+
pixi run prettier-install
3030
```
3131

3232
## Making changes
@@ -61,35 +61,35 @@ This is an example of a workflow that describes the development process.
6161
```
6262
- Test tutorials as python scripts
6363
```bash
64-
pixi run test-scripts
64+
pixi run script-tests
6565
```
6666
- Convert tutorial scripts to notebooks
6767
```bash
68-
pixi run make-notebooks
68+
pixi run notebook-prepare
6969
```
7070
- Test tutorials as notebooks
7171
```bash
72-
pixi run test-notebooks
72+
pixi run notebook-tests
7373
```
7474

7575
## Building and checking documentation with MkDocs
7676

7777
- Move notebooks to docs/tutorials
7878
```bash
79-
pixi run move-notebooks-to-docs
79+
pixi run docs-notebooks
8080
```
8181
- Add extra files to build documentation (from `../assets-docs/` and
8282
`../assets-branding/` directories)
8383
```bash
84-
pixi run add-assets-to-docs
84+
pixi run docs-assets
8585
```
8686
- Create mkdocs.yml file
8787
```bash
88-
pixi run create-mkdocs-yml
88+
pixi run docs-config
8989
```
9090
- Build documentation
9191
```bash
92-
pixi run build-docs
92+
pixi run docs-build
9393
```
9494
- Test the documentation locally (built in the `site/` directory). E.g., on
9595
macOS, open the site in the default browser via the terminal
@@ -98,7 +98,7 @@ This is an example of a workflow that describes the development process.
9898
```
9999
- Clean up after checking documentation
100100
```bash
101-
pixi run cleanup-docs
101+
pixi run docs-clean
102102
```
103103

104104
## Committing and pushing changes

docs/installation-and-setup/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ approach.
217217

218218
=== "curl"
219219
```bash
220-
curl -LO https://raw.githubusercontent.com/easyscience/diffraction-lib/pixi/pixi/prod/pixi.toml
220+
curl -LO https://raw.githubusercontent.com/easyscience/diffraction-lib/master/pixi/prod/pixi.toml
221221
```
222222
=== "wget"
223223
```bash
224-
wget https://raw.githubusercontent.com/easyscience/diffraction-lib/pixi/pixi/prod/pixi.toml
224+
wget https://raw.githubusercontent.com/easyscience/diffraction-lib/master/pixi/prod/pixi.toml
225225
```
226226

227227
- Create the environment defined in `pixi.toml` and install all necessary

0 commit comments

Comments
 (0)