bazel: add actionlint to //:check

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-16 17:07:06 +01:00
parent 62e2e70699
commit 3a04786412
9 changed files with 103 additions and 49 deletions

View File

@ -65,7 +65,7 @@ jobs:
echo "Newest 10 versions shouldn't be deleted"
deletable=$(echo "${versions}" | head -n -10)
if [ -z "${deletable}" ]; then
if [[ -z "${deletable}" ]]; then
echo "No deletable versions found"
exit 0
fi

View File

@ -1,41 +0,0 @@
name: Actionlint
on:
workflow_dispatch:
push:
branches:
- main
- "release/**"
paths:
- ".github/**.yml"
pull_request:
paths:
- ".github/**.yml"
jobs:
actionlint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
- name: Setup Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: "1.20.2"
cache: true
- name: Install ShellCheck
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # v2.0.0
with:
ignore_paths: "*"
- name: Install Actionlint
shell: bash
run: go install github.com/rhysd/actionlint/cmd/actionlint@7fdc9630cc360ea1a469eed64ac6d78caeda1234 # v1.6.22
- name: Run Actionlint
shell: bash
run: actionlint

View File

@ -92,6 +92,24 @@ sh_template(
template = "shellcheck.sh.in",
)
sh_template(
name = "actionlint",
data = [
":com_github_koalaman_shellcheck",
"@com_github_rhysd_actionlint//cmd/actionlint",
],
substitutions = {
"@@ACTIONLINT@@": "$(rootpath @com_github_rhysd_actionlint//cmd/actionlint)",
"@@SHELLCHECK@@": "$(rootpath :com_github_koalaman_shellcheck)",
},
template = "actionlint.sh.in",
)
repo_command(
name = "actionlint_no_shellcheck",
command = "@com_github_rhysd_actionlint//cmd/actionlint",
)
repo_command(
name = "gofumpt",
args = [
@ -112,6 +130,7 @@ multirun(
":gazelle_generate",
":buildifier_fix",
],
jobs = 1, # execute sequentially
visibility = ["//visibility:public"],
)
@ -122,8 +141,15 @@ multirun(
":gazelle_check",
":buildifier_check",
] + select({
"@io_bazel_rules_go//go/platform:darwin_arm64": [":shellcheck_noop_warning"],
"//conditions:default": [":shellcheck"],
"@io_bazel_rules_go//go/platform:darwin_arm64": [
":shellcheck_noop_warning",
":actionlint_no_shellcheck",
],
"//conditions:default": [
":shellcheck",
":actionlint",
],
}),
jobs = 1, # execute sequentially
visibility = ["//visibility:public"],
)

15
bazel/ci/actionlint.sh.in Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
lib=$(realpath @@BASE_LIB@@) || exit 1
actionlint=$(realpath @@ACTIONLINT@@) || exit 1
shellcheck=$(realpath @@SHELLCHECK@@ || echo) || exit 1
# shellcheck source=../sh/lib.bash
if ! source "${lib}"; then
echo "Error: could not find import"
exit 1
fi
cd "${BUILD_WORKSPACE_DIRECTORY}" || exit 1
${actionlint} -shellcheck="${shellcheck}"

View File

@ -5198,6 +5198,14 @@ def go_dependencies():
sum = "h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=",
version = "v0.0.0-20181016184325-3113b8401b8a",
)
go_repository(
name = "com_github_rhysd_actionlint",
build_file_generation = "on",
build_file_proto_mode = "disable_global",
importpath = "github.com/rhysd/actionlint",
sum = "h1:041VOXgZddfvSJa9Il+WT3Iwuo/j0Nmu4bhpAScrds4=",
version = "v1.6.23",
)
go_repository(
name = "com_github_rivo_uniseg",
@ -5207,6 +5215,15 @@ def go_dependencies():
sum = "h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=",
version = "v0.4.4",
)
go_repository(
name = "com_github_robfig_cron",
build_file_generation = "on",
build_file_proto_mode = "disable_global",
importpath = "github.com/robfig/cron",
sum = "h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=",
version = "v1.2.0",
)
go_repository(
name = "com_github_robfig_cron_v3",
build_file_generation = "on",
@ -6215,8 +6232,8 @@ def go_dependencies():
build_file_generation = "on",
build_file_proto_mode = "disable_global",
importpath = "github.com/yuin/goldmark",
sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=",
version = "v1.4.13",
sum = "h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M=",
version = "v1.5.3",
)
go_repository(

View File

@ -10,6 +10,7 @@ go_library(
"//bazel/settings:select_never_enabled": [
"@cc_mvdan_gofumpt//:gofumpt",
"@com_github_katexochen_sh_v3//cmd/shfmt",
"@com_github_rhysd_actionlint//cmd/actionlint",
],
"//conditions:default": [],
}),

View File

@ -4,17 +4,25 @@ go 1.20
require (
github.com/katexochen/sh/v3 v3.6.0
github.com/rhysd/actionlint v1.6.23
mvdan.cc/gofumpt v0.4.0
)
require (
github.com/fatih/color v1.13.0 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/renameio/v2 v2.0.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/robfig/cron v1.2.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/tools v0.1.12 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mvdan.cc/editorconfig v0.2.0 // indirect
)

View File

@ -1,3 +1,5 @@
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
@ -7,19 +9,44 @@ github.com/katexochen/sh/v3 v3.6.0 h1:eIG0cBgpy2u2iQDFgi4fY0Yq38kVBzMSetzuU+ZIGR
github.com/katexochen/sh/v3 v3.6.0/go.mod h1:48/8duZflB7zABbqxMd1W3TE7d7yQl4L+34WsidGQrA=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/rhysd/actionlint v1.6.23 h1:041VOXgZddfvSJa9Il+WT3Iwuo/j0Nmu4bhpAScrds4=
github.com/rhysd/actionlint v1.6.23/go.mod h1:o5qc1K3I9taGMBhL7mVkpRd64hx3YqI+3t8ewGfYXfE=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
mvdan.cc/editorconfig v0.2.0 h1:XL+7ys6ls/RKrkUNFQvEwIvNHh+JKx8Mj1pUV5wQxQE=
mvdan.cc/editorconfig v0.2.0/go.mod h1:lvnnD3BNdBYkhq+B4uBuFFKatfp02eB6HixDvEz91C0=
mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=

View File

@ -10,5 +10,6 @@ package main
import (
_ "github.com/katexochen/sh/v3/cmd/shfmt"
_ "github.com/rhysd/actionlint/cmd/actionlint"
_ "mvdan.cc/gofumpt"
)