Skip to content

Commit

Permalink
pre-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
toozej committed May 25, 2024
1 parent 71237ea commit d38fd21
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Workflow for building and deploying a Hugo site to GitHub Pages from https://gohugo.io/hosting-and-deployment/hosting-on-github/
name: Deploy Hugo site to Pages

Expand Down Expand Up @@ -37,7 +38,7 @@ jobs:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
# disabled since not used for this site
#- name: Install Dart Sass
# run: sudo snap install dart-sass
Expand All @@ -62,7 +63,7 @@ jobs:
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand All @@ -79,4 +80,3 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

33 changes: 10 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ minimum_pre_commit_version: "1.15"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml
name: Check for valid YAML syntax in repo
Expand All @@ -24,14 +24,14 @@ repos:
name: Ensure line-ending is consistent
description: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/mixed_line_ending.py
files: \.(sh|yaml|yml)$
- id: check-executables-have-shebangs
name: Checks that non-binary executables have a proper shebang
description: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/check_executables_have_shebangs.py
files: \.(sh)$
- id: check-shebang-scripts-are-executable
name: Checks that scripts with shebangs are executable.
description: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/check_shebang_scripts_are_executable.py
files: \.(sh)$
#- id: check-executables-have-shebangs
# name: Checks that non-binary executables have a proper shebang
# description: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/check_executables_have_shebangs.py
# files: \.(sh)$
#- id: check-shebang-scripts-are-executable
# name: Checks that scripts with shebangs are executable.
# description: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/check_shebang_scripts_are_executable.py
# files: \.(sh)$
#- id: check-json
# name: Attempts to load all json files to verify syntax.
# description: https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/check_json.py
Expand All @@ -52,19 +52,6 @@ repos:
- id: yamlfmt
args: [--mapping, "2", --sequence, "4", --offset, "2", --width, "88", --preserve-quotes]

# run shellcheck on Bash scripts
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.10.0
hooks:
- id: shellcheck

# lint Dockerfile
- repo: https://github.com/hadolint/hadolint
rev: v2.12.1-beta
hooks:
- id: hadolint-docker
args: ["--ignore", "DL3007"]

# lint Makefile
- repo: https://github.com/mrtazz/checkmake/
rev: 0.2.2
Expand All @@ -74,7 +61,7 @@ repos:

# run semgrep on all known filetypes
- repo: https://github.com/returntocorp/semgrep
rev: 'v1.66.0'
rev: 'v1.73.0'
hooks:
- id: semgrep
# See https://semgrep.dev/explore to select a ruleset and copy its URL
Expand Down
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ MAKEFLAGS += --no-builtin-rules
.DEFAULT_GOAL := help

# Build info
BUILDER = $(shell whoami)@$(shell hostname)
NOW = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")

OPTIMIZE = find $(CURDIR)/public/ -not -path "*/static/*" \( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' -o -name '*.JPG' \) -print0 | \
xargs -0 -P8 -n2 mogrify -strip -thumbnail '1000>'

Expand All @@ -22,7 +19,7 @@ else
OPENER=open
endif

.PHONY: all pre-reqs pre-commit pre-commit-install pre-commit-run build deploy serve run clean help
.PHONY: all pre-reqs pre-commit pre-commit-install pre-commit-run build deploy serve run clean test help

all: pre-reqs pre-commit clean build serve ## Default workflow

Expand All @@ -49,8 +46,8 @@ pre-commit-install: ## Install pre-commit hooks and necessary binaries
go install github.com/mrtazz/checkmake/cmd/checkmake@latest
# syft
command -v syft || curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
# cosign
go install github.com/sigstore/cosign/cmd/cosign@latest
# pre-commit
command -v pre-commit || brew install pre-commit || sudo dnf install -y pre-commit || sudo apt install -y pre-commit
# install and update pre-commits
pre-commit install
pre-commit autoupdate
Expand Down

0 comments on commit d38fd21

Please sign in to comment.