Skip to content

Commit 8562d21

Browse files
Merge pull request #83 from easyscience/develop
New release
2 parents 5d3c188 + 28c73fe commit 8562d21

36 files changed

+18673
-556
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/build-docs.yml

Lines changed: 49 additions & 77 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]
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*'
@@ -18,20 +18,24 @@ concurrency:
1818
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1919
cancel-in-progress: true
2020

21+
# Set the environment variables to be used in all jobs defined in this workflow
2122
env:
22-
# Set the environment variables to be used in all jobs defined in this workflow
23-
# Set the CI_BRANCH environment variable to be the branch name
24-
# Set the NOTEBOOKS_DIR environment variable to be the directory containing the Jupyter notebooks
23+
# CI_BRANCH - the branch name (used in mkdocs.yml)
24+
# GITHUB_REPOSITORY - the repository name (used in mkdocs.yml)
25+
# NOTEBOOKS_DIR - the directory containing the Jupyter notebooks (used in mkdocs.yml)
2526
CI_BRANCH: ${{ github.head_ref || github.ref_name }}
27+
GITHUB_REPOSITORY: ${{ github.repository }}
2628
NOTEBOOKS_DIR: tutorials
29+
DEV_DEPLOYMENT_URL:
30+
https://easyscience.github.io/${{ github.event.repository.name }}
31+
PROD_DEPLOYMENT_URL: https://docs.easydiffraction.org/lib
2732

2833
jobs:
2934
# Job 1: Build the static files for the documentation site
3035
build-docs:
3136
strategy:
3237
matrix:
3338
os: [macos-14] # Use macOS to switch to dark mode for Plotly charts
34-
python-version: ['3.13']
3539

3640
runs-on: ${{ matrix.os }}
3741

@@ -49,10 +53,6 @@ jobs:
4953
git fetch --tags --force
5054
echo "RELEASE_VERSION=$(git describe --tags --abbrev=0)" >> "$GITHUB_ENV"
5155
52-
# Without this step, GITHUB_REPOSITORY is not accessible from mkdocs.yml
53-
- name: Set GITHUB_REPOSITORY env variable
54-
run: echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" >> "$GITHUB_ENV"
55-
5656
# Activate dark mode to create documentation with Plotly charts in dark mode
5757
# Need a better solution to automatically switch the chart colour theme based on the mkdocs material switcher
5858
# Something similar to mkdocs_plotly_plugin https://haoda-li.github.io/mkdocs-plotly-plugin/,
@@ -64,85 +64,52 @@ jobs:
6464
# dark-mode on
6565
# dark-mode status
6666

67-
- name: Set up Python ${{ matrix.python-version }}
68-
uses: actions/setup-python@v5
67+
- name: Set up pixi
68+
uses: prefix-dev/setup-[email protected]
6969
with:
70-
python-version: ${{ matrix.python-version }}
71-
72-
- name: Upgrade package installer for Python
73-
shell: bash
74-
run: python -m pip install --upgrade pip
70+
environments: >-
71+
py313-docs
72+
activate-environment: py313-docs
73+
run-install: true
74+
frozen: true
75+
cache: false
76+
post-cleanup: false
7577

76-
# Install EasyDiffraction Library to run Jupyter notebooks
77-
# Install with the 'docs' and 'visualization' extras
78-
- name: Install EasyDiffraction Library and its dependencies
79-
run: python -m pip install .'[dev,docs,visualization]'
80-
81-
# Clone assets extra from:
82-
# - easyscience/assets-docs
83-
# - easyscience/assets-branding
8478
- name: Clone easyscience/assets-docs and easyscience/assets-branding
8579
run: |
8680
cd ..
8781
git clone https://github.com/easyscience/assets-docs.git
8882
git clone https://github.com/easyscience/assets-branding.git
8983
90-
# Add the extra files from the easyscience/assets-docs repository
91-
- name: Add files from easyscience/assets-docs files
92-
run: |
93-
cp -R ../assets-docs/docs/assets/ docs/assets/
94-
cp -R ../assets-docs/includes/ includes/
95-
cp -R ../assets-docs/overrides/ overrides/
96-
97-
# Add the extra files from the easyscience/assets-branding repository
98-
- name: Add files from easyscience/assets-branding files
99-
run: |
100-
mkdir -p docs/assets/images/
101-
cp ../assets-branding/easydiffraction/hero/dark.png docs/assets/images/hero_dark.png
102-
cp ../assets-branding/easydiffraction/hero/light.png docs/assets/images/hero_light.png
103-
cp ../assets-branding/easydiffraction/logos/dark.svg docs/assets/images/logo_dark.svg
104-
cp ../assets-branding/easydiffraction/logos/light.svg docs/assets/images/logo_light.svg
105-
cp ../assets-branding/easydiffraction/icons/color.png docs/assets/images/favicon.png
106-
mkdir -p overrides/.icons/
107-
cp ../assets-branding/easydiffraction/icons/bw.svg overrides/.icons/easydiffraction.svg
108-
cp ../assets-branding/easyscience-org/icons/eso-icon_bw.svg overrides/.icons/easyscience.svg
84+
- name: Add files from cloned repositories
85+
run: pixi run docs-assets
10986

11087
# Convert python scripts in the notebooks directory to Jupyter notebooks
111-
# Strip output from the notebooks, simpify cell ids and replace '# !pip' with '!pip'
112-
# The notebooks are used to generate the documentation
113-
- name:
114-
Convert ${{ env.NOTEBOOKS_DIR }}/*.py to docs/${{env.NOTEBOOKS_DIR
115-
}}/*.ipynb
116-
run: |
117-
cp -R ${{ env.NOTEBOOKS_DIR }}/data docs/${{ env.NOTEBOOKS_DIR }}/
118-
jupytext ${{ env.NOTEBOOKS_DIR }}/*.py --from py:percent --to ipynb
119-
nbstripout ${{ env.NOTEBOOKS_DIR }}/*.ipynb
120-
python tools/prepare_notebooks.py ${{ env.NOTEBOOKS_DIR }}/
121-
mv ${{ env.NOTEBOOKS_DIR }}/*.ipynb docs/${{ env.NOTEBOOKS_DIR }}/
122-
123-
# The following step is needed to avoid the following message during the build:
124-
# "Matplotlib is building the font cache; this may take a moment"
125-
- name: Pre-build site step
126-
run: |
127-
export PYTHONPATH="$(pwd)/src${PYTHONPATH:+:$PYTHONPATH}"
128-
python -c "import easydiffraction"
88+
# Strip output from the notebooks
89+
# Prepare the notebooks for documentation (add colab cell, etc.)
90+
# Run the notebooks to generate the output cells using multiple cores
91+
# The notebooks are then used to build the documentation site
92+
- name: Convert tutorial scripts to notebooks
93+
run: pixi run notebook-prepare
94+
95+
- name: Run notebooks
96+
run: pixi run notebook-exec
97+
98+
- name: Move notebooks to docs/tutorials
99+
run: pixi run docs-notebooks
129100

130101
# Create the mkdocs.yml configuration file
131102
# The file is created by merging two files:
132103
# - assets-docs/mkdocs.yml - the common configuration (theme, plugins, etc.)
133104
# - docs/mkdocs.yml - the project-specific configuration (project name, TOC, etc.)
134105
- name: Create mkdocs.yml file
135-
run: python tools/create_mkdocs-yml.py
106+
run: pixi run docs-config
136107

137108
# Build the static files
138109
# Input: docs/ directory containing the Markdown files
139110
# Output: site/ directory containing the generated HTML files
140111
- name: Build site with MkDocs
141-
run: |
142-
export JUPYTER_PLATFORM_DIRS=1
143-
export PYTHONWARNINGS="ignore::RuntimeWarning"
144-
export PYTHONPATH="$(pwd)/src${PYTHONPATH:+:$PYTHONPATH}"
145-
mkdocs build
112+
run: pixi run docs-build
146113

147114
# Set up the Pages action to configure the static files to be deployed
148115
# NOTE: The repository must have GitHub Pages enabled and configured to build using GitHub Actions
@@ -155,17 +122,15 @@ jobs:
155122
# This artifact is named github-pages and is a single gzip archive containing a single tar file
156123
# The artifact is then used in the next job by actions/deploy-pages to deploy the static files to GitHub Pages
157124
# Unfortunately, the artifact is not available for download, so extra steps below are needed to do similar things
158-
- name:
159-
Upload built site as artifact for easyscience.github.io/${{
160-
github.event.repository.name }} (all branches)
125+
- name: Upload built site as artifact for DEV deployment (all branches)
161126
uses: actions/upload-pages-artifact@v3
162127
with:
163128
path: site/
164129

165130
# Upload the static files from the site/ directory to be used in the next job
166131
# This artifact is only uploaded on tagged releases (tags starting with 'v', e.g., v1.0.3)
167132
# and is used to push content to gh_pages for custom domain deployment.
168-
- name: Upload built site as artifact for gh_pages (tagged release)
133+
- name: Upload built site as artifact for PROD deployment (tagged release)
169134
if: startsWith(github.ref, 'refs/tags/v')
170135
uses: actions/upload-artifact@v4
171136
with:
@@ -203,11 +168,14 @@ jobs:
203168
# restrictions on the branch name need to be set for desired branches on
204169
# https://github.com/easyscience/diffraction-lib/settings/environments
205170
# Deployed pages are available at https://easyscience.github.io/diffraction-lib
206-
- name:
207-
Deploy to easyscience.github.io/${{ github.event.repository.name }}
208-
(all branches)
171+
- name: DEV deployment (all branches)
209172
uses: actions/deploy-pages@v4
210173

174+
- name: Show DEV deployment url (all branches)
175+
run:
176+
echo "🔗 DEV deployment url [${{ env.DEV_DEPLOYMENT_URL }}](${{
177+
env.DEV_DEPLOYMENT_URL }})" >> $GITHUB_STEP_SUMMARY
178+
211179
# Download built site as artifact from a previous job for gh_pages (tagged release)
212180
# This artifact is only downloaded on tagged releases (tags starting with 'v', e.g., v1.0.3)
213181
# and is used to push content to gh_pages for custom domain deployment.
@@ -228,13 +196,17 @@ jobs:
228196
# Then the gh_pages branch is used to deploy the site to the custom domain.
229197
# Deploying is done with a webhook added via:
230198
# https://github.com/easyscience/diffraction-lib/settings/hooks
231-
- name:
232-
Deploy to gh_pages branch to trigger deployment to custom domain
233-
(tagged release)
199+
- name: PROD deployment to gh_pages for custom domain (tagged release)
234200
if: startsWith(github.ref, 'refs/tags/v')
235201
uses: s0/git-publish-subdir-action@develop
236202
env:
237203
GITHUB_TOKEN: ${{ secrets.GH_API_PERSONAL_ACCSESS_TOKEN }}
238204
REPO: self
239205
BRANCH: gh_pages
240206
FOLDER: site
207+
208+
- name: Show PROD deployment url (tagged release)
209+
if: startsWith(github.ref, 'refs/tags/v')
210+
run:
211+
echo "🔗 PROD deployment url [${{ env.PROD_DEPLOYMENT_URL }}](${{
212+
env.PROD_DEPLOYMENT_URL }})" >> $GITHUB_STEP_SUMMARY

.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/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Upgrade package installer for Python
3030
run: pip install --upgrade pip
3131

32-
- name: Install build frontend
32+
- name: Install build tool
3333
run: pip install --upgrade build
3434

3535
- name: Create Python package

0 commit comments

Comments
 (0)