Skip to content

Commit c77be1b

Browse files
committed
ci: local-ci workflow — affected-port push gate + nightly full matrix on self-hosted runner
1 parent 16e635b commit c77be1b

1 file changed

Lines changed: 121 additions & 0 deletions

File tree

.github/workflows/local-ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Local CI — runs on the maintainer's self-hosted runner at ZERO Actions cost.
2+
#
3+
# SECURITY (public repo + self-hosted runner): this workflow must NEVER gain a
4+
# `pull_request` trigger. Push events to main can only come from users with
5+
# write access, so fork-submitted code cannot reach the runner. Keep it that way.
6+
#
7+
# Tiers:
8+
# push to main -> affected ports only (scripts/ci-affected-ports.sh)
9+
# nightly + dispatch -> full matrix
10+
name: local-ci
11+
on:
12+
push:
13+
branches: [main]
14+
schedule:
15+
- cron: '17 8 * * *'
16+
workflow_dispatch:
17+
inputs:
18+
tier:
19+
description: 'full = all ports; affected = ports touched by HEAD~1..HEAD'
20+
type: choice
21+
options: [full, affected]
22+
default: full
23+
24+
concurrency:
25+
group: local-ci-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
detect:
30+
runs-on: [self-hosted, linux]
31+
outputs:
32+
ports: ${{ steps.sel.outputs.ports }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
persist-credentials: false
38+
- id: sel
39+
env:
40+
BASE: ${{ github.event.before }}
41+
run: |
42+
if [ "${{ github.event_name }}" = "push" ]; then
43+
ports="$(scripts/ci-affected-ports.sh "$BASE" "$GITHUB_SHA")"
44+
elif [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.tier }}" = "affected" ]; then
45+
ports="$(scripts/ci-affected-ports.sh "$GITHUB_SHA~1" "$GITHUB_SHA")"
46+
else
47+
ports="ts java python csharp"
48+
fi
49+
echo "selected ports: '$ports'"
50+
echo "ports=$ports" >> "$GITHUB_OUTPUT"
51+
52+
gates:
53+
needs: detect
54+
runs-on: [self-hosted, linux]
55+
timeout-minutes: 20
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0 # leak-scan diffs against origin/main
60+
persist-credentials: false
61+
- run: scripts/ci-local.sh --only gates --strict-toolchains
62+
63+
ts:
64+
needs: detect
65+
if: contains(needs.detect.outputs.ports, 'ts')
66+
runs-on: [self-hosted, linux]
67+
timeout-minutes: 45
68+
steps:
69+
- uses: actions/checkout@v4
70+
with:
71+
persist-credentials: false
72+
- run: scripts/ci-local.sh --only ts --strict-toolchains
73+
74+
java:
75+
needs: detect
76+
if: contains(needs.detect.outputs.ports, 'java')
77+
runs-on: [self-hosted, linux]
78+
timeout-minutes: 60
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
persist-credentials: false
83+
- run: scripts/ci-local.sh --only java --strict-toolchains
84+
85+
python:
86+
needs: detect
87+
if: contains(needs.detect.outputs.ports, 'python')
88+
runs-on: [self-hosted, linux]
89+
timeout-minutes: 45
90+
steps:
91+
- uses: actions/checkout@v4
92+
with:
93+
persist-credentials: false
94+
- run: scripts/ci-local.sh --only python --strict-toolchains
95+
96+
csharp:
97+
needs: detect
98+
if: contains(needs.detect.outputs.ports, 'csharp')
99+
runs-on: [self-hosted, linux]
100+
timeout-minutes: 45
101+
steps:
102+
- uses: actions/checkout@v4
103+
with:
104+
persist-credentials: false
105+
- run: scripts/ci-local.sh --only csharp --strict-toolchains
106+
107+
notify:
108+
needs: [detect, gates, ts, java, python, csharp]
109+
if: always() && contains(needs.*.result, 'failure')
110+
runs-on: [self-hosted, linux]
111+
steps:
112+
- env:
113+
# env-indirection: head_commit.message is untrusted text — never
114+
# interpolate ${{ }} directly into the script body.
115+
HEAD_MSG: ${{ github.event.head_commit.message }}
116+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
117+
run: |
118+
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"
119+
notify-send -u critical "local-ci FAILED: metaobjects" \
120+
"$(printf '%s' "$HEAD_MSG" | head -n1)
121+
$RUN_URL" || echo "notify-send unavailable; GitHub email still fires"

0 commit comments

Comments
 (0)