Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch: # allows triggering manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
detect-ci-trigger:
name: detect ci trigger
runs-on: ubuntu-latest
if: |
github.repository == 'xarray-contrib/xarray-array-testing'
&& (github.event_name == 'push' || github.event_name == 'pull_request')
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: xarray-contrib/ci-trigger@v1
id: detect-trigger
with:
keyword: "[skip-ci]"

test:
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
env:
FORCE_COLOR: 3
CONDA_ENV_FILE: "ci/requirements/environment.yaml"
defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ci/requirements/environment.yaml
environment-name: tests
cache-environment: true
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
create-args: >-
python=${{matrix.python-version}}
conda

- name: Install xarray-array-testing
run: |
python -m pip install --no-deps -e .

- name: Version info
run: |
conda info -a
conda list

- name: Import xarray-array-testing
run: |
python -c 'import xarray_array_testing'

- name: Restore cached hypothesis directory
uses: actions/cache@v4
with:
path: .hypothesis/
key: cache-hypothesis
enableCrossOsArchive: true
save-always: true

- name: Run tests
run: |
python -m pytest --cov=xarray_array_testing
3 changes: 3 additions & 0 deletions ci/requirements/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ dependencies:
- pre-commit
- pytest
- pytest-reportlog
- hypothesis
- xarray
- numpy
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
name = "xarray-array-testing"
requires-python = ">= 3.12"
license = {text = "Apache-2.0"}
dependencies = []
dependencies = [
"hypothesis",
"xarray",
]
dynamic = ["version"]

[build-system]
Expand Down