diff --git a/.github/workflows/get_coverage.yml b/.github/workflows/get_coverage.yml index 64f1a17e..3ef1783d 100644 --- a/.github/workflows/get_coverage.yml +++ b/.github/workflows/get_coverage.yml @@ -16,16 +16,23 @@ jobs: run: | git fetch --tags --force # Retrieve annotated tags. - - name: Setup conda - uses: conda-incubator/setup-miniconda@v3 + - uses: mamba-org/setup-micromamba@v1 with: - mamba-version: "*" - channels: conda-forge,defaults - channel-priority: true - python-version: "3.11" - activate-environment: dascore + micromamba-version: '1.5.8-0' # versions: https://github.com/mamba-org/micromamba-releases environment-file: environment.yml - condarc-file: .github/test_condarc.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} diff --git a/.github/workflows/run_min_dep_tests.yml b/.github/workflows/run_min_dep_tests.yml index aa9b95fb..babf2616 100644 --- a/.github/workflows/run_min_dep_tests.yml +++ b/.github/workflows/run_min_dep_tests.yml @@ -38,12 +38,6 @@ jobs: if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no_ci') env: - # set path of test environment for caching - prefix: ${{ startsWith(matrix.os, 'ubuntu') && '/usr/share/miniconda3/envs/dascore' - || startsWith(matrix.os, 'macos') && '/Users/runner/miniconda3/envs/dascore' - || startsWith(matrix.os, 'windows') && 'C:\Miniconda3\envs\dascore' }} - # set individual cache key (only the start of it) - cache_key: ${{ matrix.os }}-py${{ matrix.python-version }} # set conda environment file with dependencies env_file: "environment.yml" @@ -57,18 +51,29 @@ jobs: git fetch --tags --force # Retrieve annotated tags. # Have to use conda to install hdf5 so mac (I guess m1/2) runners work. - - uses: conda-incubator/setup-miniconda@v3 + - uses: mamba-org/setup-micromamba@v1 with: - mamba-version: "*" - channels: conda-forge,defaults - channel-priority: true - python-version: ${{ matrix.python-version }} + 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 hdf5 if: matrix.os=='macos-latest' shell: bash -l {0} run: | - conda install pytables + micromamba install pytables - name: install dascore shell: bash -l {0} diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml index c2cfecdb..4901673f 100644 --- a/.github/workflows/runtests.yml +++ b/.github/workflows/runtests.yml @@ -36,12 +36,6 @@ jobs: if: github.event_name == 'push' || !contains(github.event.pull_request.labels.*.name, 'no_ci') env: - # set path of test environment for caching - prefix: ${{ startsWith(matrix.os, 'ubuntu') && '/usr/share/miniconda3/envs/dascore' - || startsWith(matrix.os, 'macos') && '/Users/runner/miniconda3/envs/dascore' - || startsWith(matrix.os, 'windows') && 'C:\Miniconda3\envs\dascore' }} - # set individual cache key (only the start of it) - cache_key: ${{ matrix.os }}-py${{ matrix.python-version }} # set conda environment file with dependencies env_file: "environment.yml" @@ -52,41 +46,31 @@ jobs: run: | git fetch --tags --force # Retrieve annotated tags. - - name: Get year week - id: date - run: echo "date=$(date +'%Y:%U')" >> $GITHUB_STATE - - - name: setup conda env - uses: conda-incubator/setup-miniconda@v3 + - uses: mamba-org/setup-micromamba@v1 with: - mamba-version: "*" - channels: conda-forge,defaults + micromamba-version: '1.5.8-0' # versions: https://github.com/mamba-org/micromamba-releases environment-file: environment.yml - channel-priority: true - miniforge-variant: Mambaforge - miniforge-version: latest - activate-environment: dascore - use-mamba: true - python-version: ${{ matrix.python-version }} - - - name: Cache conda env - uses: actions/cache@v3 - with: - path: ${{ env.prefix }} - key: ${{ env.cache_key }}-${{ runner.arch }}-hash${{ hashFiles(env.env_file) }}-${{ steps.date.outputs.date }}-${{ env.CACHE_NUMBER }} - id: cache - - - name: Update environment - run: mamba env update -n dascore -f ${{ env.env_file }} - if: steps.cache.outputs.cache-hit != 'true' + 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} + shell: bash -el {0} run: | python -m pip install -e .[test,all] - name: set data cache path - shell: bash -l {0} + shell: bash -el {0} run: | echo "DATA_CACHE_PATH=$(python -c "import pooch; print(pooch.os_cache('dascore'))")" >> $GITHUB_ENV @@ -97,29 +81,32 @@ jobs: path: ${{ env.DATA_CACHE_PATH }} key: DATA_${{ env.CACHE_NUMBER }} + # Print out the package info for current environment - name: print package info - shell: bash -l {0} + shell: bash -el {0} run: | - conda info -a - conda list + micromamba info + micromamba list # Runs test suite and calculates coverage - name: run test suite - shell: bash -l {0} + shell: bash -el {0} run: ./.github/test_code.sh # Runs examples in docstrings - name: test docstrings - shell: bash -l {0} + 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 # optional - name: PR_tests # optional - token: ${{ secrets.CODECOV_TOKEN }} # required + 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).