ci: lint shell

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2022-04-01 11:33:18 -07:00
parent 31daeb05ed
commit 517262dfde
4 changed files with 42 additions and 0 deletions

1
ci/cue.mod/module.cue Normal file
View File

@ -0,0 +1 @@
module: "github.com/dagger/dagger/ci"

1
ci/cue.mod/pkg Symbolic link
View File

@ -0,0 +1 @@
../../pkg

View File

@ -8,6 +8,8 @@ import (
"universe.dagger.io/docker" "universe.dagger.io/docker"
"universe.dagger.io/go" "universe.dagger.io/go"
"universe.dagger.io/go/golangci" "universe.dagger.io/go/golangci"
"github.com/dagger/dagger/ci/pkg/shellcheck"
) )
dagger.#Plan & { dagger.#Plan & {
@ -90,6 +92,10 @@ dagger.#Plan & {
version: "1.45" version: "1.45"
} }
shell: shellcheck.#Lint & {
source: _source
}
cue: docker.#Build & { cue: docker.#Build & {
steps: [ steps: [
alpine.#Build & { alpine.#Build & {

View 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-*/*")
"""#]
}
}
}