Skip to content

Commit

Permalink
feat: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamc committed Feb 13, 2024
0 parents commit ac33181
Show file tree
Hide file tree
Showing 33 changed files with 1,381 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Issue Template
about: General template issues
labels:

---

* HyperSweeper version:
* Python version:
* Operating System:


<!--
Please file an issue for bug reports (label as `bug`), usage questions (label as `question`), feature requests (label as `feature request`), to notify us about upcoming contributions and any other topic that you think may be important discussing with us.
-->

#### Description
<!-- Describe what you were trying to do -->

#### Steps/Code to Reproduce
<!--
Please provide us with a minimal code example to reproduce your issue. If the code is too long, feel free to put it in a public gist and link it in the issue: https://gist.github.com
-->

#### Expected Results
<!-- Please paste or describe the expected results.-->

#### Actual Results
<!-- Please paste or specifically describe the actual output or traceback. If you cannot provide a full traceback, please include the kind of error you encounter as well as where it occurs in the code! -->

#### Additional Info

- Did you try upgrading to the most current version? yes/no
- Are you using a supported operating system (version)? yes/no
- How did you install this package (e.g. GitHub, pip, etc.)?

<!-- Thanks for contributing! -->
39 changes: 39 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
Thanks for contributing a pull request! Please ensure you have taken a look at the contribution guidelines in the CONTRIBUTING.md
-->

#### Reference Issues/PRs
<!--
Example: Fixes #1234. See also #3456.
Please use keywords (e.g., Fixes) to create link to the issues or pull requests you resolved, so that they will automatically be closed when your pull request is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests
-->

#### What does this implement/fix? Explain your changes.

<!--
Good PR descriptions help us immensely in reviewing and testing your PRs. This will make merging much faster and smoother for everyone involved.
Examples:
**Good:** Added Documentation -- documented the learning rate feature both in the code and the docs. Also added an example.
**Bad:** Explained learning rates
**Good:** Dask Parallelization Backend -- parallelization is now possible with dask. This meant some restructuring of the runner backend and testing, but shouldn't change usage at all.
**Bad:** new parallel feature
-->

#### Checklist

- Are the tests passing locally? yes/no
- Is the pre-commit passing locally? yes/no
- Are all new features documented in code and docs? yes/no
- Are all examples still running? yes/no
- Are the requirements up to date? yes/no
- Did you add yourself to the contributors in the authors file? yes/no

#### Any other comments?

<!--
We appreciate your effort, but please be aware that we are not working full-time on this project. We welcome any contribution and value your effort, no matter how minor they are. If we are slow to review, either the pull request needs some benchmarking, tinkering, convincing, etc. or more likely the reviewers are simply busy. In either case, we ask for your understanding during the review process.
Thanks for contributing!
-->
30 changes: 30 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 14

# Issues with these labels will never be considered stale
exemptLabels:
- bug
- dependency
- documentation
- enhancement
- feature
- test
- example
- discussion
- duplicate
- question

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
19 changes: 19 additions & 0 deletions .github/workflows/citation_cff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: cffconvert

on:
push:
paths:
- CITATION.cff

jobs:
validate:
name: "validate"
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v2

- name: Check whether the citation metadata from CITATION.cff is valid
uses: citation-file-format/[email protected]
with:
args: "--validate"
68 changes: 68 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Docs

on:
# Trigger on any push to the main
push:
branches:
- main
- development

# Trigger on any push to a PR that targets main
pull_request:
branches:
- main
- development

permissions:
contents: write

env:
name: HyperSweeper

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
pip install ".[dev]"
- name: Make docs
run: |
make clean
make docs
- name: Pull latest gh-pages
if: (contains(github.ref, 'development') || contains(github.ref, 'main'))
run: |
cd ..
git clone https://github.com/${{ github.repository }}.git --branch gh-pages --single-branch gh-pages
- name: Copy new docs into gh-pages
if: (contains(github.ref, 'development') || contains(github.ref, 'main'))
run: |
branch_name=${GITHUB_REF##*/}
cd ../gh-pages
rm -rf $branch_name
cp -r ../${{ env.name }}/docs/build/html $branch_name
- name: Push to gh-pages
if: (contains(github.ref, 'development') || contains(github.ref, 'main'))
run: |
last_commit=$(git log --pretty=format:"%an: %s")
cd ../gh-pages
branch_name=${GITHUB_REF##*/}
git add $branch_name/
git config --global user.name 'Github Actions'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "$last_commit"
git push
37 changes: 37 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: pre-commit

on:
# When a push occurs on either of these branches
push:
branches:
- main
- development

# When a push occurs on a PR that targets these branches
pull_request:
branches:
- main
- development

jobs:

run-all-files:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.10

- name: Install pre-commit
run: |
pip install pre-commit
pre-commit install
- name: Run pre-commit
run: |
pre-commit run --all-files
71 changes: 71 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Tests

on:
# Triggers with push to main
push:
branches:
- main
- development

# Triggers with push to a PR aimed at main
pull_request:
branches:
- main
- development

env:
package-name: "HyperSweeper"
test-dir: tests
extra-requires: "[dev]" # "" for no extra_requires

# Arguments used for pytest
pytest-args: >-
--durations=20
-v
jobs:

# General unit tests
source-test:
name: tests

runs-on: "ubuntu-latest"
defaults:
run:
shell: bash # Default to using bash on all

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.10

- name: Install ${{ env.package-name }}
run: |
python -m pip install --upgrade pip
python -m pip install wheel
python -m pip install -e ".${{ env.extra-requires }}"
- name: Store git status
id: status-before
shell: bash
run: |
echo "::set-output name=BEFORE::$(git status --porcelain -b)"
- name: Tests
run: |
pytest ${{ env.pytest-args }} ${{ env.test-dir }}
- name: Check for files left behind by test
run: |
before="${{ steps.status-before.outputs.BEFORE }}"
after="$(git status --porcelain -b)"
if [[ "$before" != "$after" ]]; then
echo "git status from before: $before"
echo "git status from after: $after"
echo "Not all generated files have been deleted!"
exit 1
fi
Loading

0 comments on commit ac33181

Please sign in to comment.