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
2 changes: 2 additions & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download
USE_BAZEL_VERSION=aspect/2025.11.0
33 changes: 33 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Don't create bazel-* symlinks in the WORKSPACE directory.
# These require .gitignore and may scare users. Also impact in the performance of jetbrains IDE, it's a workaround for
# https://github.com/bazelbuild/rules_typescript/issues/12 which affects the common case of
# having `tsconfig.json` in the WORKSPACE directory. Instead, you should run
# `bazel info output_base` to find out where the outputs went.
build --symlink_prefix=/

# Habilitar Bzlmod
common --enable_bzlmod=true

# Build flags
build --@rules_go//go/config:pure

# Test flags
test --test_output=errors
# test --@rules_go//go/config:race # Commented out due to conflict with pure mode

# Test with race detection (separate config)
test:race --@rules_go//go/config:race --@rules_go//go/config:pure=false

# Optimization flags
build:opt -c opt
build:opt --copt=-O2
build:opt --linkopt=-s

# CI flags
build:ci --verbose_failures
build:ci --test_summary=detailed
test:ci --test_output=all

# Local development
build:dev --disk_cache=~/.cache/bazel-disk-cache
build:dev --repository_cache=~/.cache/bazel-repository-cache
74 changes: 56 additions & 18 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,69 @@
on: [push]
on:
push:
branches:
- main
pull_request:
branches:
- main

# Sets permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/checkout@v5

- uses: actions/setup-go@v5.1.0
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.8.5
with:
go-version: 1.24.6
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Lint
uses: golangci/golangci-lint-action@v8.0.0
with:
version: v2.4.0
- name: Build
run: bazel build //...

- name: Lint and Format Check
run: |
bazel run //:fmt
bazel run //:lint

- name: Test with Coverage
run: bazel coverage //...

- name: Format check
run: make fmt-check
- name: Install lcov for HTML report generation
run: sudo apt-get install -y lcov

- name: Static analysis
run: go vet ./...
- name: Generate HTML Coverage Report
run: |
TESTLOGS_DIR=$(bazel info bazel-testlogs)
mkdir -p coverage-html
find "$TESTLOGS_DIR" -name "coverage.dat" -exec cat {} \; > coverage.out
genhtml coverage.out --output-directory coverage-html --title "Code Coverage Report"

- name: Test
run: go test -race -coverprofile=coverage.out ./...
- name: Setup Pages
uses: actions/configure-pages@v3
if: github.ref == 'refs/heads/main'

- name: Upload test coverage report
uses: codecov/codecov-action@v4.5.0
- name: Upload coverage report to GitHub Pages
uses: actions/upload-pages-artifact@v4
if: github.ref == 'refs/heads/main'
with:
file: ./coverage.out
token: ${{ secrets.CODECOV_TOKEN }}
path: './coverage-html'

deploy-pages:
needs: checks
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
51 changes: 41 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,50 @@ jobs:
include:
- goos: linux
goarch: amd64
target: task-runner-launcher-linux-amd64
- goos: linux
goarch: arm64
target: task-runner-launcher-linux-arm64

steps:
- uses: actions/checkout@v4.2.2

- uses: wangyoucao577/go-release-action@v1.52

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.8.5
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Build cross-platform binary
run: bazel build //cmd/launcher:${{ matrix.target }}

- name: Prepare binary for upload
run: |
mkdir -p release-assets
cp bazel-bin/cmd/launcher/${{ matrix.target }}_/${{ matrix.target }} release-assets/task-runner-launcher
chmod +x release-assets/task-runner-launcher

# Generate SHA256 sum
cd release-assets
sha256sum task-runner-launcher > task-runner-launcher.sha256

- name: Upload Release Asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: release-assets/task-runner-launcher
asset_name: task-runner-launcher-${{ matrix.goos }}-${{ matrix.goarch }}
asset_content_type: application/octet-stream

- name: Upload SHA256 Asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: 1.24.6
binary_name: task-runner-launcher
project_path: ./cmd/launcher
sha256sum: true
extra_files: README.md LICENSE.md LICENSE_EE.md
upload_url: ${{ github.event.release.upload_url }}
asset_path: release-assets/task-runner-launcher.sha256
asset_name: task-runner-launcher-${{ matrix.goos }}-${{ matrix.goarch }}.sha256
asset_content_type: text/plain
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.idea
.DS_Store
bin/*
!**/.gitkeep
config.json

# Coverage files (Bazel generates these)
coverage-html/
coverage_combined.dat

# Legacy coverage files (from Make - can be removed eventually)
coverage.html
coverage.out
48 changes: 31 additions & 17 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
version: "2"

run:
timeout: 5m
tests: true
timeout: 1m
modules-download-mode: readonly

linters:
enable:
- govet # correctness
- errcheck # error handling
- staticcheck # static analysis
- gosec # security
- revive # best practices
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- gofmt
- goimports
- misspell
- revive
- gocyclo
- unconvert
- gosec

linters-settings:
gocyclo:
min-complexity: 15
govet:
check-shadowing: true
misspell:
locale: US
gosec:
excludes:
- G104 # disregard errors not requiring explicit handling
- G204 # allow subprocess launching with validated config inputs

settings:
gosec:
excludes:
- G104 # disregard errors not requiring explicit handling
- G204 # allow subprocess launching with validated config inputs
issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0

exclusions:
presets:
- comments
- std-error-handling
36 changes: 36 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
load("@gazelle//:def.bzl", "gazelle")

# gazelle:prefix task-runner-launcher
gazelle(name = "gazelle")

gazelle(
name = "gazelle-update-repos",
args = [
"-from_file=go.mod",
"-to_macro=go_deps.bzl%go_dependencies",
"-prune",
],
command = "update-repos",
)

# Primary aliases (HERMETIC - no local Go required!)
alias(
name = "fmt",
actual = "//tools/gofmt", # Uses Bazel's Go toolchain!
)

alias(
name = "lint",
actual = "//tools/golint", # Uses Bazel's Go toolchain!
)

# Coverage and testing aliases
alias(
name = "coverage",
actual = "//tools/gocov", # Generate coverage report (LCOV format)
)

alias(
name = "test-coverage",
actual = "//tools/gocov", # Same as coverage (Makefile compatibility)
)
25 changes: 25 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module(
name = "task_runner_launcher",
version = "1.0.0",
)

# Bazel dependencies
bazel_dep(name = "rules_go", version = "0.46.0")
bazel_dep(name = "gazelle", version = "0.35.0")

# Go toolchain
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.24.6")

# Go dependencies
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")

# Use all dependencies from go.mod
use_repo(
go_deps,
"com_github_getsentry_sentry_go",
"com_github_gorilla_websocket",
"com_github_sethvargo_go_envconfig",
"com_github_stretchr_testify",
)
Loading
Loading