Skip to content

Commit

Permalink
Update environment files and github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinpape committed Jan 4, 2025
1 parent fc76127 commit f50c73d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 53 deletions.
13 changes: 0 additions & 13 deletions .github/doc_env.yaml

This file was deleted.

79 changes: 40 additions & 39 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
name: build_documentation
name: Build and Deploy Docs

# build the documentation for a new release
on:
release:
types: created

# # for debugging
# on: [push, pull_request]
push:
paths:
- "doc/*.md" # Trigger on changes to any markdown file
- "torch_em/**/*.py" # Optionally include changes in Python files
branches:
- main # Run the workflow only on pushes to the main branch
workflow_dispatch:

# security: restrict permissions for CI jobs.
permissions:
contents: read

# NOTE: importing of napari fails with CI and I am not quite sure why
# I tried to adjust it based on the napari CI tests, but that didn't seem to help

# https://github.com/napari/napari/blob/main/.github/workflows/test_comprehensive.yml
jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
name: Build Documentation
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Micromamba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: "latest"
environment-file: environment.yaml
init-shell: bash
cache-environment: true
post-cleanup: 'all'

- name: Install package
shell: bash -l {0}
run: pip install -e .

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: sam
mamba-version: "*"
auto-update-conda: true
environment-file: .github/doc_env.yaml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Install pdoc
shell: bash -l {0}
run: pip install pdoc

- name: Install package
shell: bash -l {0}
run: pip install --no-deps -e .
- name: Generate Documentation
shell: bash -l {0}
run: pdoc synapse_net/ -d google -o doc/

# We use a custom build script for pdoc itself, ideally you just run `pdoc -o docs/ ...` here.
- name: Run pdoc
shell: bash -l {0}
run: python build_doc.py --out
- name: Verify Documentation Output
run: ls -la doc/

- uses: actions/upload-pages-artifact@v1
with:
path: tmp/
- name: Upload Documentation Artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc/

# Deploy the artifact to GitHub pages.
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
deploy:
name: Deploy Documentation
needs: build
runs-on: ubuntu-latest
permissions:
Expand All @@ -61,5 +62,5 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v2
- name: Deploy to GiHub Pages
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment_cpu.yaml
environment-file: environment.yaml
create-args: >-
python=${{ matrix.python-version }}
Expand Down
16 changes: 16 additions & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
channels:
- conda-forge
name:
torch-em-dev
dependencies:
- affogato
- bioimageio.spec
- bioimageio.core
- imagecodecs
- python-elf
- pytorch
- tensorboard
- tifffile
- torchvision
- tqdm
- kornia
3 changes: 3 additions & 0 deletions environment_cpu.yaml → environment_cpu_win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ dependencies:
- bioimageio.core >=0.6.0
- cpuonly
- imagecodecs
# This pin is necessary because later nifty versions have import errors on windows.
- nifty =1.2.1=*_4
- protobuf <5
- python-elf
- pytorch >=2.0
- tensorboard
Expand Down
3 changes: 3 additions & 0 deletions environment_gpu.yaml → environment_gpu_win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ dependencies:
- bioimageio.spec >=0.5.0
- bioimageio.core >=0.6.0
- imagecodecs
# This pin is necessary because later nifty versions have import errors on windows.
- nifty =1.2.1=*_4
- protobuf <5
- python-elf
- pytorch >=2.0
- pytorch-cuda>=11.7 # you may need to update the pytorch version to match your system
Expand Down

0 comments on commit f50c73d

Please sign in to comment.