|
| 1 | +# yaml-language-server: $schema=https://flowexec.io/schemas/flowfile_schema.json |
| 2 | +tags: [development] |
| 3 | +executables: |
| 4 | + - verb: validate |
| 5 | + description: Run all development checks |
| 6 | + serial: |
| 7 | + params: |
| 8 | + - envKey: COLORFGBG |
| 9 | + text: 15;0 |
| 10 | + - envKey: COLORTERM |
| 11 | + text: truecolor |
| 12 | + - envKey: TERM |
| 13 | + text: xterm-256color |
| 14 | + execs: |
| 15 | + - ref: generate |
| 16 | + - ref: lint |
| 17 | + - ref: test tui |
| 18 | + - ref: validate generated |
| 19 | + - cmd: echo "✅ All development checks passed" |
| 20 | + |
| 21 | + - verb: test |
| 22 | + name: tui |
| 23 | + aliases: [go] |
| 24 | + tags: [go] |
| 25 | + description: Run tests with coverage |
| 26 | + serial: |
| 27 | + dir: // |
| 28 | + execs: |
| 29 | + # TODO: Add -race flag when the container becomes thread safe |
| 30 | + - cmd: | |
| 31 | + set -e |
| 32 | + echo "Running Go unit tests..." |
| 33 | + if [ "$CI" = "true" ]; then |
| 34 | + echo "Running Go unit tests with coverage..." |
| 35 | + go test -coverprofile=coverage.out -covermode=atomic ./... |
| 36 | + else |
| 37 | + go test ./... |
| 38 | + fi |
| 39 | + echo "Unit tests completed" |
| 40 | + retries: 3 |
| 41 | + |
| 42 | + - verb: generate |
| 43 | + tags: [go] |
| 44 | + exec: |
| 45 | + dir: // |
| 46 | + cmd: | |
| 47 | + echo "Generating go CLI code..." |
| 48 | + go generate ./... |
| 49 | + echo "All go code generated successfully" |
| 50 | + |
| 51 | + - verb: validate |
| 52 | + name: generated |
| 53 | + description: Check for uncommitted generated files |
| 54 | + exec: |
| 55 | + dir: // |
| 56 | + cmd: | |
| 57 | + echo "Checking for uncommitted generated files..." |
| 58 | + |
| 59 | + if [ -n "$(git status --porcelain)" ]; then |
| 60 | + echo "❌ Generated files are not up to date!" |
| 61 | + echo "Please run 'flow generate' and commit the changes." |
| 62 | + echo "" |
| 63 | + echo "Uncommitted changes:" |
| 64 | + git status --porcelain |
| 65 | + exit 1 |
| 66 | + else |
| 67 | + echo "✅ All generated files are up to date" |
| 68 | + fi |
| 69 | + |
| 70 | + - verb: test |
| 71 | + name: snapshot |
| 72 | + description: Run the snapshot tests |
| 73 | + exec: |
| 74 | + dir: // |
| 75 | + params: |
| 76 | + - envKey: COLORFGBG |
| 77 | + text: 15;0 |
| 78 | + - envKey: COLORTERM |
| 79 | + text: truecolor |
| 80 | + - envKey: TERM |
| 81 | + text: xterm-256color |
| 82 | + args: |
| 83 | + - envKey: BUILDER |
| 84 | + pos: 1 |
| 85 | + default: podman |
| 86 | + cmd: | |
| 87 | + $BUILDER run --rm -it -v "$PWD":/go/src/app -w /go/src/app golang:1.23-bookworm go test ./container_test.go |
| 88 | + |
| 89 | + - verb: run |
| 90 | + name: sample |
| 91 | + description: Run the sample container program |
| 92 | + visibility: hidden # TODO: fix running of tea programs from within the container |
| 93 | + exec: |
| 94 | + dir: // |
| 95 | + args: |
| 96 | + - envKey: VIEW |
| 97 | + pos: 1 |
| 98 | + default: frame |
| 99 | + logMode: text |
| 100 | + cmd: go run ./sample --view $VIEW |
| 101 | + |
| 102 | + - verb: lint |
| 103 | + tags: [go] |
| 104 | + description: Run linters and formatters |
| 105 | + parallel: |
| 106 | + dir: // |
| 107 | + failFast: false |
| 108 | + execs: |
| 109 | + - cmd: go fmt ./... |
| 110 | + - cmd: go mod tidy |
| 111 | + - cmd: | |
| 112 | + if ! command -v golangci-lint &> /dev/null; then |
| 113 | + echo "Installing golangci-lint..." |
| 114 | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s v2.1.6 |
| 115 | + export PATH="$PATH:./bin" |
| 116 | + fi |
| 117 | + |
| 118 | + if [ "$CI" = "true" ]; then |
| 119 | + echo "Running golangci-lint with sarif output..." |
| 120 | + golangci-lint run ./... --fix --output.sarif.path lint.sarif |
| 121 | + else |
| 122 | + golangci-lint run ./... --fix |
| 123 | + fi |
| 124 | + |
| 125 | + - verb: scan |
| 126 | + name: security |
| 127 | + tags: [security, go] |
| 128 | + description: Run security scanning with govulncheck |
| 129 | + exec: |
| 130 | + dir: // |
| 131 | + cmd: | |
| 132 | + if ! command -v govulncheck &> /dev/null; then |
| 133 | + echo "Installing govulncheck..." |
| 134 | + go install golang.org/x/vuln/cmd/govulncheck@latest |
| 135 | + fi |
| 136 | + |
| 137 | + if [ "$CI" = "true" ]; then |
| 138 | + govulncheck -format sarif ./... > govuln.sarif |
| 139 | + echo "Security scan completed. Results saved to govuln.sarif" |
| 140 | + else |
| 141 | + govulncheck ./... |
| 142 | + echo "Security scan completed. No vulnerabilities found." |
| 143 | + fi |
0 commit comments