Skip to content

Commit a663bdc

Browse files
authored
set up CI (xarray-contrib#3)
* simple CI * add requirements * package metadata
1 parent ed3c0a9 commit a663bdc

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
branches:
8+
- "main"
9+
workflow_dispatch: # allows triggering manually
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
detect-ci-trigger:
17+
name: detect ci trigger
18+
runs-on: ubuntu-latest
19+
if: |
20+
github.repository == 'xarray-contrib/xarray-array-testing'
21+
&& (github.event_name == 'push' || github.event_name == 'pull_request')
22+
outputs:
23+
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 2
28+
29+
- uses: xarray-contrib/ci-trigger@v1
30+
id: detect-trigger
31+
with:
32+
keyword: "[skip-ci]"
33+
34+
test:
35+
name: ${{ matrix.os }} py${{ matrix.python-version }}
36+
runs-on: ${{ matrix.os }}
37+
needs: detect-ci-trigger
38+
if: needs.detect-ci-trigger.outputs.triggered == 'false'
39+
env:
40+
FORCE_COLOR: 3
41+
CONDA_ENV_FILE: "ci/requirements/environment.yaml"
42+
defaults:
43+
run:
44+
shell: bash -l {0}
45+
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
50+
python-version: ["3.11", "3.12"]
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
57+
- name: Setup micromamba
58+
uses: mamba-org/setup-micromamba@v1
59+
with:
60+
environment-file: ci/requirements/environment.yaml
61+
environment-name: tests
62+
cache-environment: true
63+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
64+
create-args: >-
65+
python=${{matrix.python-version}}
66+
conda
67+
68+
- name: Install xarray-array-testing
69+
run: |
70+
python -m pip install --no-deps -e .
71+
72+
- name: Version info
73+
run: |
74+
conda info -a
75+
conda list
76+
77+
- name: Import xarray-array-testing
78+
run: |
79+
python -c 'import xarray_array_testing'
80+
81+
- name: Restore cached hypothesis directory
82+
uses: actions/cache@v4
83+
with:
84+
path: .hypothesis/
85+
key: cache-hypothesis
86+
enableCrossOsArchive: true
87+
save-always: true
88+
89+
- name: Run tests
90+
run: |
91+
python -m pytest --cov=xarray_array_testing

ci/requirements/environment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ dependencies:
77
- pre-commit
88
- pytest
99
- pytest-reportlog
10+
- hypothesis
11+
- xarray
12+
- numpy

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
name = "xarray-array-testing"
33
requires-python = ">= 3.12"
44
license = {text = "Apache-2.0"}
5-
dependencies = []
5+
dependencies = [
6+
"hypothesis",
7+
"xarray",
8+
]
69
dynamic = ["version"]
710

811
[build-system]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy