ci: faster pipelines with checks-only ci and registry build cache
CI / checks (push) Failing after 2m8s

Drop duplicate Next.js builds from CI, skip release commits, and cancel stale runs.

Cache pnpm on runners and use buildx registry cache for releases.
This commit is contained in:
ginnoir
2026-07-04 23:54:53 -05:00
parent c80070f5c3
commit 876a283d47
3 changed files with 48 additions and 62 deletions
+7 -20
View File
@@ -11,8 +11,13 @@ on:
- "**/*.md" - "**/*.md"
- "docs/**" - "docs/**"
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
checks: checks:
if: "github.event_name == 'pull_request' || !startsWith(github.event.head_commit.message, 'chore: release')"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -21,6 +26,8 @@ jobs:
run: | run: |
corepack enable corepack enable
corepack prepare pnpm@10.33.3 --activate corepack prepare pnpm@10.33.3 --activate
mkdir -p /pnpm-store
pnpm config set store-dir /pnpm-store
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
@@ -33,23 +40,3 @@ jobs:
- name: Format check - name: Format check
run: pnpm format:check run: pnpm format:check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Enable pnpm
run: |
corepack enable
corepack prepare pnpm@10.33.3 --activate
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
env:
DATABASE_URL: postgres://ci_user:ci_password@localhost:5432/ci_database
AUTH_SECRET: ci-auth-secret-for-build
NEXT_PUBLIC_APP_URL: http://localhost:3000
+30 -12
View File
@@ -9,6 +9,10 @@ on:
- "v*" - "v*"
workflow_dispatch: workflow_dispatch:
concurrency:
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs: jobs:
build-and-push: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -27,8 +31,15 @@ jobs:
echo "image=registry.ginnoir.com/ginnoir/famapp" echo "image=registry.ginnoir.com/ginnoir/famapp"
} >> "$GITHUB_OUTPUT" } >> "$GITHUB_OUTPUT"
- name: Install docker - name: Ensure docker CLI
run: apt-get update -qq && apt-get install -y -qq docker.io run: |
if command -v docker >/dev/null 2>&1; then
echo "docker already available"
docker version
exit 0
fi
apt-get update -qq && apt-get install -y -qq docker.io
docker version
- name: Login to registry - name: Login to registry
run: | run: |
@@ -36,16 +47,23 @@ jobs:
--username "${{ secrets.REGISTRY_PUSH_USERNAME }}" \ --username "${{ secrets.REGISTRY_PUSH_USERNAME }}" \
--password-stdin --password-stdin
- name: Build image - name: Set up buildx
run: | run: |
docker build \ docker buildx create --name famapp-builder --use 2>/dev/null || docker buildx use famapp-builder
-t "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}" \ docker buildx inspect --bootstrap
-t "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.major_minor }}" \
-t "${{ steps.meta.outputs.image }}:latest" \
.
- name: Push image - name: Build and push image
env:
IMAGE: ${{ steps.meta.outputs.image }}
VERSION: ${{ steps.meta.outputs.version }}
MAJOR_MINOR: ${{ steps.meta.outputs.major_minor }}
CACHE: registry.ginnoir.com/ginnoir/famapp:buildcache
run: | run: |
docker push "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}" docker buildx build \
docker push "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.major_minor }}" --push \
docker push "${{ steps.meta.outputs.image }}:latest" --tag "${IMAGE}:${VERSION}" \
--tag "${IMAGE}:${MAJOR_MINOR}" \
--tag "${IMAGE}:latest" \
--cache-from "type=registry,ref=${CACHE}" \
--cache-to "type=registry,ref=${CACHE},mode=max" \
.
+11 -30
View File
@@ -3,10 +3,21 @@ name: CI
on: on:
push: push:
branches: [main] branches: [main]
paths-ignore:
- "**/*.md"
- "docs/**"
pull_request: pull_request:
paths-ignore:
- "**/*.md"
- "docs/**"
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
checks: checks:
if: "github.event_name == 'pull_request' || !startsWith(github.event.head_commit.message, 'chore: release')"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -27,33 +38,3 @@ jobs:
- run: pnpm lint - run: pnpm lint
- run: pnpm format:check - run: pnpm format:check
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.33.3
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('src/**/*.ts', 'src/**/*.tsx', 'src/**/*.css') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }}-
${{ runner.os }}-nextjs-
- run: pnpm build
env:
DATABASE_URL: postgres://placeholder:placeholder@localhost:5432/placeholder
AUTH_SECRET: ci-placeholder-secret
NEXT_PUBLIC_APP_URL: http://localhost:3000