Skip to content

Commit f271a68

Browse files
authored
Merge branch 'main' into cupy
2 parents 3d972f7 + c1358e7 commit f271a68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+22508
-2199
lines changed

.github/workflows/benchmarks.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Benchmark
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, labeled]
6+
workflow_dispatch:
7+
8+
jobs:
9+
benchmark:
10+
# if: ${{ contains( github.event.pull_request.labels.*.name, 'run-benchmark') && github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} # Run if the PR has been labelled correctly.
11+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} # Always run.
12+
name: Linux
13+
runs-on: ubuntu-20.04
14+
env:
15+
ASV_DIR: "./asv_bench"
16+
17+
steps:
18+
# We need the full repo to avoid this issue
19+
# https://github.com/actions/checkout/issues/23
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Set up conda environment
25+
uses: mamba-org/provision-with-micromamba@v14
26+
with:
27+
environment-file: ci/environment.yml
28+
environment-name: flox-tests
29+
cache-env: true
30+
# extra-specs: |
31+
# python="${{ matrix.python-version }}"
32+
33+
# - name: Setup some dependencies
34+
# shell: bash -l {0}
35+
# run: |
36+
# pip install asv
37+
# sudo apt-get update -y
38+
39+
- name: Run benchmarks
40+
shell: bash -l {0}
41+
id: benchmark
42+
env:
43+
OPENBLAS_NUM_THREADS: 1
44+
MKL_NUM_THREADS: 1
45+
OMP_NUM_THREADS: 1
46+
ASV_FACTOR: 1.5
47+
ASV_SKIP_SLOW: 1
48+
run: |
49+
set -x
50+
# ID this runner
51+
asv machine --yes
52+
echo "Baseline: ${{ github.event.pull_request.base.sha }} (${{ github.event.pull_request.base.label }})"
53+
echo "Contender: ${GITHUB_SHA} (${{ github.event.pull_request.head.label }})"
54+
# Use mamba for env creation
55+
# export CONDA_EXE=$(which mamba)
56+
export CONDA_EXE=$(which conda)
57+
# Run benchmarks for current commit against base
58+
ASV_OPTIONS="--split --show-stderr --factor $ASV_FACTOR"
59+
asv continuous $ASV_OPTIONS ${{ github.event.pull_request.base.sha }} ${GITHUB_SHA} \
60+
| sed "/Traceback \|failed$\|PERFORMANCE DECREASED/ s/^/::error::/" \
61+
| tee benchmarks.log
62+
# Report and export results for subsequent steps
63+
if grep "Traceback \|failed\|PERFORMANCE DECREASED" benchmarks.log > /dev/null ; then
64+
exit 1
65+
fi
66+
working-directory: ${{ env.ASV_DIR }}
67+
68+
- name: Add instructions to artifact
69+
if: always()
70+
run: |
71+
cp benchmarks/README_CI.md benchmarks.log .asv/results/
72+
working-directory: ${{ env.ASV_DIR }}
73+
74+
- uses: actions/upload-artifact@v3
75+
if: always()
76+
with:
77+
name: asv-benchmark-results-${{ runner.os }}
78+
path: ${{ env.ASV_DIR }}/.asv/results

.github/workflows/ci-additional.yaml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CI Additional
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
branches:
8+
- "*"
9+
workflow_dispatch: # allows you to trigger 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/flox'
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@v3
26+
with:
27+
fetch-depth: 2
28+
- uses: xarray-contrib/[email protected]
29+
id: detect-trigger
30+
with:
31+
keyword: "[skip-ci]"
32+
33+
doctest:
34+
name: Doctests
35+
runs-on: "ubuntu-latest"
36+
needs: detect-ci-trigger
37+
if: needs.detect-ci-trigger.outputs.triggered == 'false'
38+
defaults:
39+
run:
40+
shell: bash -l {0}
41+
42+
env:
43+
CONDA_ENV_FILE: ci/environment.yml
44+
PYTHON_VERSION: "3.10"
45+
46+
steps:
47+
- uses: actions/checkout@v3
48+
with:
49+
fetch-depth: 0 # Fetch all history for all branches and tags.
50+
51+
- name: set environment variables
52+
run: |
53+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
54+
55+
- name: Setup micromamba
56+
uses: mamba-org/provision-with-micromamba@v14
57+
with:
58+
environment-file: ${{env.CONDA_ENV_FILE}}
59+
environment-name: flox-tests
60+
extra-specs: |
61+
python=${{env.PYTHON_VERSION}}
62+
cache-env: true
63+
cache-env-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
64+
65+
- name: Install flox
66+
run: |
67+
python -m pip install --no-deps -e .
68+
- name: Version info
69+
run: |
70+
conda info -a
71+
conda list
72+
- name: Run doctests
73+
run: |
74+
python -m pytest --doctest-modules flox --ignore flox/tests --cov=./ --cov-report=xml
75+
- name: Upload code coverage to Codecov
76+
uses: codecov/[email protected]
77+
with:
78+
file: ./coverage.xml
79+
flags: unittests
80+
env_vars: RUNNER_OS
81+
name: codecov-umbrella
82+
fail_ci_if_error: false
83+
84+
mypy:
85+
name: Mypy
86+
runs-on: "ubuntu-latest"
87+
needs: detect-ci-trigger
88+
if: needs.detect-ci-trigger.outputs.triggered == 'false'
89+
defaults:
90+
run:
91+
shell: bash -l {0}
92+
env:
93+
CONDA_ENV_FILE: ci/environment.yml
94+
PYTHON_VERSION: "3.10"
95+
96+
steps:
97+
- uses: actions/checkout@v3
98+
with:
99+
fetch-depth: 0 # Fetch all history for all branches and tags.
100+
101+
- name: set environment variables
102+
run: |
103+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
104+
- name: Setup micromamba
105+
uses: mamba-org/provision-with-micromamba@v14
106+
with:
107+
environment-file: ${{env.CONDA_ENV_FILE}}
108+
environment-name: flox-tests
109+
extra-specs: |
110+
python=${{env.PYTHON_VERSION}}
111+
cache-env: true
112+
cache-env-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
113+
- name: Install flox
114+
run: |
115+
python -m pip install --no-deps -e .
116+
- name: Version info
117+
run: |
118+
conda info -a
119+
conda list
120+
- name: Install mypy
121+
run: |
122+
python -m pip install mypy
123+
124+
- name: Run mypy
125+
run: |
126+
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
127+
128+
- name: Upload mypy coverage to Codecov
129+
uses: codecov/[email protected]
130+
with:
131+
file: mypy_report/cobertura.xml
132+
flags: mypy
133+
env_vars: PYTHON_VERSION
134+
name: codecov-umbrella
135+
fail_ci_if_error: false

.github/workflows/ci.yaml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
os: ["ubuntu-latest"]
27+
os: ["ubuntu-latest", "windows-latest"]
2828
python-version: ["3.8", "3.10"]
2929
steps:
3030
- uses: actions/checkout@v3
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
3636
- name: Set up conda environment
37-
uses: mamba-org/provision-with-micromamba@v12
37+
uses: mamba-org/provision-with-micromamba@v14
3838
with:
3939
environment-file: ci/environment.yml
4040
environment-name: flox-tests
@@ -43,13 +43,12 @@ jobs:
4343
python="${{ matrix.python-version }}"
4444
- name: Install flox
4545
run: |
46-
python -m pip install -e .
47-
conda list
46+
python -m pip install --no-deps -e .
4847
- name: Run Tests
4948
run: |
5049
pytest -n auto --cov=./ --cov-report=xml
5150
- name: Upload code coverage to Codecov
52-
uses: codecov/[email protected].0
51+
uses: codecov/[email protected].1
5352
with:
5453
file: ./coverage.xml
5554
flags: unittests
@@ -78,7 +77,7 @@ jobs:
7877
with:
7978
fetch-depth: 0 # Fetch all history for all branches and tags.
8079
- name: Set up conda environment
81-
uses: mamba-org/provision-with-micromamba@v12
80+
uses: mamba-org/provision-with-micromamba@v14
8281
with:
8382
environment-file: ci/${{ matrix.env }}.yml
8483
environment-name: flox-tests
@@ -90,7 +89,15 @@ jobs:
9089
python -m pip install --no-deps -e .
9190
- name: Run tests
9291
run: |
93-
python -m pytest -n auto
92+
python -m pytest -n auto --cov=./ --cov-report=xml
93+
- name: Upload code coverage to Codecov
94+
uses: codecov/[email protected]
95+
with:
96+
file: ./coverage.xml
97+
flags: unittests
98+
env_vars: RUNNER_OS
99+
name: codecov-umbrella
100+
fail_ci_if_error: false
94101

95102
upstream-dev:
96103
name: upstream-dev
@@ -101,7 +108,7 @@ jobs:
101108
steps:
102109
- uses: actions/checkout@v3
103110
- name: Set up conda environment
104-
uses: mamba-org/provision-with-micromamba@v12
111+
uses: mamba-org/provision-with-micromamba@v14
105112
with:
106113
environment-file: ci/upstream-dev-env.yml
107114
environment-name: flox-tests
@@ -123,7 +130,7 @@ jobs:
123130
repository: 'pydata/xarray'
124131
fetch-depth: 0 # Fetch all history for all branches and tags.
125132
- name: Set up conda environment
126-
uses: mamba-org/provision-with-micromamba@v12
133+
uses: mamba-org/provision-with-micromamba@v14
127134
with:
128135
environment-file: ci/requirements/environment.yml
129136
environment-name: xarray-tests

.pre-commit-config.yaml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,46 @@ ci:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.3.0
6+
rev: v4.4.0
77
hooks:
8+
- id: check-yaml
89
- id: trailing-whitespace
910
- id: end-of-file-fixer
1011
- id: check-docstring-first
1112

1213
- repo: https://github.com/psf/black
13-
rev: 22.6.0
14+
rev: 22.12.0
1415
hooks:
1516
- id: black
1617

1718
- repo: https://github.com/PyCQA/flake8
18-
rev: 4.0.1
19+
rev: 6.0.0
1920
hooks:
2021
- id: flake8
2122

2223
- repo: https://github.com/PyCQA/isort
23-
rev: 5.10.1
24+
rev: 5.11.4
2425
hooks:
2526
- id: isort
2627

27-
- repo: https://github.com/deathbeds/prenotebook
28-
rev: f5bdb72a400f1a56fe88109936c83aa12cc349fa
28+
- repo: https://github.com/executablebooks/mdformat
29+
rev: 0.7.16
2930
hooks:
30-
- id: prenotebook
31-
args:
32-
[
33-
'--keep-output',
34-
'--keep-metadata',
35-
'--keep-execution-count',
36-
'--keep-empty',
37-
]
31+
- id: mdformat
32+
additional_dependencies:
33+
- mdformat-black
34+
- mdformat-myst
35+
36+
- repo: https://github.com/nbQA-dev/nbQA
37+
rev: 1.6.1
38+
hooks:
39+
- id: nbqa-black
40+
- id: nbqa-pyupgrade
41+
args: [--py37-plus]
42+
- id: nbqa-isort
43+
44+
- repo: https://github.com/kynan/nbstripout
45+
rev: 0.6.1
46+
hooks:
47+
- id: nbstripout
48+
args: [--extra-keys=metadata.kernelspec metadata.language_info.version]

0 commit comments

Comments
 (0)