Skip to content

Commit

Permalink
ci: add actionlint in CI (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Dec 20, 2024
1 parent f78f740 commit bfa3c18
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Create release
run-name: "Release ${{ format('{0} (type: {1}) (branch: {2})', inputs.tag, inputs.release_type, github.ref_name) }} "
run-name: "Release ${{ format('{0} (branch: {1})', inputs.tag, github.ref_name) }} "

on:
workflow_dispatch:
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ on:
workflow_call: {}

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: jdx/mise-action@v2
with:
install: false

- name: Run lint.actions
run: make lint.actions

test-unit:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -125,6 +137,7 @@ jobs:
- generate
- apply
- lint
- actionlint
- CRDs-validation
if: always()
steps:
Expand Down
4 changes: 4 additions & 0 deletions .tools_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ yq: "4.44.6"
gotestsum: "1.12.0"
# renovate: datasource=github-releases depName=golangci/golangci-lint
golangci-lint: "1.62.2"
# renovate: datasource=github-releases depName=rhysd/actionlint
actionlint: "1.7.4"
# renovate: datasource=github-releases depName=koalaman/shellcheck
shellcheck: "0.10.0"
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ golangci-lint: mise yq ## Download golangci-lint locally if necessary.
@$(MISE) plugin install --yes -q golangci-lint
@$(MISE) install -q golangci-lint@$(GOLANGCI_LINT_VERSION)

ACTIONLINT_VERSION = $(shell $(YQ) -r '.actionlint' < $(TOOLS_VERSIONS_FILE))
ACTIONLINT = $(PROJECT_DIR)/bin/installs/actionlint/$(ACTIONLINT_VERSION)/bin/actionlint
.PHONY: download.actionlint
download.actionlint: mise yq ## Download actionlint locally if necessary.
@$(MISE) plugin install --yes -q actionlint
@$(MISE) install -q actionlint@$(ACTIONLINT_VERSION)

SHELLCHECK_VERSION = $(shell $(YQ) -r '.shellcheck' < $(TOOLS_VERSIONS_FILE))
SHELLCHECK = $(PROJECT_DIR)/bin/installs/shellcheck/$(SHELLCHECK_VERSION)/bin/shellcheck
.PHONY: download.shellcheck
download.shellcheck: mise yq ## Download shellcheck locally if necessary.
@$(MISE) plugin install --yes -q shellcheck
@$(MISE) install -q shellcheck@$(SHELLCHECK_VERSION)

# ------------------------------------------------------------------------------
# Verify steps
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -193,6 +207,10 @@ GOLANGCI_LINT_CONFIG ?= $(PROJECT_DIR)/.golangci.yaml
lint: golangci-lint
$(GOLANGCI_LINT) run -v --config $(GOLANGCI_LINT_CONFIG) $(GOLANGCI_LINT_FLAGS)

.PHONY: lint.actions
lint.actions: download.actionlint download.shellcheck
$(ACTIONLINT) -shellcheck $(SHELLCHECK) ./.github/workflows/*

.PHONY: test.samples
test.samples: kustomize
find ./config/samples -not -name "kustomization.*" -type f | sort | xargs -I{} bash -c "kubectl apply -f {}; kubectl delete -f {}"
Expand Down

0 comments on commit bfa3c18

Please sign in to comment.