Skip to content

Commit

Permalink
Change workflows to mamba, take 2 (#438)
Browse files Browse the repository at this point in the history
* Change workflow to mamba (#429)

* Change workflow to mamba

* Fix GitHub Actions (#434)

* Fix GitHub Actions

* Revert sphinx-multiversion handling

* Get sphinx-multiversion from conda-forge

* Remove redundant dependency installation

* Switch docs workflows to mamba

---------

Co-authored-by: forsyth2 <[email protected]>
  • Loading branch information
xylar and forsyth2 authored Jun 16, 2023
1 parent 7a196b5 commit 184668c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 38 deletions.
50 changes: 31 additions & 19 deletions .github/workflows/build_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: zppy_dev
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
mamba-version: "*"
environment-file: conda/dev.yml
channel-priority: strict
auto-update-conda: true
# IMPORTANT: This needs to be set for caching to work properly!
use-only-tar-bz2: true

- if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }}
name: Show Conda Environment Info
Expand Down Expand Up @@ -98,27 +100,37 @@ jobs:
persist-credentials: false
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
- name: Cache Conda
uses: actions/cache@v3
env:
CACHE_NUMBER: 0
with:
python-version: 3.9
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda/dev.yml') }}

- name: Cache pip
uses: actions/cache@v3
- name: Build Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-publish-docs
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
# Using pip for Sphinx dependencies because it takes too long to reproduce a conda environment (~10 secs vs. 3-4 mins)
- name: Install Dependencies
activate-environment: zppy_dev
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
mamba-version: "*"
environment-file: conda/dev.yml
channel-priority: strict
auto-update-conda: true

- if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }}
name: Show Conda Environment Info
run: |
python -m pip install --upgrade pip
pip install sphinx==5.2.3 sphinx_rtd_theme==1.0.0 sphinx-multiversion==0.2.4 docutils==0.16
conda config --set anaconda_upload no
conda info
conda list
- name: Install `zppy` Package
run: pip install .

- name: Build Sphinx Docs
run: |
cd docs
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/release_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,36 @@ jobs:
persist-credentials: false
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
- name: Cache Conda
uses: actions/cache@v3
env:
CACHE_NUMBER: 0
with:
python-version: 3.9
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('conda/dev.yml') }}

- name: Cache pip
uses: actions/cache@v3
- name: Build Conda Environment
uses: conda-incubator/setup-miniconda@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-publish-docs
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
activate-environment: zppy_dev
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
mamba-version: "*"
environment-file: conda/dev.yml
channel-priority: strict
auto-update-conda: true

# Using pip for Sphinx dependencies because it takes too long to reproduce a conda environment (~10 secs vs. 3-4 mins)
- name: Install Dependencies
- if: ${{ needs.check-jobs-to-skip.outputs.should_skip != 'true' }}
name: Show Conda Environment Info
run: |
python -m pip install --upgrade pip
pip install sphinx==5.2.3 sphinx_rtd_theme==1.0.0 sphinx-multiversion==0.2.4 docutils==0.16
conda config --set anaconda_upload no
conda info
conda list
- name: Install `zppy` Package
run: pip install .

- name: Build Sphinx Docs
run: |
Expand Down
3 changes: 1 addition & 2 deletions conda/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ dependencies:
# If versions are updated, also update in `.github/workflows/build_workflow.yml`
# =================
- sphinx=5.2.3
- sphinx-multiversion=0.2.4
- sphinx_rtd_theme=1.0.0
# Need to pin docutils because 0.17 has a bug with unordered lists
# https://github.com/readthedocs/sphinx_rtd_theme/issues/1115
- docutils=0.16
- pip:
- sphinx-multiversion==0.2.4
prefix: /opt/miniconda3/envs/zppy_dev
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def package_files(directory, prefixes, extensions):
author_email="[email protected], [email protected]",
description="Post-processing software for E3SM",
python_requires=">=3.6",
intall_requires=["configobj>=5.0.0,<6.0.0", "jinja2>=2.0.0"],
packages=find_packages(include=["zppy", "zppy.*"]),
package_data={"": data_files},
entry_points={"console_scripts": ["zppy=zppy.__main__:main"]},
Expand Down

0 comments on commit 184668c

Please sign in to comment.