Skip to content

Commit

Permalink
Add black to pre-commit and Add lint CI job (#39)
Browse files Browse the repository at this point in the history
Summary:
It works: https://github.com/pytorch-labs/torchcodec/actions/runs/9551252976/job/26325153079?pr=39

Pull Request resolved: #39

Reviewed By: ahmadsharif1

Differential Revision: D58676975

Pulled By: NicolasHug

fbshipit-source-id: b0a0b6ccabff1ebaf7a9e6f3fa5cc1beed9fdbb2
  • Loading branch information
NicolasHug authored and facebook-github-bot committed Jun 17, 2024
1 parent e77d0f8 commit 58350e1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint

on:
push:
branches: [ main ]
pull_request:

concurrency:
group: unit-test${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l -eo pipefail {0}

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.12']
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: test
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install pre-commit
run: |
python -m pip install pre-commit
- name: Run pre-commit checks
run: |
pre-commit run --all-files
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ repos:
- id: check-added-large-files
args: ['--maxkb=1000']

# - repo: https://github.com/omnilib/ufmt
# rev: v2.3.0
# hooks:
# - id: ufmt
# additional_dependencies:
# - black == 22.12.0
# - usort == 1.0.5
- repo: https://github.com/omnilib/ufmt
rev: v2.6.0
hooks:
- id: ufmt
additional_dependencies:
- black == 24.4.2
- usort == 1.0.5

- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
Expand Down

0 comments on commit 58350e1

Please sign in to comment.