forked from lambdaisland/kaocha
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (158 loc) · 5.82 KB
/
partition.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Test partitioned builds
on:
push:
branches:
- main
pull_request:
env:
# bump to purge caches
ACTIONS_CACHE_VERSION: v2
BB_VERSION: 1.12.195
CLOJURE_CLI_VERSION: 1.12.0.1479
CLOJURE_CACHE_PATHS: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
TARGET_PARTITION_MINUTES: 10
MAX_PARTITIONS: 10
DEFAULT_PARTITIONS: 5
jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
test-partitions: ${{ steps.test-partitions.outputs.test-partitions }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore Clojure dependencies
id: cache-check
uses: actions/cache@v4
with:
path: ${{ env.CLOJURE_CACHE_PATHS }}
key: cljdeps-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('deps.edn', 'bb.edn') }}
- name: Prepare java
if: steps.cache-check.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install clojure tools
if: steps.cache-check.outputs.cache-hit != 'true'
uses: DeLaGuardo/[email protected]
with:
cli: ${{ env.CLOJURE_CLI_VERSION }}
- name: Download Clojure deps
if: steps.cache-check.outputs.cache-hit != 'true'
working-directory:
run: ./bin/kaocha --version
- name: Profiling Cache
id: profiling
uses: actions/cache/restore@v4
with:
path: kaocha-profiling.edn
key: force-cache-miss-profiling-${{ env.ACTIONS_CACHE_VERSION }}-${{ github.ref }}-${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
profiling-${{ env.ACTIONS_CACHE_VERSION }}-${{ github.ref }}-${{ github.sha }}-
profiling-${{ env.ACTIONS_CACHE_VERSION }}-${{ github.ref }}-
profiling-${{ env.ACTIONS_CACHE_VERSION }}-
- name: Ensure profiling file exists
run: |
if [ ! -f kaocha-profiling.edn ]; then
echo '{}' > kaocha-profiling.edn
fi
set -x
cat kaocha-profiling.edn
- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
bb: ${{ env.BB_VERSION }}
- name: Setup matrix partitions
id: test-partitions
run: |
./bin/kaocha-bb --print-suggested-partitions \
'{:input-file "kaocha-profiling.edn"
:default-partitions ${{ env.DEFAULT_PARTITIONS }}
:max-partitions ${{ env.MAX_PARTITIONS }}
:debug "debug-suggested-partitions.txt"
:github-actions/set-matrix-output "test-partitions"}'
cat debug-suggested-partitions.txt
- name: Share profiling results with tests
uses: actions/upload-artifact@v4
with:
name: kaocha-profiling
path: kaocha-profiling.edn
test:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: setup
strategy:
fail-fast: false
matrix:
id: ${{ fromJSON(needs.setup.outputs.test-partitions) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: ${{ env.CLOJURE_CACHE_PATHS }}
key: cljdeps-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('deps.edn', 'bb.edn') }}
fail-on-cache-miss: true
- name: Download profiling results
uses: actions/download-artifact@v4
with:
name: kaocha-profiling
- name: Ensure profiling file exists
run: cat kaocha-profiling.edn
- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: ${{ env.CLOJURE_CLI_VERSION }}
- name: Restore Clojure cache
uses: actions/cache/restore@v4
with:
path: ${{ env.CLOJURE_CACHE_PATHS }}
key: cljdeps-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('deps.edn', 'bb.edn') }}
fail-on-cache-miss: true
- name: Run tests
run: ./bin/kaocha --read-profiling-file kaocha-profiling.edn --write-profiling-file current-kaocha-profiling-${{ strategy.job-index }}.edn --partition-index ${{ strategy.job-index }} --partitions ${{ strategy.job-total }} --partition-strategy :var-time --target-partition-minutes ${{ env.TARGET_PARTITION_MINUTES }} --max-partitions ${{ env.MAX_PARTITIONS }}
- name: Upload profiling results
if: always()
uses: actions/upload-artifact@v4
with:
name: current-kaocha-profiling-${{ strategy.job-index }}
path: current-kaocha-profiling-${{ strategy.job-index }}.edn
result:
timeout-minutes: 5
if: ${{!cancelled() && needs.setup.result == 'success'}}
runs-on: ubuntu-latest
needs: [setup, test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore Clojure dependencies
id: cache-check
uses: actions/cache@v4
with:
path: ${{ env.CLOJURE_CACHE_PATHS }}
key: cljdeps-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('deps.edn', 'bb.edn') }}
- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
bb: ${{ env.BB_VERSION }}
- name: Download test timings
uses: actions/download-artifact@v4
with:
pattern: current-kaocha-profiling-*
merge-multiple: true
- name: Combine results
run: |
./bin/kaocha-bb --combine-partitioned-results \
'{:result-files ["current-kaocha-profiling-*.edn"]
:output-file "kaocha-profiling.edn"}'
- name: Update Profiling Cache
id: profiling
uses: actions/cache/save@v4
with:
path: kaocha-profiling.edn
key: profiling-${{ env.ACTIONS_CACHE_VERSION }}-${{ github.ref }}-${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt }}