Skip to content

Commit 05f0177

Browse files
committed
Mergify setup
1 parent 39b6044 commit 05f0177

File tree

3 files changed

+266
-0
lines changed

3 files changed

+266
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Flaky Test Simulation'
2+
description: 'Simulates flaky test behavior for merge queue testing'
3+
inputs:
4+
failure-rate:
5+
description: 'Percentage chance of failure (0-100)'
6+
required: false
7+
default: '10'
8+
stable-prefix:
9+
description: 'Branch prefix that ensures success'
10+
required: false
11+
default: 'stable-'
12+
test-name:
13+
description: 'Name of the test being simulated'
14+
required: false
15+
default: 'generic test'
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Flaky Test Simulation
21+
shell: bash
22+
run: |
23+
echo "🎲 Running flaky test simulation for: ${{ inputs.test-name }}"
24+
echo "Branch: ${{ github.head_ref }}"
25+
echo "Base branch: ${{ github.base_ref }}"
26+
echo "Failure rate: ${{ inputs.failure-rate }}%"
27+
28+
# Check if base branch is master-mergify (no flaky failures for mergify)
29+
if [[ "${{ github.base_ref }}" == "master-mergify" ]]; then
30+
echo "✅ Base branch is 'master-mergify' - no flaky failures for mergify merge queue"
31+
exit 0
32+
fi
33+
34+
# Check if branch has stable prefix
35+
if [[ "${{ github.head_ref }}" == ${{ inputs.stable-prefix }}* ]]; then
36+
echo "✅ Branch has stable prefix '${{ inputs.stable-prefix }}' - guaranteed success"
37+
exit 0
38+
fi
39+
40+
# Generate random number between 1-100
41+
RANDOM_NUM=$((1 + RANDOM % 100))
42+
echo "Random number: $RANDOM_NUM"
43+
44+
# Check if we should fail
45+
if [ $RANDOM_NUM -le ${{ inputs.failure-rate }} ]; then
46+
echo "💥 Simulating flaky test failure ($RANDOM_NUM <= ${{ inputs.failure-rate }})"
47+
echo "This represents the ${{ inputs.failure-rate }}% flaky failure rate"
48+
exit 1
49+
else
50+
echo "✅ Test passed ($RANDOM_NUM > ${{ inputs.failure-rate }})"
51+
exit 0
52+
fi

.github/mergify.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
queue_rules:
2+
- name: default
3+
checks_timeout: 1 min
4+
queue_conditions:
5+
# Equivalent of bors.pr_status
6+
- check-success = license/cla-success
7+
- check-success = blathers/release-justification-check-success
8+
- check-success = check_base_branch
9+
# Require at least one approval
10+
- "#approved-reviews-by >= 0"
11+
# Block PRs with certain labels
12+
- label != do-not-merge"
13+
- label != backport
14+
merge_conditions:
15+
# Equivalent of bors.status (must pass on the speculative branch)
16+
- check-success = acceptance
17+
- check-success = check_generated_code
18+
- check-success = docker_image_amd64
19+
- check-success = examples_orms
20+
- check-success = lint
21+
- check-success = linux_amd64_build
22+
- check-success = linux_amd64_fips_build
23+
- check-success = local_roachtest
24+
- check-success = local_roachteste_fips
25+
- check-success = unit_tests
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
name: GitHub Actions Essential CI (Master-mergify)
2+
on:
3+
merge_group:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
branches:
7+
- "master-mergify"
8+
- "!master-trunk"
9+
- "!master-gmq"
10+
push:
11+
branches:
12+
- "master-mergify"
13+
- "staging"
14+
- "trying"
15+
- "mergify-merge/**" # Support push-triggered mode for mergify Merge Queue
16+
- "!master-trunk"
17+
- "!master-gmq"
18+
workflow_dispatch:
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
env:
24+
FLAKY_FAILURE_RATE: 10 # 10% chance of failure for non-stable branches
25+
jobs:
26+
acceptance:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 5
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
33+
- name: compute metadata
34+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
35+
- name: flaky test simulation
36+
uses: ./.github/actions/flaky-test-sim
37+
with:
38+
failure-rate: ${{ env.FLAKY_FAILURE_RATE }}
39+
test-name: "acceptance tests"
40+
- name: dummy acceptance tests
41+
run: |
42+
echo "🧪 Running acceptance tests..."
43+
sleep 3
44+
echo "✅ Acceptance tests passed!"
45+
check_generated_code:
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 5
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
52+
- name: compute metadata
53+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
54+
- name: flaky test simulation
55+
uses: ./.github/actions/flaky-test-sim
56+
with:
57+
failure-rate: ${{ env.FLAKY_FAILURE_RATE }}
58+
test-name: "generated code check"
59+
- name: dummy check generated code
60+
run: |
61+
echo "🔍 Checking generated code..."
62+
sleep 3
63+
echo "✅ Generated code check passed!"
64+
docker_image_amd64:
65+
runs-on: ubuntu-latest
66+
timeout-minutes: 5
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
71+
- name: compute metadata
72+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
73+
- name: flaky test simulation
74+
uses: ./.github/actions/flaky-test-sim
75+
with:
76+
failure-rate: ${{ env.FLAKY_FAILURE_RATE }}
77+
test-name: "docker tests"
78+
- name: dummy docker tests
79+
run: |
80+
echo "🐳 Running docker tests..."
81+
sleep 3
82+
echo "✅ Docker tests passed!"
83+
examples_orms:
84+
runs-on: ubuntu-latest
85+
timeout-minutes: 5
86+
steps:
87+
- uses: actions/checkout@v4
88+
with:
89+
path: cockroach
90+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
91+
- name: compute metadata
92+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
93+
- name: dummy ORM tests
94+
run: |
95+
echo "🔗 Running ORM examples tests..."
96+
sleep 3
97+
echo "✅ ORM tests passed!"
98+
lint:
99+
runs-on: ubuntu-latest
100+
timeout-minutes: 5
101+
steps:
102+
- uses: actions/checkout@v4
103+
with:
104+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
105+
submodules: true
106+
- name: compute metadata
107+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
108+
- name: dummy lint tests
109+
run: |
110+
echo "🧹 Running lint tests..."
111+
sleep 3
112+
echo "✅ Lint tests passed!"
113+
local_roachtest:
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 5
116+
steps:
117+
- uses: actions/checkout@v4
118+
with:
119+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
120+
submodules: true
121+
- name: compute metadata
122+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
123+
- name: dummy local roachtests
124+
run: |
125+
echo "🚀 Running local roachtests..."
126+
sleep 3
127+
echo "✅ Local roachtests passed!"
128+
local_roachtest_fips:
129+
runs-on: ubuntu-latest
130+
timeout-minutes: 5
131+
steps:
132+
- uses: actions/checkout@v4
133+
with:
134+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
135+
submodules: true
136+
- name: compute metadata
137+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
138+
- name: dummy FIPS roachtests
139+
run: |
140+
echo "🔒 Running FIPS roachtests..."
141+
sleep 3
142+
echo "✅ FIPS roachtests passed!"
143+
linux_amd64_build:
144+
runs-on: ubuntu-latest
145+
timeout-minutes: 5
146+
steps:
147+
- uses: actions/checkout@v4
148+
with:
149+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
150+
- name: compute metadata
151+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
152+
- name: dummy build
153+
run: |
154+
echo "🔨 Building Linux AMD64..."
155+
sleep 3
156+
echo "✅ Linux AMD64 build passed!"
157+
linux_amd64_fips_build:
158+
runs-on: ubuntu-latest
159+
timeout-minutes: 5
160+
steps:
161+
- uses: actions/checkout@v4
162+
with:
163+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
164+
- name: compute metadata
165+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
166+
- name: dummy FIPS build
167+
run: |
168+
echo "🔨 Building Linux AMD64 FIPS..."
169+
sleep 3
170+
echo "✅ Linux AMD64 FIPS build passed!"
171+
unit_tests:
172+
runs-on: ubuntu-latest
173+
timeout-minutes: 5
174+
steps:
175+
- uses: actions/checkout@v4
176+
with:
177+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
178+
- name: compute metadata
179+
run: echo GITHUB_ACTIONS_BRANCH=${{ github.event.pull_request.number || github.ref_name}} >> "$GITHUB_ENV"
180+
- name: flaky test simulation
181+
uses: ./.github/actions/flaky-test-sim
182+
with:
183+
failure-rate: ${{ env.FLAKY_FAILURE_RATE }}
184+
test-name: "unit tests"
185+
- name: dummy unit tests
186+
run: |
187+
echo "🧪 Running unit tests..."
188+
sleep 3
189+
echo "✅ Unit tests passed!"

0 commit comments

Comments
 (0)