-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (85 loc) · 2.46 KB
/
Copy pathtest-dummy-concurrency.yml
File metadata and controls
92 lines (85 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Test Concurrency Groups
on:
workflow_dispatch:
inputs:
max_parallel:
description: 'Max parallel jobs (1-10)'
required: true
default: '2'
type: choice
options:
- '1'
- '2'
- '3'
- '5'
- '10'
job_count:
description: 'Number of jobs to run'
required: true
default: '10'
type: choice
options:
- '5'
- '10'
- '20'
- '37'
workflow_call:
inputs:
max_parallel:
description: 'Max parallel jobs'
required: false
default: '2'
type: string
job_count:
description: 'Number of jobs to run'
required: false
default: '5'
type: string
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
max_parallel: ${{ inputs.max_parallel }}
steps:
- id: set-matrix
run: |
COUNT=${{ inputs.job_count }}
MATRIX=$(seq 1 $COUNT | jq -R . | jq -s -c .)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Generated matrix with $COUNT jobs: $MATRIX"
dummy-job:
needs: setup
runs-on: [self-hosted, modal, "job-${{ github.run_id }}-${{ strategy.job-index }}", "max-parallel-${{ inputs.max_parallel }}"]
name: Dummy Job ${{ matrix.job }} (Modal)
strategy:
fail-fast: false
max-parallel: ${{ fromJson(inputs.max_parallel) }}
matrix:
job: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Job Start
run: |
echo "========================================="
echo "Job ${{ matrix.job }} starting"
echo "Max parallel: ${{ inputs.max_parallel }}"
echo "Total jobs: ${{ inputs.job_count }}"
echo "Start time: $(date)"
echo "Runner: $(hostname)"
echo "========================================="
- name: Simulate Work
run: |
echo "Simulating API calls like daily-search..."
for i in {1..5}; do
echo " API call $i/5 at $(date)"
sleep 10
done
- name: Job Complete
if: always()
run: |
echo "========================================="
echo "Job ${{ matrix.job }} completed"
echo "End time: $(date)"
echo "========================================="