Skip to content

Commit

Permalink
refactor actions
Browse files Browse the repository at this point in the history
  • Loading branch information
d-chambers committed Jan 3, 2025
1 parent 084f21f commit 3b72e9c
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 210 deletions.
20 changes: 20 additions & 0 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Build DASCore Docs"
description: "Builds DASCore's Documentation."

runs:
using: "composite"
steps:
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.3.450
tinytex: true

- name: print quarto version
run: |
quarto --version
- name: render API docs
shell: bash -l {0}
run: |
python scripts/build_api_docs.py
68 changes: 68 additions & 0 deletions .github/actions/mamba-install-dascore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "Mamba Install"
description: "Sets up mamba before installing DASCore's environment.yml file."
inputs:
python-version:
description: "The python string of the version to install"
required: true

environment-file:
description: "The path to the environment file to use."
required: false
default: "environment.yml"

runs:
using: "composite"
steps:
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '2.0.5-0' # versions: https://github.com/mamba-org/micromamba-releases
environment-file: ${{ inputs.environment-file }}
init-shell: >-
bash
powershell
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
post-cleanup: 'all'
create-args: >-
python=${{ inputs.python-version }}
# Not sure why this is needed but it appears to be the case
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore
- name: print python version
shell: bash -el {0}
run: |
python --version
- name: get tags for correct versioning
run: |
git fetch --tags --force
- name: install dascore
shell: bash -l {0}
run: |
pip install -e .[dev]
- name: set data cache path
shell: bash -el {0}
run: |
echo "DATA_CACHE_PATH=$(python -c "import pooch; print(pooch.os_cache('dascore'))")" >> $GITHUB_ENV
- name: cache test data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
path: ${{ env.DATA_CACHE_PATH }}
key: DATA_${{ env.CACHE_NUMBER }}

# Print out the package info for current environment
- name: print package info
shell: bash -el {0}
run: |
micromamba info
micromamba list
67 changes: 67 additions & 0 deletions .github/actions/min-deps-install-dascore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "Min Dep Install"
description: "Sets up mamba just for install pytables/hdf5 then install dascore with uv"
inputs:
python-version:
description: "The python string of the version to install"
required: true

runs:
using: "composite"
steps:
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '2.0.5-0' # versions: https://github.com/mamba-org/micromamba-releases
init-shell: >-
bash
powershell
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
post-cleanup: 'all'
create-args: >-
python=${{ inputs.python-version }}
# Not sure why this is needed but it appears to be the case
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore
- name: print python version
shell: bash -el {0}
run: |
python --version
- name: get tags for correct versioning
run: |
git fetch --tags --force
- name: install pytables/hdf5
shell: bash -l {0}
run: |
micromamba install pytables
- name: install dascore
shell: bash -l {0}
run: |
pip install -e .[dev]
- name: set data cache path
shell: bash -el {0}
run: |
echo "DATA_CACHE_PATH=$(python -c "import pooch; print(pooch.os_cache('dascore'))")" >> $GITHUB_ENV
- name: cache test data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
path: ${{ env.DATA_CACHE_PATH }}
key: DATA_${{ env.CACHE_NUMBER }}

# Print out the package info for current environment
- name: print package info
shell: bash -el {0}
run: |
micromamba info
micromamba list
46 changes: 5 additions & 41 deletions .github/workflows/build_deploy_master_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,50 +34,14 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: "true"

- name: "get tags"
run: |
git fetch --tags --force # Retrieve annotated tags.
- uses: mamba-org/setup-micromamba@v1
- uses: ./.github/actions/mamba-install-dascore
with:
micromamba-version: '1.5.8-0' # versions: https://github.com/mamba-org/micromamba-releases
environment-file: ./.github/doc_environment.yml
init-shell: >-
bash
powershell
cache-environment: true
post-cleanup: 'all'

# Not sure why this is needed but it appears to be the case
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore
- name: install dascore with docbuild reqs
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install -e .[docs,all]
python-version: "3.12"
environment-file: '././github/doc_environment.yml'

- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.3.450
tinytex: true

- name: print quarto version
run: |
quarto --version
- name: render API docs
shell: bash -l {0}
run: |
python scripts/build_api_docs.py
- uses: ./.github/actions/build-docs

- name: publish docs to netlify
shell: bash -l {0}
Expand Down
51 changes: 5 additions & 46 deletions .github/workflows/build_deploy_stable_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,14 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: "true"

- name: "get tags"
run: |
git fetch --tags --force # Retrieve annotated tags.
- name: Get tags
run: git fetch --tags origin

- uses: mamba-org/setup-micromamba@v2
- uses: ./.github/actions/mamba-install-dascore
with:
micromamba-version: '2.0.2-1' # versions: https://github.com/mamba-org/micromamba-releases
environment-file: ./.github/doc_environment.yml
init-shell: >-
bash
powershell
cache-environment: true
post-cleanup: 'all'
cache-environment-key: environment-${{ steps.date.outputs.date }}

# Not sure why this is needed but it appears to be the case
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore
- name: install dascore with docbuild reqs
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install -e .[docs,all]
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.3.450
tinytex: true

- name: print quarto version
run: |
quarto --version
python-version: "3.12"
environment-file: '././github/doc_environment.yml'

- name: Render Quarto Project
shell: bash -l {0}
run: |
python scripts/build_api_docs.py
quarto render docs
- uses: ./.github/actions/build-docs

- name: Setup Pages
uses: actions/configure-pages@v2
Expand Down
27 changes: 2 additions & 25 deletions .github/workflows/get_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: "get tags"
run: |
git fetch --tags --force # Retrieve annotated tags.
- uses: mamba-org/setup-micromamba@v1
- uses: ./.github/actions/min-deps-install-dascore
with:
micromamba-version: '1.5.8-0' # versions: https://github.com/mamba-org/micromamba-releases
environment-file: environment.yml
init-shell: >-
bash
powershell
cache-environment: true
post-cleanup: 'all'

# Not sure why this is needed but it appears to be the case
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore
- name: install dascore
shell: bash -l {0}
run: |
python -m pip install -e .[test]
python-version: ${{ matrix.python-version }}

- name: run test suite
shell: bash -l {0}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: "get tags"
run: |
git fetch --tags --force # Retrieve annotated tags.
with:
fetch-tags: 'true'

- name: Install uv
uses: astral-sh/setup-uv@v3
Expand Down
46 changes: 3 additions & 43 deletions .github/workflows/run_min_dep_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,56 +42,16 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
depth: 0
fetch-tags: 'true'

- name: "get tags"
run: |
git fetch --tags --force # Retrieve annotated tags.
- uses: mamba-org/setup-micromamba@v2
- uses: ./.github/actions/min-deps-install-dascore
with:
micromamba-version: '2.0.2-1' # versions: https://github.com/mamba-org/micromamba-releases
environment-file: environment.yml
init-shell: >-
bash
powershell
cache-environment: true
cache-environment-key: environment-${{ steps.date.outputs.date }}
post-cleanup: 'all'
create-args: >-
python=${{ matrix.python-version }}
# Not sure why this is needed but it appears to be the case.
# Also installs pytables so hdf5 gets installed on windows
- name: fix env
shell: bash -l {0}
run: |
micromamba shell init --shell bash --root-prefix=~/micromamba
eval "$(micromamba shell hook --shell bash)"
micromamba activate dascore
- name: install hdf5
shell: bash -l {0}
run: |
micromamba install pytables
python-version: ${{ matrix.python-version }}

# Then switch over to uv. We can use this exclusively once we drop pytables.
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: set data cache path
shell: bash -l {0}
run: |
export PATH="$pythonLocation:$PATH"
echo "DATA_CACHE_PATH=$(uv run --extra test python -c "import pooch; print(pooch.os_cache('dascore'))")" >> $GITHUB_ENV
- name: cache test data
uses: actions/cache@v3
with:
enableCrossOsArchive: true
path: ${{ env.DATA_CACHE_PATH }}
key: DATA_${{ env.CACHE_NUMBER }}

- name: run test suite
shell: bash -l {0}
run: uv run --extra test --python ${{ matrix.python-version }} pytest -s --cov dascore --cov-append --cov-report=xml
Expand Down
Loading

0 comments on commit 3b72e9c

Please sign in to comment.