-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bcc105
commit 50f8d14
Showing
7 changed files
with
150 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,51 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' # Daily “At 00:00” | ||
workflow_dispatch: # allows you to trigger manually | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
pre-job: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/skip-duplicate-actions@master | ||
with: | ||
concurrent_skipping: 'same_content' | ||
skip_after_successful_duplicate: 'false' | ||
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' | ||
paths_ignore: '["**/docs/**"]' | ||
build: | ||
needs: pre-job | ||
if: ${{ needs.pre-job.outputs.should_skip != 'true' }} | ||
name: python-${{ matrix.python-version }} | ||
if: github.repository == 'NCAR/ecgtools' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9'] | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
channels: conda-forge,nodefaults | ||
mamba-version: '*' | ||
channels: conda-forge | ||
channel-priority: strict | ||
activate-environment: ecgtools-dev | ||
auto-update-conda: false | ||
python-version: ${{ matrix.python-version }} | ||
mamba-version: '*' | ||
use-mamba: true | ||
miniforge-variant: Mambaforge | ||
environment-file: ci/environment.yml | ||
|
||
- name: Set up conda environment | ||
- name: Install ecgtools | ||
run: | | ||
python -m pip install -e . | ||
python -m pip install -e . --no-deps --force-reinstall | ||
conda list | ||
- name: Run Tests | ||
run: | | ||
python -m pytest --cov=./ --cov-report=xml --verbose | ||
python -m pytest | ||
- name: Upload code coverage to Codecov | ||
uses: codecov/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Upstream CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 0 * * *' # Daily “At 00:00” UTC | ||
workflow_dispatch: # allows you to trigger the workflow run manually | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
upstream-dev: | ||
name: upstream-dev | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'NCAR/ecgtools' | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.10'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
id: conda | ||
with: | ||
channels: conda-forge,nodefaults | ||
channel-priority: strict | ||
activate-environment: ecgtools-dev | ||
auto-update-conda: false | ||
python-version: ${{ matrix.python-version }} | ||
environment-file: ci/environment-upstream-dev.yml | ||
mamba-version: '*' | ||
use-mamba: true | ||
miniforge-variant: Mambaforge | ||
|
||
- name: Install ecgtools | ||
id: install | ||
run: | | ||
python -m pip install -e . --no-deps --force-reinstall | ||
conda list | ||
- name: Run Tests | ||
id: test | ||
run: | | ||
python -m pytest | ||
- name: Report Status | ||
if: | | ||
always() | ||
&& (steps.conda.outcome != 'success' || steps.install.outcome != 'success' || steps.install.outcome != 'success') | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const title = '⚠️ Upstream CI Failed ⚠️' | ||
const creator = 'github-actions[bot]' | ||
const issueLabel = 'CI' | ||
const workflow_url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}` | ||
const issue_body = `[Workflow Run URL](${workflow_url})\n\n` | ||
let foundIssue = false | ||
const issues = await github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
for (let issue of issues.data) { | ||
if ( | ||
issue.user.login === creator && | ||
issue.state === 'open' && | ||
issue.labels.some((label) => label.name === issueLabel) | ||
) { | ||
github.rest.issues.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue.number, | ||
body: issue_body, | ||
}) | ||
core.info(`Updated an existing issue: ${issue.number}.`) | ||
foundIssue = true | ||
break | ||
} | ||
} | ||
if (!foundIssue) { | ||
await github.rest.issues.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: title, | ||
body: issue_body, | ||
labels: [issueLabel], | ||
}) | ||
core.info('Opened a new issue') | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: ecgtools-dev | ||
channels: | ||
- conda-forge | ||
- nodefaults | ||
dependencies: | ||
- cf_xarray | ||
- codecov | ||
- intake-esm | ||
- joblib | ||
- nbsphinx | ||
- netcdf4 | ||
- numpydoc | ||
- pip | ||
- pre-commit | ||
- pydantic | ||
- pytest | ||
- pytest-cov | ||
- pytest-sugar | ||
- pytest-xdist | ||
- pyyaml | ||
- typer | ||
- xarray | ||
- pip: | ||
- git+https://github.com/xarray-contrib/cf-xarray | ||
- git+https://github.com/intake/intake-esm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters