add dim_reduce to aggregates, refactor patch utils #1110
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run full test suite using conda env and all optional deps. | |
name: TestCode | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
paths: | |
- 'pyproject.toml' | |
- '**.py' | |
- '.github/workflows/*.yml' | |
env: | |
# used to manually trigger cache reset. Just increment if needed. | |
CACHE_NUMBER: 2 | |
# Cancel previous runs when this one starts. | |
concurrency: | |
group: TestCode-${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
# Runs the tests on combinations of the supported python/os matrix. | |
test_code: | |
timeout-minutes: 25 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ['3.10', '3.11', "3.12"] | |
# only run if CI isn't turned off | |
if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no_ci') | |
env: | |
# set conda environment file with dependencies | |
env_file: "environment.yml" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "get tags" | |
run: | | |
git fetch --tags --force # Retrieve annotated tags. | |
- uses: mamba-org/setup-micromamba@v1 | |
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 | |
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 -el {0} | |
run: | | |
python -m pip install -e .[test,all] | |
- 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 | |
# Runs test suite and calculates coverage | |
- name: run test suite | |
shell: bash -el {0} | |
run: ./.github/test_code.sh | |
# Runs examples in docstrings | |
- name: test docstrings | |
shell: bash -el {0} | |
run: ./.github/test_code.sh doctest | |
# Upload coverage files | |
- uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
files: ./coverage.xml | |
flags: unittests | |
name: PR_tests | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# This is a very useful step for debugging, it allows you to ssh into the CI | |
# machine (https://github.com/marketplace/actions/debugging-with-tmate). | |
# | |
#- name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 |