Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions .execs/build.flow
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ executables:
failFast: false
execs:
- ref: generate cli
- ref: generate completions
- ref: generate docs
- ref: generate frontend
- ref: generate backend
- ref: generate tauri

- verb: build
name: binary
Expand All @@ -31,20 +29,17 @@ executables:
go build -o ${BIN_PATH}/${BIN_NAME}
echo "flow built at ${BIN_PATH}/${BIN_NAME}"

- verb: generate
name: completions
tags: [docs]
exec:
dir: //
cmd: ./scripts/completions.sh

- verb: generate
name: docs
aliases: [documentation]
description: Generate docsify documentation for the project.
tags: [docs]
exec:
parallel:
failFast: false
dir: //
cmd: go run ./tools/docsgen/.
execs:
- cmd: go run ./tools/docsgen/.
- cmd: ./scripts/completions.sh

- verb: generate
name: cli
Expand All @@ -63,6 +58,7 @@ executables:
tags: [desktop]
description: Generate code for the Tauri frontend and backend.
parallel:
failFast: false
execs:
- ref: generate frontend
- ref: generate backend
Expand Down
1 change: 1 addition & 0 deletions .execs/container.flow
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ executables:
GOOS=linux GOARCH=amd64 go build -o flow
echo "building container image..."
$BUILDER build -t $IMAGE_REPO:$IMAGE_TAG .
rm flow

- verb: run
name: container
Expand Down
14 changes: 8 additions & 6 deletions .execs/helpers.flow
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
tags: [development, helper]
executables:
- verb: clean
name: ci
aliases: [codecov]
tags: [coverage, ci]
description: Clean up coverage files
name: tmp
aliases: [artifacts, ci]
description: Remove the temporary files created by executable runs
exec:
dir: //
cmd: |
echo "Cleaning CI temp files..."
rm -f *.sarif *.out
echo "Cleaning coverage files..."
rm -f *.sarif *.out || true
echo "Clearing the bin directory..."
rm -rf .bin || true
rm ./flow || true
16 changes: 13 additions & 3 deletions .execs/test.flow
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ executables:
execs:
- cmd: |
set -e
echo "Running Go unit tests with coverage..."
go test -race -coverprofile=unit-coverage.out -covermode=atomic -tags=unit ./...
echo "Running Go unit tests..."
if [ "$CI" = "true" ]; then
echo "Running Go unit tests with coverage..."
go test -race -coverprofile=unit-coverage.out -covermode=atomic -tags=unit ./...
else
go test -race -tags=unit ./...
fi
echo "Unit tests completed"
retries: 3

Expand All @@ -64,7 +69,12 @@ executables:
- cmd: |
set -e
echo "Running Go E2E tests..."
go test -race -coverprofile=e2e-coverage.out -covermode=atomic -coverpkg=./... -tags=e2e ./tests/...
if [ "$CI" = "true" ]; then
echo "Running Go E2E tests with coverage..."
go test -race -coverprofile=e2e-coverage.out -covermode=atomic -coverpkg=./... -tags=e2e ./tests/...
else
go test -race -tags=e2e ./tests/...
fi
echo "E2E tests completed"
retries: 1

Expand Down
21 changes: 14 additions & 7 deletions .execs/validate.flow
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,23 @@ executables:
description: Run linters and formatters
parallel:
dir: //
failFast: false
execs:
- cmd: go fmt ./...
dir: //
- cmd: go mod tidy
dir: //
- cmd: |
if ! command -v golangci-lint &> /dev/null; then
echo "Installing golangci-lint..."
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s v2.1.6
export PATH="$PATH:./bin"
fi

golangci-lint run ./... --fix --output.sarif.path lint.sarif
if [ "$CI" = "true" ]; then
echo "Running golangci-lint with sarif output..."
golangci-lint run ./... --fix --output.sarif.path lint.sarif
else
golangci-lint run ./... --fix
fi

- verb: lint
name: ts
Expand All @@ -67,12 +71,15 @@ executables:
exec:
dir: //
cmd: |
echo "Running security scan..."

if ! command -v govulncheck &> /dev/null; then
echo "Installing govulncheck..."
go install golang.org/x/vuln/cmd/govulncheck@latest
fi

govulncheck -format sarif ./... > govuln.sarif
echo "Security scan completed. Results saved to govuln.sarif"
if [ "$CI" = "true" ]; then
govulncheck -format sarif ./... > govuln.sarif
echo "Security scan completed. Results saved to govuln.sarif"
else
govulncheck ./...
echo "Security scan completed. No vulnerabilities found."
fi
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
go-version: "^1.24"
- uses: jahvon/[email protected]
with:
executable: 'lint go'
executable: 'lint go --param CI=true'
timeout: '5m'
flow-version: 'main'
- name: Upload SARIF file
Expand All @@ -43,7 +43,7 @@ jobs:
go-version: "^1.24"
- uses: jahvon/[email protected]
with:
executable: 'test unit'
executable: 'test unit --param CI=true'
timeout: '5m'
flow-version: 'main'
id: unit-tests
Expand All @@ -63,7 +63,7 @@ jobs:
go-version: "^1.24"
- uses: jahvon/[email protected]
with:
executable: 'test e2e'
executable: 'test e2e --param CI=true'
timeout: '10m'
flow-version: 'main'
secrets: |
Expand Down
13 changes: 8 additions & 5 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,20 @@ The `flow` project contains a few development executables that can be run locall
workspace, you can run the following commands:

```sh
# Install local dependencies
flow install deps
# Install Go tool dependencies
flow install tools

# Build the project
# Build the CLI binary
flow build binary <output-path>

# Validate code changes (runs tests, linters, codegen, etc)
flow validate

# Run only tests
flow run tests
# Only generate code
flow generate

# Only run tests
flow test all
```

### Working with generated types
Expand Down
22 changes: 13 additions & 9 deletions internal/runner/parallel/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ func (r *parallelRunner) Exec(
if err != nil {
return err
}
defer str.Close()
if err := str.CreateBucket(store.EnvironmentBucket()); err != nil {
return err
}
return handleExec(ctx, e, eng, parallelSpec, inputEnv, str)
cacheData, err := str.GetAll()
if err != nil {
return err
}
if err := str.Close(); err != nil {
ctx.Logger.Error(err, "unable to close store")
}

return handleExec(ctx, e, eng, parallelSpec, inputEnv, cacheData)
}

return fmt.Errorf("no parallel executables to run")
Expand All @@ -65,8 +72,9 @@ func (r *parallelRunner) Exec(
func handleExec(
ctx *context.Context, parent *executable.Executable,
eng engine.Engine,
parallelSpec *executable.ParallelExecutableType, promptedEnv map[string]string,
str store.Store,
parallelSpec *executable.ParallelExecutableType,
promptedEnv map[string]string,
cacheData map[string]string,
) error {
groupCtx, cancel := stdCtx.WithCancel(ctx.Ctx)
defer cancel()
Expand All @@ -77,11 +85,7 @@ func handleExec(
}
group.SetLimit(limit)

dm, err := str.GetAll()
if err != nil {
return err
}
dataMap := expr.ExpressionEnv(ctx, parent, dm, promptedEnv)
dataMap := expr.ExpressionEnv(ctx, parent, cacheData, promptedEnv)

var execs []engine.Exec
for i, refConfig := range parallelSpec.Execs {
Expand Down
21 changes: 12 additions & 9 deletions internal/runner/serial/serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,32 @@ func (r *serialRunner) Exec(
if err != nil {
return err
}
defer str.Close()
if err := str.CreateBucket(store.EnvironmentBucket()); err != nil {
return err
}
return handleExec(ctx, e, eng, serialSpec, inputEnv, str)
cacheData, err := str.GetAll()
if err != nil {
return err
}
if err := str.Close(); err != nil {
ctx.Logger.Error(err, "unable to close store")
}

return handleExec(ctx, e, eng, serialSpec, inputEnv, cacheData)
}
return fmt.Errorf("no serial executables to run")
}

//nolint:funlen,gocognit
//nolint:gocognit
func handleExec(
ctx *context.Context,
parent *executable.Executable,
eng engine.Engine,
serialSpec *executable.SerialExecutableType,
promptedEnv map[string]string,
str store.Store,
cacheData map[string]string,
) error {
dm, err := str.GetAll()
if err != nil {
return err
}
dataMap := expr.ExpressionEnv(ctx, parent, dm, promptedEnv)
dataMap := expr.ExpressionEnv(ctx, parent, cacheData, promptedEnv)

var execs []engine.Exec
for i, refConfig := range serialSpec.Execs {
Expand Down
7 changes: 3 additions & 4 deletions types/executable/executable.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,14 @@ func NewExecutableID(workspace, namespace, name string) string {
switch {
case ws == "":
return "" // TODO: return error or log warning
case ns == "" && name == "":
return ws + "/" // nameless executable
case ns != "" && name == "":
return fmt.Sprintf("%s:", ns)
case ns != "":
return fmt.Sprintf("%s/%s:%s", ws, ns, name)
case name != "":
default:
return fmt.Sprintf("%s/%s", ws, name)
default: // ws != "" && ns == "" && name == ""
// for now, exclude the workspace from the string (until we can indicate that it's root / not named in the tui)
return ""
}
}

Expand Down
Loading