Skip to content

Tests

Tests #61

Workflow file for this run

name: Tests
on:
push:
pull_request:
schedule:
- cron: "0 6,18 * * *"
# When this workflow is queued, automatically cancel any previous running
# or pending jobs from the same branch
concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
# Do not run the schedule job on forks
if: github.repository == 'coiled/distributed-heterogeneous' || github.event_name != 'schedule'
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
environment: ["3.10"]
env:
CONDA_FILE: ci/environment-${{ matrix.environment }}.yaml
steps:
- name: Checkout source
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Conda Environment
uses: conda-incubator/[email protected]
with:
miniforge-variant: Mambaforge
miniforge-version: latest
condarc-file: ci/condarc
use-mamba: true
activate-environment: distributed-heterogeneous
- name: Show conda options
shell: bash -l {0}
run: conda config --show
- name: Check if caching is enabled
uses: xarray-contrib/[email protected]
id: skip-caching
with:
keyword: "[skip-caching]"
- name: Get Date
if: |
(
steps.skip-caching.outputs.trigger-found != 'true'
&& !(github.event_name == 'pull_request'
&& contains(github.event.pull_request.labels.*.name, 'skip-caching'))
)
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash
- name: Cache Conda env
if: steps.skip-caching.outputs.trigger-found != 'true'
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key: conda-${{ matrix.os }}-${{ steps.get-date.outputs.today }}-${{ hashFiles(env.CONDA_FILE) }}-${{ env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if
# continuous_integration/environment-${{ matrix.environment }}.yaml has not
# changed. See also same variable in .pre-commit-config.yaml
CACHE_NUMBER: 0
id: cache
- name: Update environment
run: mamba env update -n distributed-heterogeneous -f ${{ env.CONDA_FILE }}
if: |
(
steps.skip-caching.outputs.trigger-found == 'true'
|| (github.event_name == 'pull_request'
&& contains(github.event.pull_request.labels.*.name, 'skip-caching'))
|| steps.cache.outputs.cache-hit != 'true'
)
- name: Install
shell: bash -l {0}
run: |
python -m pip install --no-deps -e .
- name: mamba list
shell: bash -l {0}
run: mamba list
- name: mamba env export
shell: bash -l {0}
run: |
echo -e "--\n--Conda Environment (re-create this with \`mamba env create --name <name> -f <output_file>\`)\n--"
mamba env export | grep -E -v '^prefix:.*$'
- name: Disable IPv6
shell: bash -l {0}
# FIXME ipv6-related failures on Ubuntu and MacOS github actions CI
# https://github.com/dask/distributed/issues/4514
if: ${{ matrix.os != 'windows-latest' }}
run: echo "DISABLE_IPV6=1" >> $GITHUB_ENV
- name: Test
id: run_tests
shell: bash -l {0}
run: |
pytest distributed_heterogeneous