Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Nov 26, 2023
1 parent e3dd30c commit be49e1c
Show file tree
Hide file tree
Showing 38 changed files with 3,606 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
codecov:
branch: main

coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true

comment: false
13 changes: 13 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
exclude_patterns = [
"tests/**",
"*/print_versions.py",
"*/__init__.py"
]
version = 1

[[analyzers]]
enabled = true
name = "python"

[analyzers.meta]
runtime_version = "3.x.x"
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# reduce the number of merge conflicts
HISTORY.rst merge=union
# allow installing from git archives
.git_archival.txt export-subst
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [cheginit]
74 changes: 74 additions & 0 deletions .github/ISSUE_TEMPLATE/bugreport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: 🐛 Bug Report
description: File a bug report to help us improve
labels: [bug, needs triage]
body:
- type: textarea
id: what-happened
attributes:
label: What happened?
description: |
Thanks for reporting a bug! Please describe what you were trying to get done.
Tell us what happened, what went wrong.
validations:
required: true

- type: textarea
id: what-did-you-expect-to-happen
attributes:
label: What did you expect to happen?
description: |
Describe what you expected to happen.
validations:
required: false

- type: textarea
id: sample-code
attributes:
label: Minimal Complete Verifiable Example
description: |
Minimal, self-contained copy-pastable example that demonstrates the issue. This will be automatically formatted into code, so no need for markdown backticks.
render: Python

- type: checkboxes
id: mvce-checkboxes
attributes:
label: MVCE confirmation
description: |
Please confirm that the bug report is in an excellent state, so we can understand & fix it quickly & efficiently. For more details, check out:
- [Minimal Complete Verifiable Examples](https://stackoverflow.com/help/mcve)
- [Craft Minimal Bug Reports](http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
options:
- label: Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue.
- label: Complete example — the example is self-contained, including all data and the text of any traceback.
- label: New issue — a search of GitHub Issues suggests this is not a duplicate.

- type: textarea
id: log-output
attributes:
label: Relevant log output
description: Please copy and paste any relevant output/traceback. This will be automatically formatted into code, so no need for markdown backticks.
render: Python

- type: textarea
id: extra
attributes:
label: Anything else we need to know?
description: |
Please describe any other information you want to share.
- type: textarea
id: show-versions
attributes:
label: Environment
description: |
Paste the output of `pydaymet.show_versions()` between the `<details>` tags, leaving an empty line following the opening tag.
value: |
<details>
</details>
validations:
required: true
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: 💡 Ideas & Discussion
url: https://github.com/hyriver/hyriver.github.io/discussions/categories/ideas
about: Do you have an idea how to improve HyRiver? Feel free to post it to the discussion forum that allows voting for other users.
- name: ⁉️ Help & Support
url: https://github.com/hyriver/hyriver.github.io/discussions/categories/q-a
about: Need help with installation or usage of HyRiver? Please use the discussion forum.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/newfeature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 💡 Feature Request
description: Suggest an idea for HyRiver
labels: [enhancement]
body:
- type: textarea
id: description
attributes:
label: Is your feature request related to a problem?
description: |
Please do a quick search of existing issues to make sure that this has not been asked before.
Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: |
A clear and concise description of what you want to happen.
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: |
A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
id: additional-context
attributes:
label: Additional context
description: |
Add any other context about the feature request here.
validations:
required: false
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- Feel free to remove check-list items aren't relevant to your changes -->

- [ ] Closes #xxxx
- [ ] Tests added and `nox` passes.
- [ ] Passes `pre-commit run --all-files`
- [ ] Changes and the contributor name are documented in `HISTORY.rst`.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
commit-message:
prefix: 'BOT: [skip ci] '
35 changes: 35 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: 30 1 * * 0

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
CodeQL-Build:
runs-on: ubuntu-latest

permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linting

on:
pull_request:
workflow_dispatch: # allows you to trigger manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: excitedleigh/setup-nox@v2.1.0
- run: nox -s pre-commit
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Publish

on:
push:
tags:
- v*
workflow_dispatch: # allows you to trigger manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
changelog:
name: Create Release Notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate Changelog
run: |-
echo "Release Notes" > ${{ github.workflow }}-CHANGELOG.rst
echo "-------------" >> ${{ github.workflow }}-CHANGELOG.rst
PAT="^---"
L1=$(grep -n $PAT HISTORY.rst | sed -n 1p | cut -d ":" -f 1)
L2=$(grep -n $PAT HISTORY.rst | sed -n 2p | cut -d ":" -f 1)
awk "NR > $L1 && NR < $L2 - 1" HISTORY.rst >> ${{ github.workflow }}-CHANGELOG.rst
- name: Convert rst to md
uses: docker://pandoc/core
with:
args: >-
${{ github.workflow }}-CHANGELOG.rst
--wrap=none
-t markdown
-o ${{ github.workflow }}-CHANGELOG.md
- name: Remove extra spaces
run: |-
sed -i 's/- /- /g' ${{ github.workflow }}-CHANGELOG.md
- name: Github Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ github.workflow }}-CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
name: Create Release
runs-on: ubuntu-latest
env:
REPO_NAME: ${{ github.event.repository.name }}
name: pypi
url: https://pypi.org/p/${{ github.event.repository.name }}
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@master
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools setuptools-scm wheel twine check-manifest
- name: Build dist and wheel
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/${REPO_NAME}-0.0.0.tar.gz ]; then
echo "❌ INVALID VERSION NUMBER"
exit 1
else
echo "✅ Looks good"
fi
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.10
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: python ${{ matrix.python-version }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
REPO_NAME: ${{ github.event.repository.name }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
python-version: [3.8, '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- name: Set environment variables
run: |-
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ env.CONDA_ENV_FILE }}
environment-name: ${{ env.REPO_NAME }}-tests
create-args: >-
python=${{ env.PYTHON_VERSION }}
cache-environment: true
cache-environment-key: ${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}
- name: Install error reporter
if: ${{ matrix.os }} == 'ubuntu-latest' and ${{ matrix.python-version }} == '3.11'
run: |
python -m pip install pytest-github-actions-annotate-failures
- name: Install the package
run: |-
python -m pip install --no-deps .
- name: Version info
run: |-
NAME="$(echo ${REPO_NAME} | tr - _)"
python -c "import ${NAME}; ${NAME}.show_versions()"
- name: Run pytest
run: |-
pytest
- name: Run codecov and upload the report
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-umbrella
fail_ci_if_error: false
Loading

0 comments on commit be49e1c

Please sign in to comment.