Skip to content

Update Grafana dashboards and workflows for enhanced RPC metrics obse… #14

Update Grafana dashboards and workflows for enhanced RPC metrics obse…

Update Grafana dashboards and workflows for enhanced RPC metrics obse… #14

Workflow file for this run

name: Build and Push Docker Image
on:
push:
tags:
- 'v*' # v1.4.0-dev1 v1.4.0
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/taiji
jobs:
go-lint:
name: Go Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24.x'
cache: true
- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1
args: --timeout=5m
go-fmt-check:
name: Go Format Check (gofmt + goimports)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24.x'
cache: true
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Check gofmt
run: |
CHANGED=$(gofmt -s -l . | tee /dev/stderr)
if [ -n "$CHANGED" ]; then
echo "::error ::gofmt would reformat the files above. Run 'make fmt'."
exit 1
fi
- name: Check goimports
run: |
# Only check .go files outside vendor (actions/checkout doesn't bring vendor by default)
FILES=$(git ls-files '*.go')
CHANGED=$(goimports -l $FILES | tee /dev/stderr)
if [ -n "$CHANGED" ]; then
echo "::error ::goimports would reformat the files above. Run 'make fmt'."
exit 1
fi
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Extract version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION_NO_V=${VERSION#v}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION_NO_V=${VERSION_NO_V}" >> $GITHUB_OUTPUT
- name: Build binaries
run: |
VERSION="${{ steps.version.outputs.VERSION }}"
# Build for linux/amd64
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build \
-ldflags="-s -w -extldflags '-static'" \
-o taiji-${VERSION}-linux-amd64 \
main.go
# Build for linux/arm64
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build \
-ldflags="-s -w -extldflags '-static'" \
-o taiji-${VERSION}-linux-arm64 \
main.go
# Build for darwin/amd64 (Intel Mac)
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build \
-ldflags="-s -w" \
-o taiji-${VERSION}-darwin-amd64 \
main.go
# Build for darwin/arm64 (Apple Silicon)
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build \
-ldflags="-s -w" \
-o taiji-${VERSION}-darwin-arm64 \
main.go
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log in to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest
type=sha
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract tag annotation
id: tag_annotation
run: |
TAG_MESSAGE=$(git tag -l --format='%(contents)' ${{ steps.version.outputs.VERSION }})
# Use multiline output for GitHub Actions
{
echo 'TAG_MESSAGE<<EOF'
echo "$TAG_MESSAGE"
echo EOF
} >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/[email protected]
with:
generate_release_notes: true
files: |
taiji-${{ steps.version.outputs.VERSION }}-linux-amd64
taiji-${{ steps.version.outputs.VERSION }}-linux-arm64
taiji-${{ steps.version.outputs.VERSION }}-darwin-amd64
taiji-${{ steps.version.outputs.VERSION }}-darwin-arm64
body: |
${{ steps.tag_annotation.outputs.TAG_MESSAGE }}
---
## Docker Image
```bash
# Pull with version tag
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION_NO_V }}
# Or pull latest release
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
```
### Available tags:
${{ steps.meta.outputs.tags }}
### Platforms:
- linux/amd64
- linux/arm64
## Binaries
Download the pre-built binaries for your platform:
- **Linux (amd64)**: `taiji-${{ steps.version.outputs.VERSION }}-linux-amd64`
- **Linux (arm64)**: `taiji-${{ steps.version.outputs.VERSION }}-linux-arm64`
- **macOS (Intel)**: `taiji-${{ steps.version.outputs.VERSION }}-darwin-amd64`
- **macOS (Apple Silicon)**: `taiji-${{ steps.version.outputs.VERSION }}-darwin-arm64`