diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..c669748 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,51 @@ +name: 🐛 Bug report +description: Report a bug currently impacting orca_python. +title: "BUG: " +labels: ["bug"] + +body: +- type: markdown + attributes: + value: > + #### You can see if the bug has already been addressed by searching + through the open and closed [issues](https://github.com/ayrna/orca_python/issues?q=is%3Aissue). +- type: textarea + attributes: + label: Describe the bug + description: > + A clear and concise description of what the bug is. + validations: + required: true +- type: textarea + attributes: + label: Steps/Code to reproduce the bug + description: | + Please include a [minimal reproducible example](https://stackoverflow.com/help/mcve) so users can reproduce the error when running it. Be as succinct as possible, and do not depend on external data files. + + If the code is too long, feel free to put it in a public [gist](https://gist.github.com) and link it in the issue. + placeholder: | + ```python + Your code here. placing your code between three backticks will format it like the above example. + ``` +- type: textarea + attributes: + label: Expected results + description: > + Please provide a clear and concise description of the expected results or paste the correct output if available. + placeholder: > + For example: No error is thrown, or y_name1 == y_name2. + validations: + required: true +- type: textarea + attributes: + label: Actual results + description: | + Please provide a clear and concise description of the actual seen results or paste the incorrect output if available. + + If you observe an error, please paste the error message including the full traceback of the exception. + placeholder: | + ```python-traceback + Place traceback error here if applicable. If your issue has no traceback, please describe the observed output without formatting. + ``` + validations: + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/doc_improvement.yml b/.github/ISSUE_TEMPLATE/doc_improvement.yml new file mode 100644 index 0000000..cd1121d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/doc_improvement.yml @@ -0,0 +1,18 @@ +name: 📖 Documentation improvement +description: Create a report to help us improve the orca_python documentation. +title: "DOC: " +labels: ["documentation"] + +body: +- type: textarea + attributes: + label: Describe the issue linked to the documentation + description: > + Tell us what part of the documentation you think needs improvement. + validations: + required: true +- type: textarea + attributes: + label: Suggest a potential alternative/fix + description: > + Tell us how you think the documentation could be improved. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..c2111a5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,30 @@ +name: 🚀 Feature request +description: Suggest a new feature or idea for orca_python. +title: "ENH: " +labels: ["enhancement"] + +body: +- type: textarea + attributes: + label: Describe the feature or idea you want to propose + description: > + Please provide a clear and concise description of the feature or idea you are proposing. + validations: + required: true +- type: textarea + attributes: + label: Describe your proposed solution + description: > + Please provide a description of your desired outcome, ideally aligning with the existing toolbox design, classes, and methods. + validations: + required: true +- type: textarea + attributes: + label: Describe alternatives you have considered, if relevant + description: > + Please provide any alternative solutions or features you have considered. +- type: textarea + attributes: + label: Additional context + description: > + Add any other context about the problem here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/other_issue.yml b/.github/ISSUE_TEMPLATE/other_issue.yml new file mode 100644 index 0000000..ad364e9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other_issue.yml @@ -0,0 +1,21 @@ +name: ❗ Other issue +description: Other issue not covered by the other templates. +title: "MNT: " +labels: ["maintenance"] + +body: +- type: markdown + attributes: + value: > + If the issue is maintenance related, please start the title with MNT: and add the maintenance tag, or use any other tag available in the repository. +- type: textarea + attributes: + label: Describe the issue + validations: + required: true +- type: textarea + attributes: + label: Suggest a potential alternative/fix +- type: textarea + attributes: + label: Additional context \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..3947512 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ + + +#### Reference Issues/PRs + + + +#### What does this implement/fix? Explain your changes + + + +#### Any other comments? + + \ No newline at end of file diff --git a/.github/workflows/pr_precommit.yml b/.github/workflows/pr_precommit.yml new file mode 100644 index 0000000..8dcb511 --- /dev/null +++ b/.github/workflows/pr_precommit.yml @@ -0,0 +1,62 @@ +name: PR pre-commit + +on: + push: + branches: + - main + pull_request_target: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + + +jobs: + pre-commit: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_KEY }} + + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + token: ${{ steps.app-token.outputs.token }} + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - uses: tj-actions/changed-files@v46.0.5 + id: changed-files + + - name: List changed files + run: echo '${{ steps.changed-files.outputs.all_changed_files }}' + + # only check the full repository if PR and correctly labelled + - if: ${{ github.event_name != 'pull_request_target' || contains(github.event.pull_request.labels.*.name, 'full pre-commit') }} + name: Full pre-commit + uses: pre-commit/action@v3.0.1 + with: + extra_args: --all-files + - if: ${{ github.event_name == 'pull_request_target' && !contains(github.event.pull_request.labels.*.name, 'full pre-commit') }} + name: Local pre-commit + uses: pre-commit/action@v3.0.1 + with: + extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }} + + # push fixes if pre-commit fails and PR is eligible + - if: ${{ failure() && github.event_name == 'pull_request_target' && !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name, 'stop pre-commit fixes') }} + name: Push pre-commit fixes + uses: stefanzweifel/git-auto-commit-action@v6 + with: + commit_message: Automatic `pre-commit` fixes + commit_user_name: ayrna-actions-bot[bot] + create_branch: false diff --git a/.github/workflows/pr_pytest.yml b/.github/workflows/pr_pytest.yml new file mode 100644 index 0000000..a4ab8f2 --- /dev/null +++ b/.github/workflows/pr_pytest.yml @@ -0,0 +1,67 @@ +name: Run Tests + +on: + push: + branches: + - main + paths: + - "orca_python/**" + - ".github/workflows/**" + - "pyproject.toml" + pull_request: + branches: + - main + paths: + - "orca_python/**" + - ".github/workflows/**" + - "pyproject.toml" + +jobs: + pytest: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04] + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run tests + run: pytest -n auto + + tests-dev-docs: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev,docs]" + + - name: Run tests + run: pytest diff --git a/pyproject.toml b/pyproject.toml index 0af731c..62c4127 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,8 @@ dev = [ "black", "pre-commit", "pytest", - "pytest-cov" + "pytest-cov", + "pytest-xdist[psutil]" ] [project.urls]