Skip to content

Commit

Permalink
Merge pull request #695 from zktuong/update-workflow
Browse files Browse the repository at this point in the history
bump to v0.7.5
  • Loading branch information
zktuong authored Jan 5, 2025
2 parents 1bbbcda + c7f539e commit 2c2c114
Show file tree
Hide file tree
Showing 40 changed files with 619 additions and 485 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.4
current_version = 0.7.5
commit = True
tag = True

Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
31 changes: 18 additions & 13 deletions .github/workflows/code-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,35 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5

- name: Install black
run: python -m pip install black

- name: Run black
run: black --config pyproject.toml --check .
- name: Black
uses: psf/black@stable
with:
options: "--config pyproject.toml --check"
src: "."

interrogate:
name: Check interrogate compliance.
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5

- name: Install interrogate
run: python -m pip install interrogate
- name: Interrogate
uses: JackMcKew/python-interrogate-check@main

- name: Run interrogate
run: interrogate .
pre-commit:
name: Check pre-commit compliance.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
27 changes: 10 additions & 17 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,20 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
name: Checkout repository
- name: Checkout repository
uses: actions/checkout@v4

# See: https://github.com/marketplace/actions/setup-miniconda
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
- name: Setup Pixi Environment
uses: prefix-dev/[email protected]
with:
auto-update-conda: true
miniforge-variant: Mambaforge
channels: conda-forge
python-version: 3.9
activate-environment: nxviz
environment-file: environment.yml
use-mamba: true
environments: docs
pixi-version: v0.39.2
cache: false
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

- name: Build environment
- name: Build docs
run: |
conda activate nxviz
python -m ipykernel install --user --name nxviz
python -m pip install .
make docs
pixi run -e docs mkdocs
- name: Deploy website
uses: peaceiris/actions-gh-pages@v3
Expand Down
112 changes: 25 additions & 87 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,41 @@ name: Pull request checks

on: [pull_request]

env:
cache-version: "cache-v2"

jobs:
build-environment:
runs-on: ubuntu-18.04
name: Build conda environment
steps:
- uses: actions/checkout@v2
name: Checkout repository

# See: https://github.com/marketplace/actions/setup-conda
- name: Setup anaconda
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@v2
with:
path: nxviz.tar.gz
# Note: Remember that whatever files the environment build depends on
# should be hashed and added to the key.
key: ${{ runner.os }}-env.${{ hashFiles('environment.yml') }}

- name: Build environment
if: steps.cache-environment.outputs.cache-hit != 'true'
run: |
conda env create -f environment.yml
python -m pip install .
- name: Install conda-pack
if: steps.cache-environment.outputs.cache-hit != 'true'
run: conda install -c conda-forge conda-pack

- name: Run conda-pack
if: steps.cache-environment.outputs.cache-hit != 'true'
run: conda pack -n nxviz -o nxviz.tar.gz

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

unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
needs: build-environment

strategy:
max-parallel: 10
matrix:
environment: [py310, py311, py312, py313]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: Build and test
steps:
- name: Checkout repository
uses: actions/checkout@v2

# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v2
uses: actions/checkout@v4
- name: Setup Pixi Environment
uses: prefix-dev/[email protected]
with:
name: nxviz-tarball

- name: Unpack environment and activate it
run: |
bash scripts/ci/unpack_environment.sh
environments: ${{ matrix.environment }}
pixi-version: v0.39.2
cache: false
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}

- name: Run tests
- name: Test build, unit tests and docs
run: |
source /tmp/nxviz/bin/activate
python -m pip install -e .
pixi run -e ${{ matrix.environment }} test
pixi run -e ${{ matrix.environment }} mkdocs
docs:
name: Build static site docs
runs-on: ubuntu-latest
# https://www.bradmcgonigle.com/blog/github-action-for-continuous-deployment
# - NETLIFY_SITE_ID maps to the netlify site's API ID
# - NETLIFY_AUTH_TOKEN maps to netlify's Personal Access Token that I set on a per-user basis
netlify-deploy:
needs: build-environment

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v2
with:
name: nxviz-tarball

- name: Unpack environment and activate it
run: |
bash scripts/ci/unpack_environment.sh
- name: Build docs
run: |
source /tmp/nxviz/bin/activate
python -m ipykernel install --user --name nxviz
make docs
# https://www.bradmcgonigle.com/blog/github-action-for-continuous-deployment
# - NETLIFY_SITE_ID maps to the netlify site's API ID
# - NETLIFY_AUTH_TOKEN maps to netlify's Personal Access Token that I set on a per-user basis
- name: Deploy to Netlify
uses: netlify/actions/cli@master
with:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ target/
.ipynb_checkpoints
site/
*.md.tmp

# pixi environments
.pixi
*.egg-info
pixi.lock
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.1.0
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
- id: black
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
- id: nbstripout
7 changes: 2 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ version: 2

mkdocs:
configuration: mkdocs.yml

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: requirements.txt
# python:
# version: 3.12
12 changes: 0 additions & 12 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit 2c2c114

Please sign in to comment.