Commit 7465fbb4 authored by Steven's avatar Steven

refactor: improve GitHub Actions workflows structure and maintainability

- Add build-binaries workflow for multi-platform binary releases
- Rename workflows for conciseness:
  - demo-render-deploy.yml → demo-deploy.yml
  - build-and-push-canary-image.yml → build-canary-image.yml
  - build-and-push-stable-image.yml → build-stable-image.yml
- Centralize version config with env variables (GO_VERSION, NODE_VERSION, PNPM_VERSION)
- Standardize step names across all workflows
- Add concurrency controls to prevent redundant runs
- Update Node.js (20→22) and pnpm (9→10) versions to match build-binaries
- Improve job names with descriptive labels
- Add consistent comments and formatting
- Set artifact retention to 60 days for binary builds
parent 4033f64b
...@@ -4,8 +4,7 @@ on: ...@@ -4,8 +4,7 @@ on:
push: push:
branches: [main] branches: [main]
pull_request: pull_request:
branches: branches: [main]
- main
paths: paths:
- "go.mod" - "go.mod"
- "go.sum" - "go.sum"
...@@ -15,55 +14,58 @@ concurrency: ...@@ -15,55 +14,58 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
env:
GO_VERSION: "1.25"
jobs: jobs:
go-static-checks: static-checks:
name: Static Checks
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - name: Checkout code
uses: actions/checkout@v6
- uses: actions/setup-go@v6 - name: Setup Go
uses: actions/setup-go@v6
with: with:
go-version: 1.25 go-version: ${{ env.GO_VERSION }}
cache: true cache: true
cache-dependency-path: go.sum cache-dependency-path: go.sum
- name: Verify go.mod is tidy - name: Verify go.mod is tidy
run: | run: |
go mod tidy -go=1.25 go mod tidy -go=${{ env.GO_VERSION }}
git diff --exit-code git diff --exit-code
- name: golangci-lint - name: Run golangci-lint
uses: golangci/golangci-lint-action@v9 uses: golangci/golangci-lint-action@v9
with: with:
version: v2.4.0 version: v2.4.0
args: --timeout=3m args: --timeout=3m
go-tests: tests:
name: Tests (${{ matrix.test-group }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
test-group: test-group: [store, server, plugin, other]
- store
- server
- plugin
- other
steps: steps:
- uses: actions/checkout@v6 - name: Checkout code
uses: actions/checkout@v6
- uses: actions/setup-go@v6 - name: Setup Go
uses: actions/setup-go@v6
with: with:
go-version: 1.25 go-version: ${{ env.GO_VERSION }}
cache: true cache: true
cache-dependency-path: go.sum cache-dependency-path: go.sum
- name: Run tests - ${{ matrix.test-group }} - name: Run tests
run: | run: |
case "${{ matrix.test-group }}" in case "${{ matrix.test-group }}" in
store) store)
# Run store tests for all drivers (sqlite, mysql, postgres) # Run store tests for all drivers (sqlite, mysql, postgres)
# The TestMain in store/test runs all drivers when DRIVER is not set
# Note: We run without -race for container tests due to testcontainers race issues
go test -v -coverprofile=coverage.out -covermode=atomic ./store/... go test -v -coverprofile=coverage.out -covermode=atomic ./store/...
;; ;;
server) server)
......
This diff is collapsed.
name: Build and Push Canary Image name: Build Canary Image
on: on:
push: push:
......
name: Build and Push Stable Image name: Build Stable Image
on: on:
push: push:
......
name: Demo Render Deploy name: Demo Deploy
on: on:
workflow_dispatch: workflow_dispatch:
......
...@@ -4,44 +4,69 @@ on: ...@@ -4,44 +4,69 @@ on:
push: push:
branches: [main] branches: [main]
pull_request: pull_request:
branches: branches: [main]
- main
paths: paths:
- "web/**" - "web/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "22"
PNPM_VERSION: "10"
jobs: jobs:
static-checks: lint:
name: Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - name: Checkout code
- uses: pnpm/action-setup@v4.2.0 uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4.2.0
with: with:
version: 9 version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with: with:
node-version: "20" node-version: ${{ env.NODE_VERSION }}
cache: pnpm cache: pnpm
cache-dependency-path: "web/pnpm-lock.yaml" cache-dependency-path: web/pnpm-lock.yaml
- run: pnpm install
- name: Install dependencies
working-directory: web working-directory: web
- name: Run check run: pnpm install --frozen-lockfile
run: pnpm lint
- name: Run lint
working-directory: web working-directory: web
run: pnpm lint
frontend-build: build:
name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - name: Checkout code
- uses: pnpm/action-setup@v4.2.0 uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4.2.0
with: with:
version: 9 version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with: with:
node-version: "20" node-version: ${{ env.NODE_VERSION }}
cache: pnpm cache: pnpm
cache-dependency-path: "web/pnpm-lock.yaml" cache-dependency-path: web/pnpm-lock.yaml
- run: pnpm install
- name: Install dependencies
working-directory: web working-directory: web
- name: Run frontend build run: pnpm install --frozen-lockfile
run: pnpm build
- name: Build frontend
working-directory: web working-directory: web
run: pnpm build
...@@ -4,30 +4,37 @@ on: ...@@ -4,30 +4,37 @@ on:
push: push:
branches: [main] branches: [main]
pull_request: pull_request:
branches: branches: [main]
- main
paths: paths:
- "proto/**" - "proto/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
lint-protos: lint:
name: Lint Protos
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout code
uses: actions/checkout@v6 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup buf - name: Setup buf
uses: bufbuild/buf-setup-action@v1 uses: bufbuild/buf-setup-action@v1
with: with:
github_token: ${{ github.token }} github_token: ${{ github.token }}
- name: buf lint
- name: Run buf lint
uses: bufbuild/buf-lint-action@v1 uses: bufbuild/buf-lint-action@v1
with: with:
input: "proto" input: proto
- name: buf format
- name: Check buf format
run: | run: |
if [[ $(buf format -d) ]]; then if [[ $(buf format -d) ]]; then
echo "Run 'buf format -d'" echo "❌ Proto files are not formatted. Run 'buf format -w' to fix."
exit 1 exit 1
fi fi
name: Stale name: Stale Issues
on: on:
schedule: schedule:
- cron: "0 */8 * * *" - cron: "0 */8 * * *" # Every 8 hours
jobs: jobs:
stale: close-stale:
name: Close Stale Issues
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
issues: write issues: write
steps: steps:
- uses: actions/stale@v10.1.1 - name: Close stale issues
uses: actions/stale@v10.1.1
with: with:
days-before-issue-stale: 14 days-before-issue-stale: 14
days-before-issue-close: 7 days-before-issue-close: 7
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment