From d5676c7eeffe2ffe3a32e9fdeb4198faca9fe198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Thu, 26 Jun 2025 13:20:04 +0200 Subject: [PATCH 01/10] Add GitHub Actions workflow for pre-commit checks on PRs --- .github/workflows/pr_precommit.yml | 62 ++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/pr_precommit.yml 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 From a42fd659a6e47a57df47fc26f9877812f3cf886c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Thu, 26 Jun 2025 13:38:54 +0200 Subject: [PATCH 02/10] Add CI workflow to run tests on push and pull requests --- .github/workflows/pr_pytest.yml | 67 +++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/pr_pytest.yml diff --git a/.github/workflows/pr_pytest.yml b/.github/workflows/pr_pytest.yml new file mode 100644 index 0000000..81787dd --- /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, macos-14, windows-2022] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + 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 .[dev] + + - name: Run tests + run: python -m pytest -n logical + + tests-dev-docs: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + 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 .[dev,docs] + + - name: Run tests + run: pytest From e7d00a13d28298c5861419fce17322a0a4a32022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Thu, 26 Jun 2025 13:45:04 +0200 Subject: [PATCH 03/10] Add issue template for bug reports --- .github/ISSUE_TEMPLATE/bug_report.yml | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml 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 From 025b912b289ef1aa5e5eec26b0357629ebe2daa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Thu, 26 Jun 2025 13:46:07 +0200 Subject: [PATCH 04/10] Add issue template for documentation improvements --- .github/ISSUE_TEMPLATE/doc_improvement.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/doc_improvement.yml 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 From ec1ce8c911a91d13381cca806b4cdef2c3de7c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Thu, 26 Jun 2025 13:47:09 +0200 Subject: [PATCH 05/10] Add issue template for feature requests --- .github/ISSUE_TEMPLATE/feature_request.yml | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml 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 From 3e5fabe9869aab86b92262c10d47602adaa35248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Thu, 26 Jun 2025 13:48:46 +0200 Subject: [PATCH 06/10] Add general issue template for uncategorized reports --- .github/ISSUE_TEMPLATE/other_issue.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/other_issue.yml 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 From 00c39e8d85a1a4f5fed0ccb9ba57f81f5deffef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Tue, 1 Jul 2025 08:36:56 +0200 Subject: [PATCH 07/10] Add template for pull request --- .github/PULL_REQUEST_TEMPLATE.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md 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 From 4daca3cfe140c81e62dea577dec8b94e64c15942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Tue, 1 Jul 2025 09:19:46 +0200 Subject: [PATCH 08/10] Add pytest-xdist to dev dependencies --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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] From 2b27f620254407a2d0161d5bd9e49caad64b0e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Tue, 1 Jul 2025 09:25:43 +0200 Subject: [PATCH 09/10] Update CI workflow to run tests on push and pull requests --- .github/workflows/pr_pytest.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_pytest.yml b/.github/workflows/pr_pytest.yml index 81787dd..3951a00 100644 --- a/.github/workflows/pr_pytest.yml +++ b/.github/workflows/pr_pytest.yml @@ -38,10 +38,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[dev] + pip install -e ".[dev]" - name: Run tests - run: python -m pytest -n logical + run: pytest -n auto tests-dev-docs: runs-on: ubuntu-22.04 @@ -61,7 +61,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[dev,docs] + pip install -e ".[dev,docs]" - name: Run tests run: pytest From bbab01e593df894952f3c955db33fd37956485f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sevilla=20Molina?= Date: Tue, 1 Jul 2025 09:30:57 +0200 Subject: [PATCH 10/10] Update CI workflow to run tests on push and pull requests --- .github/workflows/pr_pytest.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_pytest.yml b/.github/workflows/pr_pytest.yml index 3951a00..a4ab8f2 100644 --- a/.github/workflows/pr_pytest.yml +++ b/.github/workflows/pr_pytest.yml @@ -23,8 +23,8 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, macos-14, windows-2022] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-24.04] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout @@ -47,7 +47,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - name: Checkout repository