-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from centre-for-humanities-computing/update-c…
…ruft Updated cruft template
- Loading branch information
Showing
33 changed files
with
564 additions
and
1,286 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 |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
"email": "[email protected]", | ||
"friendly_name": "DaCy", | ||
"github_user": "centre-for-humanities-computing", | ||
"license": "MIT", | ||
"package_name": "dacy", | ||
"project_name": "dacy", | ||
"version": "2.4.2" | ||
|
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
# GitHub action to run linting | ||
|
||
name: run-pre-commit | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
cache: "pip" | ||
|
||
- name: Install pre-commit | ||
run: make install | ||
|
||
- name: Lint | ||
id: lint | ||
run: | | ||
make lint |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# We do not include static_type_checks as a pre-commit hook because pre-commit hooks | ||
# are installed in their own virtual environment, so static_type_checks cannot | ||
# use stubs from imports | ||
name: static_type_checks | ||
|
||
on: | ||
|
@@ -12,86 +9,26 @@ on: | |
jobs: | ||
static_type_checks: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
concurrency: | ||
group: "${{ github.workflow }} @ ${{ github.ref }}" | ||
cancel-in-progress: true | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.9"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Cache tox | ||
uses: actions/[email protected] | ||
id: cache_tox | ||
with: | ||
path: | | ||
.tox | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-static-type-checks | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
id: setup_python | ||
with: | ||
python-version: ${{ matrix.python-version}} | ||
cache: pip | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
pip install invoke tox pyright | ||
make install | ||
- name: Run static type checker | ||
id: pyright | ||
continue-on-error: true | ||
run: | | ||
if inv static-type-checks; then | ||
echo "pyright check passed" | ||
echo "pyright_failed=0" >> $GITHUB_OUTPUT | ||
else | ||
echo "pyright check failed" | ||
echo "pyright_failed=1" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Find Comment | ||
uses: peter-evans/find-comment@v2 | ||
id: find_comment | ||
if: ${{github.event_name == 'pull_request'}} | ||
continue-on-error: true | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: "github-actions[bot]" | ||
body-includes: ✨ Looks like pyright failed ✨ | ||
|
||
- uses: mshick/add-pr-comment@v2 | ||
if: ${{ steps.pyright.outputs.pyright_failed == 1 && github.event_name == 'pull_request'}} | ||
id: add_comment | ||
with: | ||
message: | | ||
✨ Looks like pyright failed ✨ | ||
If you want to fix this, we recommend doing it locally by either: | ||
a) Enabling pyright in VSCode and going through the errors in the problems tab | ||
`VSCode settings > Python > Analysis: Type checking mode > "basic"` | ||
b) Debugging via the command line | ||
1. Installing pyright, which is included in the dev dependencies: `pip install -e ".[dev]"` | ||
2. Diagnosing the errors by running `pyright .` | ||
- uses: mshick/add-pr-comment@v2 | ||
if: ${{ steps.pyright.outputs.pyright_failed == 0 && steps.find_comment.outputs.comment-id != '' && github.event_name == 'pull_request'}} | ||
with: | ||
message-id: ${{ steps.find_comment.outputs.comment-id }} | ||
message: | | ||
🌟 pyright succeeds! 🌟 | ||
- name: Show pyright output | ||
id: fail_run | ||
if: ${{steps.pyright.outputs.pyright_failed == 1}} | ||
shell: bash | ||
run: | | ||
inv static-type-checks # Rerunning pyright isn't optimal computationally, but typically takes no more than a couple of seconds, and this ensures that the errors are in the failing step | ||
make static-type-check |
Oops, something went wrong.