Skip to content

Adding makefile for web and refactoring main makefile to improve ux for go and web engineers - #197

Open
babourine wants to merge 23 commits into
patterninc:mainfrom
babourine:stan_makefile_web
Open

babourine wants to merge 23 commits into
patterninc:mainfrom
babourine:stan_makefile_web

Conversation

@babourine

@babourine babourine commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #174 and #196

gauravwarale Shaunak Sontakke (@ssontakke) I'm merging my changes into babourine/heimdall:stan_main first, so feel free to use that branch as a reference or cherry-pick from it anytime. I'll keep opening upstream PRs here for visibility, no rush on merging them. Just a heads-up that because I develop against stan_main, newer PRs may depend on earlier ones. 🙏

babourine and others added 20 commits November 29, 2026 19:46
…all so forks dont havbe this workflow failing
…eave stale binaries and plugins'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…tion so Init() call remains just a read call and does not change anything (support of validate and print commands)
Copilot AI balanced review requested due to automatic review settings December 4, 2026 17:18
@wiz-55ccc8b716

wiz-55ccc8b716 Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities 1 Medium
Data Finding Sensitive Data -
Secret Finding Secrets 1 Low
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total 1 Medium 1 Low

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Dockerfile passes BUILD_VERSION, but the Makefile reads VERSION, causing images to report dev even when Compose supplies a release version.

1 open issue
1 file not reviewed
  • web/pnpm-lock.yaml: Generated file
What changed in this PR

Adds Make-based workflows for Go and web development, building on the dependency updates and CLI refactoring in #174 and #196.

Changes:

  • Adds project-wide and web-specific build, test, coverage, and cleanup targets.
  • Moves CLI handling into the Heimdall package and updates container startup and configuration.
  • Refreshes dependencies, UI snapshots, and development documentation.
File Description
web/​src/​components/​ListPage/​__snapshots__/​ListPage.test.tsx.snap Refreshes list-page rendering snapshots.
web/​src/​components/​DetailPage/​__snapshots__/​DetailPage.test.tsx.snap Refreshes detail-page rendering snapshots.
web/​pnpm-lock.yaml Updates Pattern UI and transitive dependencies.
web/​Makefile Adds web development targets.
README.md Documents Make workflows and CLI commands.
Makefile Adds unified Go and web workflows.
internal/​pkg/​object/​command/​starrocks/​job_context.go Removes a blank line.
internal/​pkg/​heimdall/​keepalive.go Relocates the keepalive default.
internal/​pkg/​heimdall/​job.go Uses build metadata; corrects a comment.
internal/​pkg/​heimdall/​heimdall.go Centralizes defaults, CLI handling, and startup.
internal/​pkg/​auth/​auth.go Reorders imports.
go.sum Refreshes dependency checksums.
go.mod Updates Go and dependency versions.
entrypoint.sh Uses the new binary path and server command.
Dockerfile Switches builds to Make and updates Go.
docker-compose.yaml Passes the build-version argument.
configs/​local.yaml Adjusts plugin paths and removes an unsupported key.
configs/​local-cli.yaml Adds local CLI configuration.
cmd/​heimdall/​heimdall.go Delegates CLI execution to Heimdall.
.github/​workflows/​build.yml Updates Go and runs Make in CI.

Review effort: Balanced

Comment thread Dockerfile Outdated
# Declared right before its only consumer so it invalidates as little as possible.
ARG BUILD_VERSION=dev
RUN BUILD_VERSION="${BUILD_VERSION}" ./build.sh --go
RUN BUILD_VERSION="${BUILD_VERSION}" make exe plugins
…le different modes of operation -- running different containers on demand
@babourine

Copy link
Copy Markdown
Contributor Author

Optional: CI that uses these make targets

prasadlohakpure / Yash Shrivastava (@alephys26) / gauravwarale

This PR's Makefile enables a fuller CI: race-enabled tests against Postgres, web tests,
and a docker-compose smoke test that starts the image and runs a ping job. A broken
Dockerfile or entrypoint would then fail the PR instead of showing up after merge.

It's running green in my fork: https://github.com/babourine/heimdall/actions/runs/47461274319

If you're comfortable adopting it, it replaces .github/workflows/build.yml as-is
(same name and triggers; static check is non-blocking until the lint cleanup lands).
Happy to send it as a follow-up PR instead.

Proposed .github/workflows/build.yml
# Build and test. Every step goes through `make`, so CI and local runs execute the same commands.
# `workflow_call` lets forks run this same workflow on their own branches from a small caller workflow.
name: Build and Test

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:
  workflow_call:

permissions:
  contents: read

concurrency:
  # workflow name keeps a fork's caller run and this workflow from cancelling each other
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  GO_VERSION: 1.27.4

jobs:
  go-checks:
    name: Go format, tidy, vet, lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-go@v7
        with:
          go-version: ${{ env.GO_VERSION }}
      - name: gofmt
        run: make go-fmt-check
      - name: go mod tidy
        run: make go-tidy-check
      - name: go vet
        run: make go-vet
      - name: static check
        # Non-blocking until the first run's findings are triaged; remove this line to enforce.
        continue-on-error: true
        run: make go-lint

  go-test:
    name: Go build, test, coverage
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:16 # same as docker-compose.yaml
        env:
          POSTGRES_USER: heimdall
          POSTGRES_PASSWORD: heimdall
          POSTGRES_DB: heimdall
        ports:
          - 5432:5432
        options: >-
          --health-cmd "pg_isready -d heimdall -U heimdall"
          --health-interval 5s
          --health-timeout 5s
          --health-retries 10
    env:
      # Integration tests (build tag `integration`, Phase 1) read this DSN; unit tests ignore it.
      HEIMDALL_TEST_DSN: postgres://heimdall:heimdall@localhost:5432/heimdall?sslmode=disable
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-go@v7
        with:
          go-version: ${{ env.GO_VERSION }}
      - name: Build binaries and plugins
        run: make go-build
      - name: Test with race detector and coverage
        run: make go-cover GO_TEST_FLAGS="-race -tags=integration"
      - name: Coverage summary
        if: always()
        run: |
          {
            echo "## Go coverage"
            make --no-print-directory go-cover-summary
          } >> "$GITHUB_STEP_SUMMARY"
      - name: Coverage ratchet
        run: make go-cover-check
      - name: Upload coverage report
        if: always()
        uses: actions/upload-artifact@v7
        with:
          name: go-coverage
          path: |
            dist/go-coverage.out
            dist/go-coverage.html
          if-no-files-found: ignore

  web:
    name: Web lint, test, coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      # Node version from web/.nvmrc, pnpm version from packageManager in web/package.json
      - uses: pnpm/setup@v3
        with:
          working-directory: web
          cache: true
          install: false # make web-deps installs
      - name: Install
        run: make web-deps
      - name: Lint
        run: make web-lint
      - name: Test with coverage
        run: make web-cover

  smoke:
    name: Docker compose smoke test
    runs-on: ubuntu-latest
    needs: [go-test, web]
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0 # tags for VERSION in the Makefile
      - name: Start stack
        run: make docker-up
      - name: Smoke test
        run: make docker-smoke
      - name: Logs on failure
        if: failure()
        run: docker compose logs --no-color --tail=300
      - name: Stop stack
        if: always()
        run: make docker-down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants