-
Notifications
You must be signed in to change notification settings - Fork 2
89 lines (86 loc) · 3.56 KB
/
Copy pathtest.yml
File metadata and controls
89 lines (86 loc) · 3.56 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
name: Docker scenarios
run-name: Docker scenarios
on:
workflow_call:
inputs:
test_scenarios:
description: 'A regexp to select what docker scenarios should be run'
required: false
type: string
default: '.*'
test_scenarios_exclude:
description: 'A regexp dropping scenarios matched by test_scenarios (RE2, unanchored)'
required: false
type: string
default: ''
ddtrace_install_url:
description: 'URL to a ddtrace install script (e.g. from S3 builds)'
required: false
type: string
default: ''
jobs:
list-scenarios:
runs-on: ubuntu-latest
outputs:
scenarios: ${{ steps.list.outputs.scenarios }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: 1.25.1
- name: Compute matrix
id: list
# ./cmd/list-scenarios emits a JSON array of {shard, regex} entries,
# chunking scenarios CHUNK_SIZE at a time. Chunking (vs one-per-scenario)
# trades a bit of head-of-line blocking inside a chunk for:
# - fewer runner-provisioning hits (paid once per chunk, not per scenario)
# - free local-daemon layer caching: buildBaseImages runs once per chunk,
# and the chunk's scenarios reuse the built base image.
run: |
matrix=$(go run ./cmd/list-scenarios -pattern '${{ inputs.test_scenarios }}' -exclude '${{ inputs.test_scenarios_exclude }}' -chunk-size 3)
echo "scenarios=$matrix" >> "$GITHUB_OUTPUT"
docker-scenarios:
needs: list-scenarios
name: scenarios ${{ matrix.shard }}
strategy:
fail-fast: false
max-parallel: 10
matrix:
include: ${{ fromJSON(needs.list-scenarios.outputs.scenarios) }}
# Larger runner (dedicated VM per job) to reduce scheduling noise that
# skews profiler error margins.
runs-on: ubuntu-8-core-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: 1.25.1
# Perf event paranoid setting: Not useful to everyone
- name: Update perf_event_paranoid settings
run: sudo sysctl kernel.perf_event_paranoid=1
- name: Run Docker scenarios
run: go test -timeout 20m -v -run TestScenarios
env:
# The matrix entry's regex is path-anchored (emitted by list-scenarios).
TEST_SCENARIOS: ${{ matrix.regex }}
DDTRACE_INSTALL_URL: ${{ inputs.ddtrace_install_url }}
- name: Create unique artifact name
id: artifact_name
if: failure()
run: |
SAFE_SHARD=$(echo "${{ matrix.shard }}" | sed 's/[^a-zA-Z0-9]/_/g')
echo "name=docker_scenario_test_data_${SAFE_SHARD}_${{ github.run_id }}" >> $GITHUB_OUTPUT
- name: Upload test files
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: failure()
with:
name: ${{ steps.artifact_name.outputs.name }}
path: data
- name: Notify Slack
if: failure() && github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch'
run: |
curl -X POST "${{ secrets.SLACK_WEBHOOK }}" \
-H 'Content-Type: application/json' \
-d "{'scenarios': '${{ matrix.names }}', 'failed_run_url': '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'}"