From 184668cf2bae5ad24ab2c3b4f6f213d2b0bf986b Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 16 Jun 2023 17:56:45 -0600 Subject: [PATCH] Change workflows to mamba, take 2 (#438) * 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 <30700190+forsyth2@users.noreply.github.com> --- .github/workflows/build_workflow.yml | 50 ++++++++++++++++---------- .github/workflows/release_workflow.yml | 41 ++++++++++++--------- conda/dev.yml | 3 +- setup.py | 1 - 4 files changed, 57 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build_workflow.yml b/.github/workflows/build_workflow.yml index 76e6c48a..8b0eb936 100644 --- a/.github/workflows/build_workflow.yml +++ b/.github/workflows/build_workflow.yml @@ -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 @@ -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 diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml index 1102578e..f5108324 100644 --- a/.github/workflows/release_workflow.yml +++ b/.github/workflows/release_workflow.yml @@ -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: | diff --git a/conda/dev.yml b/conda/dev.yml index 883f10e1..565fe235 100644 --- a/conda/dev.yml +++ b/conda/dev.yml @@ -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 diff --git a/setup.py b/setup.py index 897d1c5d..ab2e8686 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,6 @@ def package_files(directory, prefixes, extensions): author_email="forsyth2@llnl.gov, golaz1@llnl.gov", 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"]},