Skip to content

Commit

Permalink
Updated cruft template
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethEnevoldsen committed Dec 6, 2023
1 parent 6e0f04f commit 6cbeb42
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 839 deletions.
1 change: 0 additions & 1 deletion .cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/KennethEnevoldsen/swift-python-cookiecutter",
"commit": "7fdb02999e8596c525377c208ca902645d134f97",
"commit": "e96eb05162a0e45a8ad5aa446c72229372e79cdb",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -12,12 +12,11 @@
"github_user": "centre-for-humanities-computing",
"version": "2.4.2",
"copyright_year": "2023",
"license": "MIT",
"_copy_without_render": [
"*.github"
],
"_template": "https://github.com/KennethEnevoldsen/swift-python-cookiecutter"
}
},
"directory": null
}
}
16 changes: 0 additions & 16 deletions .github/dependabot.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/check_for_rej.yml

This file was deleted.

66 changes: 0 additions & 66 deletions .github/workflows/cruft.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/dependabot_automerge.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
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
79 changes: 0 additions & 79 deletions .github/workflows/pre-commit.yml

This file was deleted.

71 changes: 4 additions & 67 deletions .github/workflows/static_type_checks.yml
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:
Expand All @@ -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-checks
Loading

0 comments on commit 6cbeb42

Please sign in to comment.