Skip to content

Commit bb8c441

Browse files
authored
update the CI (#161)
* use concurrency to cancel duplicate runs * update actions/checkout * update actions/setup-python * update codecov * update actions/github-script and the nightly report code * [test-upstream] * [test-upstream] * fix the python version * run the main CI on multiple os
1 parent c1022ea commit bb8c441

File tree

4 files changed

+74
-72
lines changed

4 files changed

+74
-72
lines changed

.github/workflows/ci-additional.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,22 @@ on:
88
branches:
99
- main
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
doctests:
1317
name: Doctests
1418
runs-on: ubuntu-latest
1519
if: github.repository == 'xarray-contrib/pint-xarray'
1620
steps:
1721
- name: checkout
18-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
1923
- name: setup python
20-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v3
2125
with:
22-
python-version: 3.10
26+
python-version: "3.10"
2327
- name: initialize cache
2428
uses: actions/cache@v2
2529
with:

.github/workflows/ci.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
branches: [ main ]
99
workflow_dispatch:
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
detect-skip-ci-trigger:
1317
name: "Detect CI Trigger: [skip-ci]"
@@ -16,7 +20,7 @@ jobs:
1620
outputs:
1721
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
1822
steps:
19-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v3
2024
with:
2125
fetch-depth: 2
2226
- uses: keewis/[email protected]
@@ -25,8 +29,8 @@ jobs:
2529
keyword: "[skip-ci]"
2630

2731
ci:
28-
name: py${{ matrix.python-version }}
29-
runs-on: ubuntu-latest
32+
name: ${{ matrix.os }} py${{ matrix.python-version }}
33+
runs-on: ${{ matrix.os }}
3034
needs: detect-skip-ci-trigger
3135

3236
if: |
@@ -41,15 +45,11 @@ jobs:
4145
fail-fast: false
4246
matrix:
4347
python-version: ["3.8", "3.9", "3.10"]
48+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
4449

4550
steps:
46-
- name: cancel previous runs
47-
uses: styfle/[email protected]
48-
with:
49-
access_token: ${{ github.token }}
50-
5151
- name: checkout the repository
52-
uses: actions/checkout@v2
52+
uses: actions/checkout@v3
5353
with:
5454
# need to fetch all tags to get a correct version
5555
fetch-depth: 0 # fetch all branches and tags
@@ -63,7 +63,7 @@ jobs:
6363
pip-
6464
6565
- name: setup python
66-
uses: actions/setup-python@v2
66+
uses: actions/setup-python@v3
6767
with:
6868
python-version: ${{ matrix.python-version }}
6969

@@ -91,10 +91,10 @@ jobs:
9191
python -m pytest --cov=pint_xarray --cov-report=xml
9292
9393
- name: Upload code coverage to Codecov
94-
uses: codecov/codecov-action@v1
94+
uses: codecov/codecov-action@v2.1.0
9595
with:
9696
file: ./coverage.xml
9797
flags: unittests
98-
env_vars: PYTHON_VERSION
98+
env_vars: RUNNER_OS,PYTHON_VERSION
9999
name: codecov-umbrella
100100
fail_ci_if_error: false

.github/workflows/nightly.yml

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- cron: "0 0 * * *" # Daily "At 00:00" UTC
1111
workflow_dispatch:
1212

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
1317
jobs:
1418
detect-test-upstream-trigger:
1519
name: "Detect CI Trigger: [test-upstream]"
@@ -18,7 +22,7 @@ jobs:
1822
outputs:
1923
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
2024
steps:
21-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2226
with:
2327
fetch-depth: 2
2428
- uses: keewis/[email protected]
@@ -49,19 +53,14 @@ jobs:
4953
artifacts_availability: ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
5054

5155
steps:
52-
- name: cancel previous runs
53-
uses: styfle/[email protected]
54-
with:
55-
access_token: ${{ github.token }}
56-
5756
- name: checkout the repository
58-
uses: actions/checkout@v2
57+
uses: actions/checkout@v3
5958
with:
6059
# need to fetch all tags to get a correct version
6160
fetch-depth: 0 # fetch all branches and tags
6261

6362
- name: setup python
64-
uses: actions/setup-python@v2
63+
uses: actions/setup-python@v3
6564
with:
6665
python-version: ${{ matrix.python-version }}
6766

@@ -116,9 +115,9 @@ jobs:
116115
&& needs.upstream-dev.outputs.artifacts_availability == 'true'
117116
steps:
118117
- name: checkout the repository
119-
uses: actions/checkout@v2
118+
uses: actions/checkout@v3
120119
- name: setup python
121-
uses: actions/setup-python@v2
120+
uses: actions/setup-python@v3
122121
with:
123122
python-version: "3.x"
124123
- uses: actions/download-artifact@v2
@@ -133,55 +132,54 @@ jobs:
133132
shopt -s globstar
134133
python .github/workflows/parse_logs.py logs/**/*-log
135134
- name: Report failures
136-
uses: actions/github-script@v3
135+
uses: actions/github-script@v6
137136
with:
138137
github-token: ${{ secrets.GITHUB_TOKEN }}
139138
script: |
140-
const fs = require('fs');
141-
const pytest_logs = fs.readFileSync('pytest-logs.txt', 'utf8');
142-
const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
143-
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
144-
const issue_body = `[Workflow Run URL](${workflow_url})\n${pytest_logs}`
145-
146-
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
147-
const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
148-
repository(owner: $owner, name: $name) {
149-
issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
150-
edges {
151-
node {
152-
body
153-
id
154-
number
139+
const fs = require('fs');
140+
const pytest_logs = fs.readFileSync('pytest-logs.txt', 'utf8');
141+
const title = "⚠️ Nightly upstream-dev CI failed ⚠️"
142+
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
143+
const issue_body = `[Workflow Run URL](${workflow_url})\n${pytest_logs}`
144+
145+
// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
146+
const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
147+
repository(owner: $owner, name: $name) {
148+
issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
149+
edges {
150+
node {
151+
body
152+
id
153+
number
154+
}
155155
}
156156
}
157157
}
158+
}`;
159+
160+
const variables = {
161+
owner: context.repo.owner,
162+
name: context.repo.repo,
163+
label: 'CI',
164+
creator: "github-actions[bot]"
165+
}
166+
const result = await github.graphql(query, variables)
167+
168+
// If no issue is open, create a new issue,
169+
// else update the body of the existing issue.
170+
if (result.repository.issues.edges.length === 0) {
171+
github.rest.issues.create({
172+
owner: variables.owner,
173+
repo: variables.name,
174+
body: issue_body,
175+
title: title,
176+
labels: [variables.label]
177+
})
178+
} else {
179+
github.rest.issues.update({
180+
owner: variables.owner,
181+
repo: variables.name,
182+
issue_number: result.repository.issues.edges[0].node.number,
183+
body: issue_body
184+
})
158185
}
159-
}`;
160-
161-
const variables = {
162-
owner: context.repo.owner,
163-
name: context.repo.repo,
164-
label: 'CI',
165-
creator: "github-actions[bot]"
166-
}
167-
const result = await github.graphql(query, variables)
168-
169-
// If no issue is open, create a new issue,
170-
// else update the body of the existing issue.
171-
if (result.repository.issues.edges.length === 0) {
172-
github.issues.create({
173-
owner: variables.owner,
174-
repo: variables.name,
175-
body: issue_body,
176-
title: title,
177-
labels: [variables.label]
178-
})
179-
} else {
180-
github.issues.update({
181-
owner: variables.owner,
182-
repo: variables.name,
183-
issue_number: issue_info.number,
184-
issue_number: result.repository.issues.edges[0].node.number,
185-
body: issue_body
186-
})
187-
}

.github/workflows/pypi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
if: github.repository == 'xarray-contrib/pint-xarray'
1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@v3
1313
- name: Set up Python
14-
uses: actions/setup-python@v1
14+
uses: actions/setup-python@v3
1515
with:
1616
python-version: '3.x'
1717
- name: Install dependencies

0 commit comments

Comments
 (0)