ci: lint shell
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
31daeb05ed
commit
517262dfde
1
ci/cue.mod/module.cue
Normal file
1
ci/cue.mod/module.cue
Normal file
@ -0,0 +1 @@
|
||||
module: "github.com/dagger/dagger/ci"
|
1
ci/cue.mod/pkg
Symbolic link
1
ci/cue.mod/pkg
Symbolic link
@ -0,0 +1 @@
|
||||
../../pkg
|
@ -8,6 +8,8 @@ import (
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/go"
|
||||
"universe.dagger.io/go/golangci"
|
||||
|
||||
"github.com/dagger/dagger/ci/pkg/shellcheck"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
@ -90,6 +92,10 @@ dagger.#Plan & {
|
||||
version: "1.45"
|
||||
}
|
||||
|
||||
shell: shellcheck.#Lint & {
|
||||
source: _source
|
||||
}
|
||||
|
||||
cue: docker.#Build & {
|
||||
steps: [
|
||||
alpine.#Build & {
|
||||
|
34
ci/pkg/shellcheck/shellcheck.cue
Normal file
34
ci/pkg/shellcheck/shellcheck.cue
Normal file
@ -0,0 +1,34 @@
|
||||
package shellcheck
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
#Lint: {
|
||||
// Source code
|
||||
source: dagger.#FS
|
||||
|
||||
// shellcheck version
|
||||
version: *"0.8.0" | string
|
||||
|
||||
_image: docker.#Pull & {
|
||||
source: "koalaman/shellcheck-alpine:v\(version)"
|
||||
}
|
||||
|
||||
container: docker.#Run & {
|
||||
input: _image.output
|
||||
mounts: "source": {
|
||||
dest: "/src"
|
||||
contents: source
|
||||
}
|
||||
workdir: "/src"
|
||||
command: {
|
||||
name: "sh"
|
||||
args: ["-c", #"""
|
||||
shellcheck $(find . -type f \( -iname \*.bats -o -iname \*.bash -o -iname \*.sh \) -not -path "*/node_modules/*" -not -path "*/bats-*/*")
|
||||
"""#]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user