mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
ci: optimize workflow performance
- PR docker builds use single arch (amd64 only), tag push uses dual - Add paths-ignore to skip CI on docs-only changes - Add concurrency groups to cancel stale runs on re-push - Build Go binary once instead of 3x go run in migrate job
This commit is contained in:
@@ -3,8 +3,20 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "devenv/**"
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "devenv/**"
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -33,6 +45,9 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Build
|
||||
run: go build -o memoh-server ./cmd/agent
|
||||
|
||||
- name: Generate config
|
||||
run: |
|
||||
cat > config.toml <<'TOML'
|
||||
@@ -46,10 +61,10 @@ jobs:
|
||||
TOML
|
||||
|
||||
- name: Migrate up
|
||||
run: go run ./cmd/agent migrate up
|
||||
run: ./memoh-server migrate up
|
||||
|
||||
- name: Migrate down
|
||||
run: go run ./cmd/agent migrate down
|
||||
run: ./memoh-server migrate down
|
||||
|
||||
- name: Migrate up (idempotent)
|
||||
run: go run ./cmd/agent migrate up
|
||||
run: ./memoh-server migrate up
|
||||
|
||||
@@ -5,8 +5,16 @@ on:
|
||||
tags: ["v*.*.*"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "devenv/**"
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: docker-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
@@ -78,7 +86,7 @@ jobs:
|
||||
push: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
platforms: ${{ startsWith(github.ref, 'refs/tags/') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.meta.outputs.version }}
|
||||
COMMIT_HASH=${{ github.sha }}
|
||||
|
||||
Reference in New Issue
Block a user