Skip to content

Commit 3e1dd14

Browse files
committed
Add demo workflow for matrix jobs on single runner
- Single EC2 instance runs 3 matrix jobs sequentially - Tests ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 - Shows that matrix jobs run one at a time on the same runner - 60 second grace period to allow all jobs to complete
1 parent 99df246 commit 3e1dd14

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Demo – matrix on single runner
2+
on:
3+
workflow_dispatch:
4+
workflow_call: # Tested by `demos.yml`
5+
permissions:
6+
id-token: write # Required for AWS OIDC authentication
7+
contents: read # Required for actions/checkout
8+
jobs:
9+
ec2:
10+
uses: ./.github/workflows/runner.yml
11+
secrets: inherit
12+
test-matrix:
13+
needs: ec2
14+
runs-on: ${{ needs.ec2.outputs.instance }}
15+
name: Test on ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
19+
steps:
20+
- name: Test on ${{ matrix.os }}
21+
run: |
22+
echo "Testing on ${{ matrix.os }}"
23+
echo "Runner: $(hostname)"
24+
echo "Time: $(date)"
25+
echo "Simulating work..."
26+
sleep 10
27+
echo "Done!"
28+
- name: Show system info
29+
run: |
30+
echo "=== System Information ==="
31+
uname -a
32+
echo "=== CPU Info ==="
33+
lscpu | head -10
34+
echo "=== Memory Info ==="
35+
free -h

.github/workflows/demos.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ jobs:
4848
uses: ./.github/workflows/demo-matrix.yml
4949
secrets: inherit
5050

51+
demo-matrix-single-runner:
52+
needs: check-ci
53+
if: ${{ needs.check-ci.outputs.should-run == 'true' }}
54+
uses: ./.github/workflows/demo-matrix-single-runner.yml
55+
secrets: inherit
56+
5157
# Summary job to ensure all tests passed
5258
demos-passed:
53-
needs: [demo-minimal, demo-multi-job, demo-full, demo-matrix]
59+
needs: [demo-minimal, demo-multi-job, demo-full, demo-matrix, demo-matrix-single-runner]
5460
runs-on: ubuntu-latest
5561
steps:
5662
- run: echo "✅ All demos passed!"

0 commit comments

Comments
 (0)