ci(deploy): 镜像发布 - 原生多架构构建并复用提交镜像与缓存

This commit is contained in:
ddCat
2026-09-20 09:35:23 +08:00
parent 1be8ffce3b
commit 9afe061d79
9 changed files with 352 additions and 80 deletions

View File

@@ -2,9 +2,7 @@ name: Quality checks
on:
pull_request:
push:
branches:
- main
workflow_call:
permissions:
contents: read
@@ -21,11 +19,22 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
cache: true
- name: Check formatting
run: test -z "$(gofmt -l .)"
- name: Run Go tests
run: go test ./...
shell: bash
run: |
set -o pipefail
go test -json ./... | tee "$RUNNER_TEMP/go-tests.jsonl"
- name: Upload Go test timings
if: always()
uses: actions/upload-artifact@v4
with:
name: go-test-timings
path: ${{ runner.temp }}/go-tests.jsonl
if-no-files-found: ignore
payment-plugins:
name: Payment plugin artifacts
@@ -36,15 +45,22 @@ jobs:
env:
PAYMENT_PLUGIN_SMOKE_TEST: "1"
run: sh plugin-packages/verify-payment-packages.sh --all linux amd64
# 发布时 backend/Dockerfile 会在两种架构的原生 Runner 上执行 smoke。
# PR 仍独立验证双架构,不能因没有发布任务而遗漏 ARM64 验收。
- uses: docker/setup-qemu-action@v3
if: github.event_name == 'pull_request'
- uses: docker/setup-buildx-action@v3
if: github.event_name == 'pull_request'
- name: Build and execute payment packages for every image platform
run: >-
docker buildx build
--platform linux/amd64,linux/arm64
--target payment-package-smoke
--file backend/Dockerfile
.
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
target: payment-package-smoke
file: backend/Dockerfile
cache-from: type=gha,scope=payment-smoke
cache-to: type=gha,mode=max,scope=payment-smoke
web:
name: Web checks