Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethEnevoldsen committed Dec 7, 2023
2 parents 90d7b0b + c2bf0cf commit 07c5edc
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 377 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": "Kennethcenevoldsen@gmail.com",
"friendly_name": "Scandinavian Embedding Benchmark",
"github_user": "KennethEnevoldsen",
"license": "MIT",
"package_name": "seb",
"project_name": "scandinavian-embedding-benchmark",
"version": "0.0.0"
Expand Down
7 changes: 3 additions & 4 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/MartinBernstorff/swift-python-cookiecutter",
"commit": "7fdb02999e8596c525377c208ca902645d134f97",
"template": "https://github.com/KennethEnevoldsen/swift-python-cookiecutter",
"commit": "c5698bd37fe84cdc5f5f411a56a49c2f5db77dab",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -12,11 +12,10 @@
"github_user": "KennethEnevoldsen",
"version": "0.0.0",
"copyright_year": "2023",
"license": "MIT",
"_copy_without_render": [
"*.github"
],
"_template": "https://github.com/MartinBernstorff/swift-python-cookiecutter"
"_template": "https://github.com/KennethEnevoldsen/swift-python-cookiecutter"
}
},
"directory": null
Expand Down
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-linting

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 dependencies
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.

4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# - Upload the package to PyPI
# - Create a release on GitHub

# This workflow required the following secrets to be set:
# - a GitHub personal access token with the `repo` scope called `PAT`
# - and that you setup trusted publishing using PyPI as described here: https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/

name: Release
on:
workflow_run:
Expand Down
70 changes: 4 additions & 66 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,27 @@ 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/cache@v3.2.6
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
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
Loading

0 comments on commit 07c5edc

Please sign in to comment.