Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pre commit #12

Merged
merged 7 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

30 changes: 23 additions & 7 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# name: Run tests for parselmouth
# name: Run tests, pre-commit stuff and type checking for parselmouth

on:
push:
workflow_dispatch:
pull_request:
push:
branches: [ "main" ]
pull_request:

jobs:
run_tests:
runs-on: ubuntu-latest
Expand All @@ -22,6 +22,22 @@ jobs:
manifest-path: pyproject.toml

- name: run tests
run: |
run: |
pixi run run_tests


pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/[email protected]
with:
environments: >-
fmt
type-checking

- name: pre-commit
run: pixi run pre-commit-run --color=always --show-diff-on-failure --all

- name: type check
run: pixi run type-check
24 changes: 12 additions & 12 deletions .github/workflows/updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:


- name: pixi install
run: |
run: |
pixi install

- name: Generate combination of missing subdirs and letters
Expand All @@ -45,7 +45,7 @@ jobs:
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}

- name: Upload requested index.json
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -74,9 +74,9 @@ jobs:
manifest-path: pyproject.toml

- name: pixi install
run: |
run: |
pixi install

- name: Get partial index artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -90,16 +90,16 @@ jobs:
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}

- name: Upload partial index
uses: actions/upload-artifact@v4
with:
name: partial_index_${{ matrix.subdirs }}
path: output

updater_of_index:
runs-on: ubuntu-latest
needs: updater_of_records
needs: updater_of_records
steps:
- uses: actions/checkout@v4

Expand All @@ -111,9 +111,9 @@ jobs:
with:
pixi-version: "latest"
manifest-path: pyproject.toml

- name: pixi install
run: |
run: |
pixi install

- name: Get partial index artifacts
Expand All @@ -129,7 +129,7 @@ jobs:
R2_PREFIX_ACCESS_KEY_ID: ${{ secrets.R2_PREFIX_ACCESS_KEY_ID }}
R2_PREFIX_SECRET_ACCESS_KEY: ${{ secrets.R2_PREFIX_SECRET_ACCESS_KEY }}
R2_PREFIX_BUCKET: ${{ secrets.R2_PREFIX_BUCKET }}

update_file:
runs-on: ubuntu-latest
permissions:
Expand All @@ -139,7 +139,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -169,4 +169,4 @@ jobs:
git add files/mapping_as_grayskull.json
git add files/compressed_mapping.json
git commit -m "Update file via GitHub Action" || true
git push
git push
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ dmypy.json
# Cython debug symbols
cython_debug/

# DS_Store files
.DS_Store

# Vs code
.vscode/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand All @@ -163,4 +169,3 @@ mapping/*# pixi environments
.pixi
# pixi environments
.pixi

48 changes: 48 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
exclude: (^.pixi/|.snap|^files/)
repos:
- repo: local
hooks:
- id: pixi-install
name: pixi-install
entry: pixi install -e fmt
language: system
always_run: true
require_serial: true
pass_filenames: false
# pre-commit-hooks
- id: check-yaml
name: check-yaml
entry: pixi run -e fmt check-yaml
language: system
types: [yaml]
- id: end-of-file
name: end-of-file
entry: pixi run -e fmt end-of-file-fixer
language: system
types: [text]
stages: [commit, push, manual]
- id: trailing-whitespace
name: trailing-whitespace
entry: pixi run -e fmt trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]
# Use ruff for python examples
- id: ruff
name: ruff
entry: pixi run -e fmt ruff check --fix --exit-non-zero-on-fix --force-exclude
language: system
types_or: [python, pyi]
require_serial: true
- id: ruff-format
name: ruff-format
entry: pixi run -e fmt ruff format --force-exclude
language: system
types_or: [python, pyi]
require_serial: true
# typos
- id: typos
name: typos
entry: pixi run -e fmt typos --write-changes --force-exclude
language: system
types: [text]
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
https://www.contributor-covenant.org/translations.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ More simplified version of our mapping is stored here: `files/mapping_as_graysku


Developed with ❤️ at [prefix.dev](https://prefix.dev).

Loading