-
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
0 parents
commit e1874d8
Showing
24 changed files
with
1,083 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,6 @@ | ||
[flake8] | ||
exclude = | ||
.git, | ||
__pycache__, | ||
build | ||
max-complexity = 10 |
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,38 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
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,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
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,27 @@ | ||
--- | ||
name: User story | ||
about: This template provides a basic structure for user story issues. | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
# User story | ||
As a ..., I want to ..., so I can ... | ||
|
||
*Ideally, this is in the issue title, but if not, you can put it here. If so, delete this section.* | ||
|
||
# Acceptance criteria | ||
- [ ] This is something that can be verified to show that this user story is satisfied. | ||
|
||
# Sprint Ready Checklist | ||
- [ ] 1. Acceptance criteria defined | ||
- [ ] 2. Team understands acceptance criteria | ||
- [ ] 3. Team has defined solution / steps to satisfy acceptance criteria | ||
- [ ] 4. Acceptance criteria is verifiable / testable | ||
- [ ] 5. External / 3rd Party dependencies identified | ||
- [ ] 6. Ticket is prioritized and sized | ||
|
||
# Notes | ||
*Add any helpful notes here.* |
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,52 @@ | ||
# Workflow runs only once when the template is first used. | ||
# File can be safely deleted after repo is initialized. | ||
name: Initialize repository | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
initialize-package: | ||
name: Initialize the package | ||
if: ${{github.event.repository.name != 'aind-library-template'}} | ||
runs-on: ubuntu-latest | ||
env: | ||
REPO_NAME: ${{ github.event.repository.name }} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Rename package | ||
run: | | ||
pkg_name=$(echo "${REPO_NAME}" | tr - _) | ||
current_description='description = "Prints messages to stdout. Simple boilerplate for libraries."' | ||
new_description='description = "Generated from aind-library-template"' | ||
readme_description='Template for a minimal, basic repository for an AIND library.' | ||
new_readme_description='Generated from aind-library-template' | ||
echo "Package Name ${pkg_name}" | ||
mkdir src/${pkg_name} | ||
touch src/${pkg_name}/__init__.py | ||
echo '"""Init package"""' >> src/${pkg_name}/__init__.py | ||
echo '__version__ = "0.0.0"' >> src/${pkg_name}/__init__.py | ||
sed -i "s/aind_library_template/${pkg_name}/" pyproject.toml | ||
sed -i "s/aind-library-template/${REPO_NAME}/" pyproject.toml | ||
sed -i "s/aind_library_template/${pkg_name}/" doc_template/source/conf.py | ||
sed -i "s/${current_description}/${new_description}/" pyproject.toml | ||
sed -i "/pandas/d" pyproject.toml | ||
sed -i "s/aind-library-template/${REPO_NAME}/" README.md | ||
sed -i "s/${readme_description}/${new_readme_description}/" README.md | ||
- name: Commit changes | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
default_author: github_actions | ||
message: "ci: version bump [skip actions]" | ||
add: '["pyproject.toml", "README.md", "src/*", "doc_template/source/conf.py"]' | ||
remove: '["-r src/aind_library_template", "tests/test_message_handler.py"]' | ||
- name: Add first tag | ||
run: | | ||
git tag v0.0.0 | ||
git push origin v0.0.0 | ||
- name: Disable workflow | ||
run: | | ||
gh workflow disable -R $GITHUB_REPOSITORY "${{ github.workflow }}" |
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: Tag and publish | ||
on: | ||
push: | ||
branches: | ||
- main | ||
# Remove line 65 to enable automated semantic version bumps. | ||
# Change line 71 from "if: false" to "if: true" to enable PyPI publishing. | ||
# Requires that svc-aindscicomp be added as an admin to repo. | ||
jobs: | ||
update_badges: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.DEFAULT_BRANCH }} | ||
fetch-depth: 0 | ||
token: ${{ secrets.SERVICE_TOKEN }} | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -e .[dev] --no-cache-dir | ||
- name: Get Python version and Update README.md | ||
run: | | ||
python_version=$(grep "requires-python" pyproject.toml | grep -o ">=[^\"]*") | ||
python_badge=$(grep -o 'python-[^)]*' README.md) | ||
new_python_badge="python-$python_version-blue?logo=python" | ||
sed -i "s/$python_badge/$new_python_badge/g" README.md | ||
- name: Get interrogate values and Update README.md | ||
run: | | ||
interrogate_val=$(interrogate . | grep -o 'actual: [0-9]*\.[0-9]*' | awk '{print $2}') | ||
interrogate_badge=$(grep -o 'interrogate-[^)]*' README.md) | ||
if (( $(echo "$interrogate_val >= 90.00" | bc -l) )); then | ||
new_interrogate_badge="interrogate-$interrogate_val%25-brightgreen" | ||
elif (( $(echo "$interrogate_val < 80.00" | bc -l) )); then | ||
new_interrogate_badge="interrogate-$interrogate_val%25-red" | ||
else | ||
new_interrogate_badge="interrogate-$interrogate_val%25-yellow" | ||
fi | ||
sed -i "s/$interrogate_badge/$new_interrogate_badge/g" README.md | ||
- name: Get Coverage values and Update README.md | ||
run: | | ||
coverage run -m unittest discover | ||
coverage_val=$(coverage report | grep "^TOTAL" | grep -o '[0-9]\+%' | grep -o '[0-9]\+') | ||
coverage_badge=$(grep -o "coverage-[^?]*" README.md) | ||
if (( $(echo "$coverage_val >= 90.00" | bc -l) )); then | ||
new_coverage_badge="coverage-$coverage_val%25-brightgreen" | ||
elif (( $(echo "$coverage_val < 80.00" | bc -l) )); then | ||
new_coverage_badge="coverage-$coverage_val%25-red" | ||
else | ||
new_coverage_badge="coverage-$coverage_val%25-yellow" | ||
fi | ||
sed -i "s/$coverage_badge/$new_coverage_badge/g" README.md | ||
- name: Commit changes | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
default_author: github_actions | ||
message: "ci: update badges [skip actions]" | ||
add: '["README.md"]' | ||
tag: | ||
needs: update_badges | ||
if: ${{github.event.repository.name == 'aind-library-template'}} | ||
uses: AllenNeuralDynamics/aind-github-actions/.github/workflows/tag.yml@main | ||
secrets: | ||
SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }} | ||
publish: | ||
needs: tag | ||
if: false | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Pull latest changes | ||
run: git pull origin main | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade setuptools wheel twine build | ||
python -m build | ||
twine check dist/* | ||
- name: Publish on PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.AIND_PYPI_TOKEN }} |
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,26 @@ | ||
name: Lint and run tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [ '3.8', '3.9', '3.10' ] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install -e .[dev] | ||
- name: Run linter checks | ||
run: flake8 . && interrogate --verbose . | ||
- name: Run tests and coverage | ||
run: coverage run -m unittest discover && coverage report |
Oops, something went wrong.