Skip to content

Commit 1052105

Browse files
authored
switch to github actions (#75)
* add a github actions workflow for CI * fix the skip-ci check * add a linter CI * use --no-deps to install * also upgrade setuptools and wheel * remove the old CI
1 parent 39b409c commit 1052105

File tree

5 files changed

+119
-131
lines changed

5 files changed

+119
-131
lines changed

.github/workflows/ci.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# adapted from xarray's ci
2+
name: CI
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
workflow_dispatch:
10+
11+
jobs:
12+
detect-skip-ci-trigger:
13+
name: "Detect CI Trigger: [skip-ci]"
14+
if: github.event_name == 'push' || github.event_name == 'pull_request'
15+
runs-on: ubuntu-latest
16+
outputs:
17+
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 2
22+
- uses: keewis/ci-trigger@v1
23+
id: detect-trigger
24+
with:
25+
keyword: "[skip-ci]"
26+
27+
ci:
28+
name: py${{ matrix.python-version }}
29+
runs-on: ubuntu-latest
30+
needs: detect-skip-ci-trigger
31+
32+
if: |
33+
always()
34+
&& github.repository == 'xarray-contrib/pint-xarray'
35+
&& (
36+
github.event_name == 'workflow_dispatch'
37+
|| needs.detect-skip-ci-trigger.outputs.triggered == 'false'
38+
)
39+
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
python-version: [3.7, 3.8, 3.9]
44+
45+
steps:
46+
- name: cancel previous runs
47+
uses: styfle/[email protected]
48+
with:
49+
access_token: ${{ github.token }}
50+
51+
- name: checkout the repository
52+
uses: actions/checkout@v2
53+
with:
54+
# need to fetch all tags to get a correct version
55+
fetch-depth: 0 # fetch all branches and tags
56+
57+
- name: cache pip
58+
uses: actions/cache@v2
59+
with:
60+
path: ~/.cache/pip
61+
key: pip-py${{ matrix.python-version }}
62+
restore-keys: |
63+
pip-
64+
65+
- name: setup python
66+
uses: actions/setup-python@v2
67+
with:
68+
python-version: ${{ matrix.python-version }}
69+
70+
- name: upgrade pip
71+
run: python -m pip install --upgrade pip setuptools wheel
72+
73+
- name: install dependencies
74+
run: |
75+
python -m pip install -r ci/requirements.txt
76+
77+
- name: install pint-xarray
78+
run: python -m pip install --no-deps .
79+
80+
- name: show versions
81+
run: python -m pip list
82+
83+
- name: import pint-xarray
84+
run: |
85+
python -c 'import pint_xarray'
86+
87+
- name: run tests
88+
if: success()
89+
id: status
90+
run: |
91+
python -m pytest --cov=pint_xarray --cov-report=xml
92+
93+
- name: Upload code coverage to Codecov
94+
uses: codecov/codecov-action@v1
95+
with:
96+
file: ./coverage.xml
97+
flags: unittests
98+
env_vars: PYTHON_VERSION
99+
name: codecov-umbrella
100+
fail_ci_if_error: false

.github/workflows/linting.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: linting
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
linting:
13+
name: pre-commit
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-python@v2
19+
- uses: pre-commit/[email protected]

azure-pipelines.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

ci/install.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

ci/unit-tests.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)