Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(github-actions)🔧: Update deployment workflow to use setup-pixi action #443

Merged
merged 19 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f306d3d
ci(github-actions)🔧: Update deployment workflow to use setup-pixi action
ericmjl Feb 23, 2025
fab0c2f
chore(ci)🗑️: Remove unused conda environment caching and building ste…
ericmjl Feb 23, 2025
79df082
chore(ci)🔧: Update deployment workflow to use pixi for website build
ericmjl Feb 23, 2025
200e629
Update pixi lockfile.
ericmjl Mar 4, 2025
f03ece8
chore(ci)🛠️: Comment out Leanpub deployment steps and remove website …
ericmjl Mar 4, 2025
cd66264
refactor(CI workflows)🔄: Consolidate and streamline GitHub Actions wo…
ericmjl Mar 4, 2025
e42245d
ci(workflows)🔧: Update deployment workflow and add linting workflow
ericmjl Mar 4, 2025
a9df87b
ci(workflow)🔧: Restrict linting workflow to master branch
ericmjl Mar 4, 2025
6639250
chore(ci)🔧: Update deployment workflow to use the 'build-docs' command.
ericmjl Mar 4, 2025
9dc7c28
chore(ci)🔧: Add kernel installation step to deployment workflow
ericmjl Mar 4, 2025
ae27d3f
Update pixi lockfile.
ericmjl Mar 4, 2025
789f7b1
chore(notebooks)🛠️: Update kernel specification in Jupyter notebook
ericmjl Mar 4, 2025
08ce2c8
chore(pre-commit)🔧: Update nbstripout hook version in pre-commit conf…
ericmjl Mar 4, 2025
cc75236
chore(pre-commit)🔧: Update pre-commit hooks to their latest versions
ericmjl Mar 4, 2025
ac5e2ed
style(builder_lib)🧹: Add a blank line for improved code readability.
ericmjl Mar 4, 2025
7aec41a
style(notebooks)🧹: Remove extraneous blank lines and update Python ve…
ericmjl Mar 4, 2025
4eb1099
fix(notebooks)🛠️: Corrected minor issues in the Jupyter notebook for …
ericmjl Mar 4, 2025
8964c62
style(notebooks)🎨: Refactor code style in Jupyter notebooks for consi…
ericmjl Mar 4, 2025
817a2df
ci(github-actions)🔄: Add PR preview deployment step to GitHub Actions…
ericmjl Mar 4, 2025
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
139 changes: 0 additions & 139 deletions .github/workflows/check.yaml

This file was deleted.

122 changes: 46 additions & 76 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,28 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-environment:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

# See: https://github.com/marketplace/actions/setup-conda
- uses: s-weigand/setup-conda@v1
with:
conda-channels: "conda-forge"

# Build cache of environment
- name: Cache conda environment
id: cache-environment
uses: actions/cache@v3
# Conda environment build step depends on two files,
# so we ensure that the hash key contains both their hashes.
with:
path: |
nams.tar.gz
key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ hashFiles('scripts/ci/build_environment.sh') }}-env

- name: Build environment
if: steps.cache-environment.outputs.cache-hit != 'true'
run: bash scripts/ci/build_environment.sh

# See: https://github.com/actions/upload-artifact
- name: Upload environment
uses: actions/upload-artifact@v3
with:
name: nams-tarball
path: nams.tar.gz

build-deploy-website:
runs-on: ubuntu-22.04
needs: build-environment
build-and-deploy-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v3
- uses: prefix-dev/[email protected]
with:
name: nams-tarball

- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh
pixi-version: v0.41.4
cache: true

- name: Build website
run: |
bash scripts/ci/build_website.sh
pixi run python -m ipykernel install --user --name nams
pixi run build-docs

- name: Deploy Website
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
Expand All @@ -76,37 +44,39 @@ jobs:
enable_jekyll: false
disable_nojekyll: false

build-deploy-leanpub:
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v3

- name: Download environment tarball
uses: actions/download-artifact@v3
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
if: github.event_name == 'pull_request'
with:
name: nams-tarball

- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh

- name: Build leanpub manuscript files
run: |
bash scripts/ci/build_leanpub.sh

- name: Deploy Leanpub
uses: peaceiris/actions-gh-pages@v3
with:
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
personal_token: ${{ secrets.GHPAGES_TOKEN }}
publish_dir: ./manuscript
publish_branch: leanpub
destination_dir: manuscript
allow_empty_commit: false
keep_files: false
force_orphan: true
enable_jekyll: false
disable_nojekyll: false

- name: Trigger publish on LeanPub
run: curl -d "api_key=${{ secrets.LEANPUB_API_KEY }}" https://leanpub.com/nams/publish.json
source-dir: ./site


# - name: Download environment tarball
# uses: actions/download-artifact@v3
# with:
# name: nams-tarball

# - name: Unpack environment and activate it
# run: bash scripts/ci/unpack_environment.sh

# - name: Build leanpub manuscript files
# run: |
# bash scripts/ci/build_leanpub.sh

# - name: Deploy Leanpub
# uses: peaceiris/actions-gh-pages@v3
# with:
# # https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
# personal_token: ${{ secrets.GHPAGES_TOKEN }}
# publish_dir: ./manuscript
# publish_branch: leanpub
# destination_dir: manuscript
# allow_empty_commit: false
# keep_files: false
# force_orphan: true
# enable_jekyll: false
# disable_nojekyll: false

# - name: Trigger publish on LeanPub
# run: curl -d "api_key=${{ secrets.LEANPUB_API_KEY }}" https://leanpub.com/nams/publish.json
25 changes: 25 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Code style checks

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.11

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.41.4
cache: true

- uses: pre-commit/[email protected]
9 changes: 2 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
files: ".ipynb"
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
Expand Down
1 change: 1 addition & 0 deletions nams/builder_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This module exists because I saw common usable functions
across both the LeanPub and MkDocs build steps.
"""

import nbformat
from nbconvert import MarkdownExporter, PDFExporter
from nbconvert.preprocessors import ExecutePreprocessor
Expand Down
4 changes: 2 additions & 2 deletions notebooks/02-algorithms/01-hubs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "default",
"display_name": "nams",
"language": "python",
"name": "python3"
"name": "nams"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading