chore(ci): optimize runner costs with spot instances and leaner matrix

- Run all RunsOn jobs on spot instances (price-capacity-optimized)
- Limit push-to-main runs to the MongoDB/dedicated matrix; keep the
  full database/mode sweep for workflow_dispatch and PRs that change
  the utopia-php/database version
- Reduce runner volumes from 120GB to 60GB (~2x measured peak usage)
This commit is contained in:
Chirag Aggarwal committed 2026-07-02 08:56:05 +05:30
1 parent 264ed77f5a
commit 618423df3e
1 file changed
+12 -9
+12 -9
View File
@@ -188,8 +188,8 @@ jobs:
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const runner4 = `runs-on=${context.runId}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache`;
const runner8 = `runs-on=${context.runId}/runner=8cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache`;
const runner4 = `runs-on=${context.runId}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache`;
const runner8 = `runs-on=${context.runId}/runner=8cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache`;
const services = [
{ name: 'Account', runner: runner4, functional: true, processes: null, timeout: 15 },
@@ -242,7 +242,10 @@ jobs:
return getDbVersion(decode(base.content)) !== getDbVersion(decode(head.content));
};
if (!pr || await isDatabaseVersionChanged()) {
const fullMatrix = context.eventName === 'workflow_dispatch'
|| (pr && await isDatabaseVersionChanged());
if (fullMatrix) {
core.setOutput('databases', JSON.stringify(['MariaDB', 'PostgreSQL', 'MongoDB']));
core.setOutput('modes', JSON.stringify(['dedicated', 'shared']));
return;
@@ -253,7 +256,7 @@ jobs:
build:
name: Build
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+s3-cache+ecr-cache
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+s3-cache+ecr-cache
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -285,7 +288,7 @@ jobs:
unit:
name: Tests / Unit
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache
needs: build
permissions:
contents: read
@@ -348,7 +351,7 @@ jobs:
e2e_general:
name: Tests / E2E / General
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache
needs: build
permissions:
contents: read
@@ -542,7 +545,7 @@ jobs:
e2e_abuse:
name: Tests / E2E / Abuse (${{ matrix.mode }})
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache
needs: [build, matrix]
permissions:
contents: read
@@ -619,7 +622,7 @@ jobs:
e2e_screenshots:
name: Tests / E2E / Screenshots (${{ matrix.mode }})
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache
needs: [build, matrix]
permissions:
contents: read
@@ -702,7 +705,7 @@ jobs:
benchmark:
name: Benchmark
if: github.event_name == 'pull_request' || github.event_name == 'push'
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=120g/spot=false/extras=otel+ecr-cache
runs-on: runs-on=${{ github.run_id }}/runner=4cpu-linux-x64/volume=60g/spot=price-capacity-optimized/extras=otel+ecr-cache
needs: build
permissions:
actions: read