diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7b0e5a4..b1c0621 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,15 +16,25 @@ jobs: - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" + uses: golangci/golangci-lint-action@v6 + + # uses: actions/setup-go@v4 + # with: + # go-version: "1.20" - name: Install linux deps run: | sudo apt-get update sudo apt-get -y install libvips-dev + - name: Install pre-commit + run: | + python -m pip install --upgrade pip + pip install pre-commit + + - name: Run pre-commit + run: pre-commit run --all-files + - name: Build run: cd src/cmd/main && go build -v main.go diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7127eaf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - repo: https://github.com/dnephin/pre-commit-golang + rev: v0.5.1 + hooks: + - id: go-fmt + - id: go-imports + - id: golangci-lint + args: ["run", "src"] diff --git a/MANIFEST.in b/MANIFEST.in index f0177f0..8bf9108 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,4 @@ include *.md include *.py include datago/*.h include datago/*.c -include datago/*.so \ No newline at end of file +include datago/*.so diff --git a/generate_python_package.sh b/generate_python_package.sh index 2839eb2..3eeee94 100755 --- a/generate_python_package.sh +++ b/generate_python_package.sh @@ -22,5 +22,3 @@ rm LICENSE rm MANIFEST.in cd ../../.. - - diff --git a/pyproject.toml b/pyproject.toml index 1b6f0d6..56ccdfb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,4 +15,4 @@ classifiers = [ [project.urls] Homepage = "https://github.com/photoroom/datago" -Issues = "https://github.com/photoroom/datago/issues" \ No newline at end of file +Issues = "https://github.com/photoroom/datago/issues" diff --git a/requirements.txt b/requirements.txt index 55b033e..e079f8a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pytest \ No newline at end of file +pytest diff --git a/src/polyglot.py b/src/polyglot.py index 98202d3..dab8fb7 100644 --- a/src/polyglot.py +++ b/src/polyglot.py @@ -63,4 +63,4 @@ def go_array_to_pil_image(go_array): return Image.frombuffer("RGBA", (w, h), np_array, "raw", "RGBA", 0, 1) assert c == 3, "Expected 3 channels" - return Image.fromarray(np_array) \ No newline at end of file + return Image.fromarray(np_array)