Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CI from azure pipelines to GitHub Actions #4730

Merged
merged 61 commits into from Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
4168a5f
Run isort, black, mypy, flake8 checks via pre-commit
andersy005 Dec 23, 2020
24c7d78
Fix line ending
andersy005 Dec 23, 2020
855d6b5
Fix end of line
andersy005 Dec 23, 2020
8f9f81b
Fix mypy pre-commit hook. Thanks @keewis
andersy005 Dec 24, 2020
eb6581d
Add main CI
andersy005 Dec 24, 2020
b37d894
Add additional CI
andersy005 Dec 24, 2020
60d08eb
Fetch all history for all branches and tags
andersy005 Dec 24, 2020
bdd3986
Add windows environment
andersy005 Dec 24, 2020
26604a5
Import xarray
andersy005 Dec 24, 2020
6445b47
Add doctests workflow
andersy005 Dec 24, 2020
80da331
Add minimum version policy workflow
andersy005 Dec 24, 2020
32114b2
Simplify if logic
andersy005 Dec 24, 2020
4eacb65
Add flaky and backend-api-v2 settings
andersy005 Dec 24, 2020
4c6252b
Fix if elif else statements
andersy005 Dec 24, 2020
002ab25
Fix typo
andersy005 Dec 24, 2020
e65c655
Remove azure pipelines configurations
andersy005 Dec 24, 2020
06b8334
Fix environment file name
andersy005 Dec 24, 2020
e70fb89
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Dec 25, 2020
edf8d14
Upload code coverage for additional CI
andersy005 Dec 25, 2020
ec1e5fc
Cache conda pkgs_dir
andersy005 Dec 25, 2020
257529b
Fix cache key
andersy005 Dec 25, 2020
26a0316
Remove unnecessary cache number variable
andersy005 Dec 25, 2020
b2287ae
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Dec 29, 2020
8530374
Use `runner.os` instead of `matrix.os`
andersy005 Dec 29, 2020
e6baaa2
Use RUNNER_OS env variable
andersy005 Dec 29, 2020
3c8da76
Disable name for the time being
andersy005 Dec 29, 2020
28eca4b
Another attempt at setting name
andersy005 Dec 30, 2020
b834919
`runner.os` doesn't work. Use `matrix.os` instead
andersy005 Dec 30, 2020
310bc06
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 2, 2021
646b079
Update env creation guidelines
andersy005 Jan 2, 2021
c4b4139
Add `pre-commit run --all-files` check
andersy005 Jan 2, 2021
ffcebe2
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 4, 2021
b2c46db
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 5, 2021
8437d12
Update blackdoc version
andersy005 Jan 5, 2021
ffe53b9
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 5, 2021
afaf4b6
Add new pre-commit hooks
andersy005 Jan 5, 2021
1a8ba88
Add some of the out-of-the box hooks
andersy005 Jan 5, 2021
133bb6c
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 5, 2021
09ee1f6
Formatting only
andersy005 Jan 5, 2021
3c96c19
Remove bad change
andersy005 Jan 6, 2021
8760d15
Remove isort and add pre-commit
andersy005 Jan 6, 2021
8446ada
Fix bad merge
andersy005 Jan 6, 2021
5bf36f1
Enable `cfgrib` on windows for the time being
andersy005 Jan 6, 2021
fe10a28
Disable cfgrib on windows
andersy005 Jan 6, 2021
954cc69
Remove coveralls
andersy005 Jan 6, 2021
86e7dc6
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 6, 2021
fa5bb1f
Formatting only
andersy005 Jan 6, 2021
3df58b7
Remove remaining reference to azure pipelines
andersy005 Jan 6, 2021
c7a91d7
Remove py 3.6 from CI matrix
andersy005 Jan 7, 2021
1328110
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 7, 2021
7c4de89
Use py37
andersy005 Jan 7, 2021
c60dcd9
Remove all references to py36 env file
andersy005 Jan 7, 2021
5e6ddf2
Add check for skip ci
andersy005 Jan 7, 2021
93ff1ce
rename job to `detect ci trigger`
andersy005 Jan 7, 2021
3cf7d3e
[skip ci] Empty commit
andersy005 Jan 7, 2021
a6f4d60
[skip-ci] Test skip CI trigger
andersy005 Jan 7, 2021
fe18db1
Update PR template
andersy005 Jan 7, 2021
f4088f6
Fix typ
andersy005 Jan 7, 2021
c869ee2
GH markdown doesn't like lists in <sub></sub>
andersy005 Jan 7, 2021
11fdc01
Merge branch 'master' of github.com:pydata/xarray into ci/migrate-to-GHA
andersy005 Jan 10, 2021
5c6c49b
Remove the `-OO` flag for consistency
andersy005 Jan 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Expand Up @@ -4,7 +4,5 @@ contact_links:
url: https://github.com/pydata/xarray/discussions
about: |
Ask questions and discuss with other community members here.
If you have a question like "How do I concatenate a list of datasets?" then
If you have a question like "How do I concatenate a list of datasets?" then
please include a self-contained reproducible example if possible.
9 changes: 7 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -2,9 +2,14 @@

- [ ] Closes #xxxx
- [ ] Tests added
- [ ] Passes `isort . && black . && mypy . && flake8`
- [ ] Passes `pre-commit run --all-files`
- [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst`
- [ ] New functions/methods are listed in `api.rst`


<sub>By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message.</sub>
<sub>
<h3>
Overriding CI behaviors
</h3>
By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message. For documentation-only commits, you can skip the CI per commit by adding a `[skip-ci]` tag to the first line of the commit message
</sub>
2 changes: 1 addition & 1 deletion .github/stale.yml
Expand Up @@ -56,4 +56,4 @@ limitPerRun: 1 # start with a small number

# issues:
# exemptLabels:
# - confirmed
# - confirmed
188 changes: 188 additions & 0 deletions .github/workflows/ci-additional.yaml
@@ -0,0 +1,188 @@
name: CI Additional
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
workflow_dispatch: # allows you to trigger manually

jobs:
detect-ci-trigger:
name: detect ci trigger
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/detect-ci-trigger
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This action was moved into its own repository.

You can replace uses: ./.github/actions/detect-ci-trigger with

uses: xarray-contrib/ci-trigger@v1

id: detect-trigger
with:
keyword: "[skip-ci]"

test:
name: ${{ matrix.os }} ${{ matrix.env }}
runs-on: ${{ matrix.os }}
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
env:
[
"py37-bare-minimum",
"py37-min-all-deps",
"py37-min-nep18",
"py38-all-but-dask",
"py38-backend-api-v2",
"py38-flaky",
]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

- name: Set environment variables
run: |
if [[ ${{ matrix.env }} == "py38-backend-api-v2" ]] ;
then
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "XARRAY_BACKEND_API=v2" >> $GITHUB_ENV

elif [[ ${{ matrix.env }} == "py38-flaky" ]] ;
then
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV

else
echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV
fi
- name: Cache conda
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ matrix.env }}-${{
hashFiles('ci/requirements/**.yml') }}

- uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
channel-priority: strict
mamba-version: "*"
activate-environment: xarray-tests
auto-update-conda: false
python-version: 3.8
use-only-tar-bz2: true

- name: Install conda dependencies
run: |
mamba env update -f $CONDA_ENV_FILE

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

- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
- name: Import xarray
run: |
python -OO -c "import xarray"
- name: Run tests
run: |
python -m pytest -n 4 \
--cov=xarray \
--cov-report=xml \
$PYTEST_EXTRA_FLAGS

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests,${{ matrix.env }}
env_vars: RUNNER_OS
name: codecov-umbrella
fail_ci_if_error: false
doctest:
name: Doctests
runs-on: "ubuntu-latest"
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
defaults:
run:
shell: bash -l {0}

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
channel-priority: strict
mamba-version: "*"
activate-environment: xarray-tests
auto-update-conda: false
python-version: "3.8"

- name: Install conda dependencies
run: |
mamba env update -f ci/requirements/environment.yml
- name: Install xarray
run: |
python -m pip install --no-deps -e .
- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
- name: Run doctests
run: |
python -m pytest --doctest-modules xarray --ignore xarray/tests

min-version-policy:
name: Minimum Version Policy
runs-on: "ubuntu-latest"
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
defaults:
run:
shell: bash -l {0}

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
channel-priority: strict
mamba-version: "*"
auto-update-conda: false

- name: minimum versions policy
run: |
mamba install -y pyyaml
python ci/min_deps_check.py ci/requirements/py37-bare-minimum.yml
python ci/min_deps_check.py ci/requirements/py37-min-all-deps.yml
16 changes: 16 additions & 0 deletions .github/workflows/ci-pre-commit.yml
@@ -0,0 +1,16 @@
name: linting

on:
push:
branches: "*"
pull_request:
branches: "*"

jobs:
linting:
name: "pre-commit hooks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
keewis marked this conversation as resolved.
Show resolved Hide resolved
102 changes: 102 additions & 0 deletions .github/workflows/ci.yaml
@@ -0,0 +1,102 @@
name: CI
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
workflow_dispatch: # allows you to trigger manually

jobs:
detect-ci-trigger:
name: detect ci trigger
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/detect-ci-trigger
id: detect-trigger
with:
keyword: "[skip-ci]"
test:
name: ${{ matrix.os }} py${{ matrix.python-version }}
keewis marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ${{ matrix.os }}
needs: detect-ci-trigger
if: needs.detect-ci-trigger.outputs.triggered == 'false'
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8"]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set environment variables
run: |
if [[ ${{ matrix.os }} == windows* ]] ;
then
echo "CONDA_ENV_FILE=ci/requirements/environment-windows.yml" >> $GITHUB_ENV
else
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV

fi
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV

- name: Cache conda
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-py${{ matrix.python-version }}-${{
hashFiles('ci/requirements/**.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
channels: conda-forge
channel-priority: strict
mamba-version: "*"
activate-environment: xarray-tests
auto-update-conda: false
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true

- name: Install conda dependencies
run: |
mamba env update -f $CONDA_ENV_FILE

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

- name: Version info
run: |
conda info -a
conda list
python xarray/util/print_versions.py
- name: Import xarray
run: |
python -OO -c "import xarray"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we currently don't use the -OO flag in the upstream-dev CI. Should we add it to the upstream-dev CI or remove it here and from CI Additional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andersy005 - thoughts on this one? Otherwise I think we merge this and follow up with dev doc updates.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a preference. I used the -OO flag because it was present in the previous azure pipelines CI. For consistency, I'm going to remove it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks. If we had a specific reason for -OO we can always add it back in a new PR, I guess.

- name: Run tests
run: |
python -m pytest -n 4 \
--cov=xarray \
--cov-report=xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-umbrella
fail_ci_if_error: false
10 changes: 5 additions & 5 deletions .github/workflows/upstream-dev-ci.yaml
@@ -1,4 +1,4 @@
name: CI
name: CI Upstream
on:
push:
branches:
Expand All @@ -23,7 +23,7 @@ jobs:
id: detect-trigger
with:
keyword: "[test-upstream]"

upstream-dev:
name: upstream-dev
runs-on: ubuntu-latest
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Set up conda environment
run: |
mamba env update -f ci/requirements/py38.yml
mamba env update -f ci/requirements/environment.yml
bash ci/install-upstream-wheels.sh
conda list
- name: import xarray
Expand Down Expand Up @@ -148,8 +148,8 @@ jobs:
}
const result = await github.graphql(query, variables)
// If no issue is open, create a new issue,
// else update the body of the existing issue.
// If no issue is open, create a new issue,
// else update the body of the existing issue.
if (result.repository.issues.edges.length === 0) {
github.issues.create({
owner: variables.owner,
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
@@ -1,5 +1,11 @@
# https://pre-commit.com/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
# isort should run before black as black sometimes tweaks the isort output
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
Expand All @@ -22,6 +28,7 @@ repos:
rev: v0.790 # Must match ci/requirements/*.yml
hooks:
- id: mypy
exclude: "properties|asv_bench"
# run this occasionally, ref discussion https://github.com/pydata/xarray/pull/3194
# - repo: https://github.com/asottile/pyupgrade
# rev: v1.22.1
Expand Down