-
Notifications
You must be signed in to change notification settings - Fork 0
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
matt-long
committed
Jan 29, 2023
0 parents
commit 463c64a
Showing
40 changed files
with
3,157 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
# - package-ecosystem: pip | ||
# directory: "/" | ||
# schedule: | ||
# interval: daily | ||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
# Check for updates once a week | ||
interval: 'weekly' |
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,67 @@ | ||
name: CI | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' # Daily “At 00:00” | ||
workflow_dispatch: # allows you to trigger manually | ||
|
||
jobs: | ||
skip-duplicate-jobs: | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.repository == 'c-worthy-ocean/ocean-c-lab' | ||
outputs: | ||
should_skip: ${{ steps.skip_check.outputs.should_skip }} | ||
steps: | ||
- id: skip_check | ||
uses: fkirc/[email protected] | ||
with: | ||
# For workflows which are triggered concurrently with the same | ||
# contents, attempt to execute them exactly once. | ||
concurrent_skipping: 'same_content_newer' | ||
paths_ignore: '["**/doc/**"]' | ||
|
||
build: | ||
name: python-${{ matrix.python-version }} | ||
needs: skip-duplicate-jobs | ||
if: ${{ needs.skip-duplicate-jobs.outputs.should_skip != 'true' }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.8', '3.9', '3.10'] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
channels: conda-forge,nodefaults | ||
channel-priority: strict | ||
activate-environment: c_worthy | ||
auto-update-conda: false | ||
python-version: ${{ matrix.python-version }} | ||
environment-file: ci/environment.yml | ||
mamba-version: '*' | ||
use-mamba: true | ||
miniforge-variant: Mambaforge | ||
|
||
- name: Install ocean-c-lab | ||
run: | | ||
python -m pip install -e . --no-deps --force-reinstall | ||
conda list | ||
- name: Run Tests | ||
run: | | ||
python -m pytest | ||
- name: Upload code coverage to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
file: ./coverage.xml | ||
flags: unittests | ||
env_vars: OS,PYTHON | ||
name: codecov-umbrella | ||
fail_ci_if_error: false |
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,78 @@ | ||
name: Build distribution | ||
on: | ||
release: | ||
types: | ||
- published | ||
push: | ||
|
||
jobs: | ||
build-artifacts: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'c-worthy-ocean/ocean-c-lab' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/[email protected] | ||
name: Install Python | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install setuptools setuptools-scm wheel twine check-manifest | ||
- name: Build tarball and wheels | ||
run: | | ||
git clean -xdf | ||
git restore -SW . | ||
python -m build --sdist --wheel . | ||
- name: Check built artifacts | ||
run: | | ||
python -m twine check dist/* | ||
pwd | ||
if [ -f dist/ocean-c-lab-0.0.0.tar.gz ]; then | ||
echo "❌ INVALID VERSION NUMBER" | ||
exit 1 | ||
else | ||
echo "✅ Looks good" | ||
fi | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: releases | ||
path: dist | ||
|
||
test-built-dist: | ||
needs: build-artifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
name: Install Python | ||
with: | ||
python-version: 3.8 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: releases | ||
path: dist | ||
- name: List contents of built dist | ||
run: | | ||
ls -ltrh | ||
ls -ltrh dist | ||
upload-to-pypi: | ||
needs: test-built-dist | ||
if: github.event_name == 'release' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: releases | ||
path: dist | ||
- name: Publish package to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
verbose: true |
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,89 @@ | ||
name: Upstream CI | ||
on: | ||
push: | ||
schedule: | ||
- cron: '0 0 * * *' # Daily “At 00:00” UTC | ||
workflow_dispatch: # allows you to trigger the workflow run manually | ||
|
||
jobs: | ||
upstream-dev: | ||
name: upstream-dev | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.10'] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
id: conda | ||
with: | ||
channels: conda-forge,nodefaults | ||
channel-priority: strict | ||
activate-environment: c-worthy-upstream | ||
auto-update-conda: false | ||
python-version: ${{ matrix.python-version }} | ||
environment-file: ci/upstream-dev-environment.yml | ||
mamba-version: '*' | ||
use-mamba: true | ||
miniforge-variant: Mambaforge | ||
|
||
- name: Install ocean-c-lab | ||
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@v6 | ||
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') | ||
} |
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,135 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Dask | ||
dask-worker-space/ | ||
|
||
# Vscode | ||
.vscode/ |
Oops, something went wrong.