forked from temporalio/temporal
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (64 loc) · 2.25 KB
/
optimize-test-sharding.yml
File metadata and controls
78 lines (64 loc) · 2.25 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
name: Optimize Test Sharding
on:
schedule:
# Runs at 0700 UTC daily
- cron: "0 7 * * *"
workflow_dispatch: # Allow manual trigger
permissions:
contents: read
env:
SALT_FILE: tests/testcore/shard_salt.txt
BRANCH: auto/optimize-test-sharding
jobs:
update-salts:
runs-on: ubuntu-latest
steps:
- name: Generate GitHub token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}
owner: temporalio
- name: Checkout code
uses: actions/checkout@v6
with:
ref: main
token: ${{ steps.generate-token.outputs.token }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Optimize functional test sharding
run: |
# NOTE: shard count must match shards in run-tests.yml
go run ./cmd/tools/optimize-test-sharding \
-shards 3 \
-workflow run-tests.yml \
-artifact-pattern 'junit-xml--*shard*--functional-test' \
-file "${{ env.SALT_FILE }}" \
-threshold 0.05
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Create pull request
run: |
if git diff --quiet; then
echo "No changes to shard salt"
exit 0
fi
# Delete remote branch if it exists from a previous run.
# This will also close a previous, stuck PR if it exists.
git push origin --delete ${{ env.BRANCH }} 2>/dev/null || true
git config --local user.name 'Temporal Data'
git config --local user.email 'commander-data@temporal.io'
git checkout -b ${{ env.BRANCH }}
git add "${{ env.SALT_FILE }}"
git commit -m "Update test shard salt"
git push origin ${{ env.BRANCH }}
gh pr create \
--title "Update test shard salt" \
--body "Automatically generated by the optimize-test-sharding workflow."
gh pr merge ${{ env.BRANCH }} --auto --squash
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}