Skip to content

Commit e2849c8

Browse files
dylanjeffersclaude
andauthored
chore(ci): stop building Docker images on every branch push (#981)
## Goal Cut GitHub Actions spend. This repo's Actions cost is dominated by `build.yml`. ## Changes **`build.yml` — the big one.** It previously ran on `push: branches: ["**"]` — a full **amd64 + arm64 multi-arch build + push + GitHub Release on every push to every branch**. Branch-sha images aren't consumed by any deploy (`latest` is only tagged on main). Now: - builds only on `push: main` - `workflow_dispatch` retained so anyone can build a branch image on demand - `cancel-in-progress` concurrency so a newer main push supersedes an in-flight build **`test.yml`** — dropped the redundant `push: main` trigger (those commits were already tested on the PR) and added `cancel-in-progress` concurrency. Tests still gate every PR into main. ## Estimated savings Eliminates multi-arch Docker builds on all feature-branch pushes — the majority of this repo's ~$14/mo. Rough estimate **~60–70% of api Actions spend (~$8–10/mo)**. ## ⚠️ Reviewer check Confirm nothing pulls `audius/api:<sha>` images built from non-main branches (e.g. ephemeral test envs). If something does, we can re-add a narrower trigger. The manual `workflow_dispatch` covers ad-hoc branch builds in the meantime. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e36b83c commit e2849c8

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
name: Build Docker Image
22

33
on:
4+
# Only build/push images on main. Previously this ran on every push to every
5+
# branch ("**"), producing a full amd64 + arm64 multi-arch build, push, and
6+
# GitHub Release for every feature-branch commit — by far the largest source
7+
# of Actions spend in this repo. Feature-branch images are not consumed by any
8+
# deploy; use the manual trigger below to build one on demand when needed.
49
push:
5-
branches: ["**"]
10+
branches: [ main ]
11+
workflow_dispatch:
12+
13+
# Serialize main builds; a newer main push supersedes an older in-flight build.
14+
concurrency:
15+
group: build-${{ github.ref }}
16+
cancel-in-progress: true
617

718
jobs:
819
build-amd64:

.github/workflows/test.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
name: Go Tests with Docker Compose
22

33
on:
4-
push:
5-
branches: [ main ]
4+
# Tests gate PRs into main. The redundant push:main run (same commits already
5+
# tested on the PR) is dropped; keep workflow_dispatch for manual reruns.
66
pull_request:
77
branches: [ main ]
8+
workflow_dispatch:
9+
10+
# Cancel superseded runs when a PR is updated with new commits.
11+
concurrency:
12+
group: test-${{ github.head_ref || github.ref }}
13+
cancel-in-progress: true
814

915
jobs:
1016
test:

0 commit comments

Comments
 (0)