1515 - c-chain-reexecution-hashdb-33m-33m500k
1616 - c-chain-reexecution-firewood-101-250k
1717 - c-chain-reexecution-firewood-33m-33m500k
18+ runner :
19+ description : ' Runner to execute the benchmark'
20+ required : false
21+ default : ' ubuntu-latest'
22+ self-hosted :
23+ description : ' Use self-hosted runner with ARC container'
24+ required : false
25+ default : false
26+ type : boolean
1827 timeout-minutes :
1928 description : ' Timeout in minutes for the job'
2029 required : false
@@ -29,25 +38,64 @@ jobs:
2938 outputs :
3039 matrix-native : ${{ steps.define-matrix.outputs.matrix-native }}
3140 matrix-self-hosted : ${{ steps.define-matrix.outputs.matrix-self-hosted }}
41+ monitoring-enabled : ${{ steps.check-monitoring.outputs.enabled }}
3242 steps :
3343 - uses : actions/checkout@v4
44+ - name : Check monitoring credentials
45+ id : check-monitoring
46+ run : |
47+ if [[ -n "${{ secrets.PROMETHEUS_URL }}" ]]; then
48+ echo "enabled=true" >> "$GITHUB_OUTPUT"
49+ else
50+ echo "enabled=false" >> "$GITHUB_OUTPUT"
51+ fi
3452 - name : Define Matrix
3553 id : define-matrix
54+ shell : bash
3655 run : |
37- full_matrix=$(jq -c ".\"${{ github.event_name }}\"" "$GITHUB_WORKSPACE/.github/workflows/c-chain-reexecution-benchmark-config.json")
38- native_matrix=$(echo "$full_matrix" | jq -c '{include: [.include[] | select(.self_hosted == false)]}')
39- self_hosted_matrix=$(echo "$full_matrix" | jq -c '{include: [.include[] | select(.self_hosted == true)]}')
40- {
41- echo "matrix-native<<EOF"
42- echo "$native_matrix"
43- echo EOF
44- echo "matrix-self-hosted<<EOF"
45- echo "$self_hosted_matrix"
46- echo EOF
47- } >> "$GITHUB_OUTPUT"
56+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
57+ if [[ "${{ github.event.inputs.self-hosted }}" == "true" ]]; then
58+ {
59+ echo "matrix-native<<EOF"
60+ echo '{"include":[]}'
61+ echo EOF
62+ echo "matrix-self-hosted<<EOF"
63+ printf '{"include":[{"task":"%s","runner":"%s","timeout-minutes":%s}]}\n' \
64+ "${{ github.event.inputs.task }}" \
65+ "${{ github.event.inputs.runner }}" \
66+ "${{ github.event.inputs.timeout-minutes }}"
67+ echo EOF
68+ } >> "$GITHUB_OUTPUT"
69+ else
70+ {
71+ echo "matrix-native<<EOF"
72+ printf '{"include":[{"task":"%s","runner":"%s","timeout-minutes":%s}]}\n' \
73+ "${{ github.event.inputs.task }}" \
74+ "${{ github.event.inputs.runner }}" \
75+ "${{ github.event.inputs.timeout-minutes }}"
76+ echo EOF
77+ echo "matrix-self-hosted<<EOF"
78+ echo '{"include":[]}'
79+ echo EOF
80+ } >> "$GITHUB_OUTPUT"
81+ fi
82+ else
83+ full_matrix=$(jq -r ".\"${{ github.event_name }}\"" .github/workflows/c-chain-reexecution-benchmark-config.json)
84+ native_matrix=$(echo "$full_matrix" | jq '{include: [.include[] | select(.self_hosted == false)]}')
85+ self_hosted_matrix=$(echo "$full_matrix" | jq '{include: [.include[] | select(.self_hosted == true)]}')
86+ {
87+ echo "matrix-native<<EOF"
88+ echo "$native_matrix"
89+ echo EOF
90+ echo "matrix-self-hosted<<EOF"
91+ echo "$self_hosted_matrix"
92+ echo EOF
93+ } >> "$GITHUB_OUTPUT"
94+ fi
4895
4996 c-chain-reexecution-native :
5097 needs : define-matrix
98+ if : ${{ fromJSON(needs.define-matrix.outputs.matrix-native).include[0] != null }}
5199 strategy :
52100 fail-fast : false
53101 matrix : ${{ fromJSON(needs.define-matrix.outputs.matrix-native) }}
95143 role-to-assume : ${{ secrets.AWS_S3_READ_ONLY_ROLE }}
96144 aws-region : us-east-2
97145 - name : Show Grafana Dashboard Link
98- # if: ${{ secrets.PROMETHEUS_URL == '' }}
146+ if : needs.define-matrix.outputs.monitoring-enabled == 'true'
99147 shell : bash
100148 run : |
101149 from_timestamp="$(date '+%s')"
@@ -112,7 +160,7 @@ jobs:
112160 echo "Grafana: ${grafana_url}"
113161 echo "🔗 [View Grafana Dashboard](${grafana_url})" >> "$GITHUB_STEP_SUMMARY"
114162 - name : Warn about missing monitoring credentials
115- # if: ${{ secrets.PROMETHEUS_URL == '' }}
163+ if : needs.define-matrix.outputs.monitoring-enabled == 'true'
116164 shell : bash
117165 run : echo "::warning::Monitoring credentials not found. Metrics collection will be skipped. Is this a PR from a fork?"
118166 - name : Set execution data directory
@@ -180,145 +228,146 @@ jobs:
180228 github-token : ${{ secrets.GITHUB_TOKEN }}
181229 auto-push : ${{ github.event_name == 'schedule' }}
182230
183- # c-chain-reexecution-self-hosted:
184- # needs: define-matrix
185- # strategy:
186- # fail-fast: false
187- # matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix-self-hosted) }}
188- # timeout-minutes: ${{ matrix.timeout-minutes }}
189- # runs-on: ${{ matrix.runner }}
190- # container:
191- # image: ghcr.io/actions/actions-runner:2.325.0
192- # permissions:
193- # id-token: write
194- # contents: write
195- # steps:
196- # - uses: actions/checkout@v4
197- # - name: Install ARC Dependencies
198- # shell: bash
199- # run: |
200- # if ! command -v xz &> /dev/null; then
201- # sudo apt-get update
202- # sudo apt-get install -y xz-utils
203- # fi
204- # - name: Install Nix
205- # uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f
206- # with:
207- # github_access_token: ${{ secrets.GITHUB_TOKEN }}
208- # - name: Verify Nix installation
209- # shell: bash
210- # run: nix develop --command echo "Nix dependencies installed"
211- # - name: Cache Go modules
212- # uses: actions/cache@v4
213- # id: go-mod-cache
214- # with:
215- # path: ~/go/pkg/mod
216- # key: ${{ runner.os }}-go-mod-${{ hashFiles('go.sum', 'tools/go.sum') }}
217- # restore-keys: ${{ runner.os }}-go-mod-
218- # - name: Cache Go build
219- # uses: actions/cache@v4
220- # with:
221- # path: ~/.cache/go-build
222- # key: ${{ runner.os }}-${{ runner.arch }}-go-build-${{ hashFiles('go.sum', 'tools/go.sum') }}
223- # restore-keys: ${{ runner.os }}-${{ runner.arch }}-go-build-
224- # - name: Download Go modules
225- # if: steps.go-mod-cache.outputs.cache-hit != 'true'
226- # shell: bash
227- # run: nix develop --command go mod download
228- # - name: Download tools Go modules
229- # if: steps.go-mod-cache.outputs.cache-hit != 'true'
230- # shell: bash
231- # run: |
232- # if [[ -f tools/go.mod ]]; then
233- # nix develop --command go mod download -modfile=tools/go.mod
234- # fi
235- # - name: Configure AWS Credentials
236- # uses: aws-actions/configure-aws-credentials@v4
237- # with:
238- # role-to-assume: ${{ secrets.AWS_S3_READ_ONLY_ROLE }}
239- # aws-region: us-east-2
240- # - name: Show Grafana Dashboard Link
241- # if: ${{ secrets.PROMETHEUS_URL != '' }}
242- # shell: bash
243- # run: |
244- # from_timestamp="$(date '+%s')"
245- # monitoring_period=900
246- # to_timestamp="$((from_timestamp + monitoring_period))"
247- # grafana_url="https://grafana-poc.avax-dev.network/d/Gl1I20mnk/c-chain"
248- # grafana_url="${grafana_url}?orgId=1&refresh=10s"
249- # grafana_url="${grafana_url}&var-filter=is_ephemeral_node%7C%3D%7Cfalse"
250- # grafana_url="${grafana_url}&var-filter=gh_repo%7C%3D%7C${{ github.repository }}"
251- # grafana_url="${grafana_url}&var-filter=gh_run_id%7C%3D%7C${{ github.run_id }}"
252- # grafana_url="${grafana_url}&var-filter=gh_run_attempt%7C%3D%7C${{ github.run_attempt }}"
253- # grafana_url="${grafana_url}&var-filter=gh_job_id%7C%3D%7C${{ github.job }}"
254- # grafana_url="${grafana_url}&from=${from_timestamp}000&to=${to_timestamp}000"
255- # echo "Grafana: ${grafana_url}"
256- # echo "🔗 [View Grafana Dashboard](${grafana_url})" >> "$GITHUB_STEP_SUMMARY"
257- # - name: Warn about missing monitoring credentials
258- # if: ${{ secrets.PROMETHEUS_URL == '' }}
259- # shell: bash
260- # run: echo "::warning::Monitoring credentials not found. Metrics collection will be skipped. Is this a PR from a fork?"
261- # - name: Set execution data directory
262- # id: exec-dir
263- # shell: bash
264- # run: |
265- # TIMESTAMP=$(date '+%Y%m%d-%H%M%S')
266- # EXEC_DIR="${{ github.workspace }}/reexecution-data-${TIMESTAMP}"
267- # echo "EXECUTION_DATA_DIR=${EXEC_DIR}" >> $GITHUB_OUTPUT
268- # echo "Using execution directory: ${EXEC_DIR}"
269- # - name: Run C-Chain Re-execution Benchmark
270- # shell: nix develop --impure --command bash -x {0}
271- # run: |
272- # ./scripts/run_task.sh ${{ matrix.task }} \
273- # RUNNER_NAME="${{ matrix.runner }}" \
274- # BENCHMARK_OUTPUT_FILE="${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}/benchmark-output.txt" \
275- # EXECUTION_DATA_DIR="${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}"
276- # env:
277- # TMPNET_START_METRICS_COLLECTOR: ${{ secrets.PROMETHEUS_URL != '' }}
278- # TMPNET_START_LOGS_COLLECTOR: ${{ secrets.LOKI_URL != '' }}
279- # TMPNET_CHECK_METRICS_COLLECTED: ${{ secrets.PROMETHEUS_URL != '' }}
280- # TMPNET_CHECK_LOGS_COLLECTED: ${{ secrets.LOKI_URL != '' }}
281- # PROMETHEUS_URL: ${{ secrets.PROMETHEUS_URL }}
282- # PROMETHEUS_PUSH_URL: ${{ secrets.PROMETHEUS_PUSH_URL }}
283- # PROMETHEUS_USERNAME: ${{ secrets.PROMETHEUS_USERNAME }}
284- # PROMETHEUS_PASSWORD: ${{ secrets.PROMETHEUS_PASSWORD }}
285- # LOKI_URL: ${{ secrets.LOKI_URL }}
286- # LOKI_PUSH_URL: ${{ secrets.LOKI_PUSH_URL }}
287- # LOKI_USERNAME: ${{ secrets.LOKI_USERNAME }}
288- # LOKI_PASSWORD: ${{ secrets.LOKI_PASSWORD }}
289- # GH_REPO: ${{ github.repository }}
290- # GH_WORKFLOW: ${{ github.workflow }}
291- # GH_RUN_ID: ${{ github.run_id }}
292- # GH_RUN_NUMBER: ${{ github.run_number }}
293- # GH_RUN_ATTEMPT: ${{ github.run_attempt }}
294- # GH_JOB_ID: ${{ github.job }}
295- # AWS_REGION: us-east-2
296- # AWS_DEFAULT_REGION: us-east-2
297- # - name: Upload monitoring data
298- # if: always()
299- # uses: actions/upload-artifact@v4
300- # with:
301- # name: ${{ matrix.task }}-${{ matrix.runner }}-monitoring
302- # path: |
303- # ~/.tmpnet/networks
304- # ~/.tmpnet/prometheus/prometheus.log
305- # ~/.tmpnet/promtail/promtail.log
306- # if-no-files-found: warn
307- # - name: Upload benchmark results
308- # if: always()
309- # uses: actions/upload-artifact@v4
310- # with:
311- # name: ${{ matrix.task }}-${{ matrix.runner }}-results
312- # path: |
313- # ${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}/benchmark-output.txt
314- # ${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}
315- # if-no-files-found: warn
316- # - name: Compare Benchmark Results
317- # if: always()
318- # uses: benchmark-action/github-action-benchmark@v1
319- # with:
320- # tool: 'go'
321- # output-file-path: ${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}/benchmark-output.txt
322- # summary-always: true
323- # github-token: ${{ secrets.GITHUB_TOKEN }}
324- # auto-push: ${{ github.event_name == 'schedule' }}
231+ c-chain-reexecution-self-hosted :
232+ needs : define-matrix
233+ if : ${{ fromJSON(needs.define-matrix.outputs.matrix-self-hosted).include[0] != null }}
234+ strategy :
235+ fail-fast : false
236+ matrix : ${{ fromJSON(needs.define-matrix.outputs.matrix-self-hosted) }}
237+ timeout-minutes : ${{ matrix.timeout-minutes }}
238+ runs-on : ${{ matrix.runner }}
239+ container :
240+ image : ghcr.io/actions/actions-runner:2.325.0
241+ permissions :
242+ id-token : write
243+ contents : write
244+ steps :
245+ - uses : actions/checkout@v4
246+ - name : Install ARC Dependencies
247+ shell : bash
248+ run : |
249+ if ! command -v xz &> /dev/null; then
250+ sudo apt-get update
251+ sudo apt-get install -y xz-utils
252+ fi
253+ - name : Install Nix
254+ uses : cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f
255+ with :
256+ github_access_token : ${{ secrets.GITHUB_TOKEN }}
257+ - name : Verify Nix installation
258+ shell : bash
259+ run : nix develop --command echo "Nix dependencies installed"
260+ - name : Cache Go modules
261+ uses : actions/cache@v4
262+ id : go-mod-cache
263+ with :
264+ path : ~/go/pkg/mod
265+ key : ${{ runner.os }}-go-mod-${{ hashFiles('go.sum', 'tools/go.sum') }}
266+ restore-keys : ${{ runner.os }}-go-mod-
267+ - name : Cache Go build
268+ uses : actions/cache@v4
269+ with :
270+ path : ~/.cache/go-build
271+ key : ${{ runner.os }}-${{ runner.arch }}-go-build-${{ hashFiles('go.sum', 'tools/go.sum') }}
272+ restore-keys : ${{ runner.os }}-${{ runner.arch }}-go-build-
273+ - name : Download Go modules
274+ if : steps.go-mod-cache.outputs.cache-hit != 'true'
275+ shell : bash
276+ run : nix develop --command go mod download
277+ - name : Download tools Go modules
278+ if : steps.go-mod-cache.outputs.cache-hit != 'true'
279+ shell : bash
280+ run : |
281+ if [[ -f tools/go.mod ]]; then
282+ nix develop --command go mod download -modfile=tools/go.mod
283+ fi
284+ - name : Configure AWS Credentials
285+ uses : aws-actions/configure-aws-credentials@v4
286+ with :
287+ role-to-assume : ${{ secrets.AWS_S3_READ_ONLY_ROLE }}
288+ aws-region : us-east-2
289+ - name : Show Grafana Dashboard Link
290+ if : needs.define-matrix.outputs.monitoring-enabled == 'true'
291+ shell : bash
292+ run : |
293+ from_timestamp="$(date '+%s')"
294+ monitoring_period=900
295+ to_timestamp="$((from_timestamp + monitoring_period))"
296+ grafana_url="https://grafana-poc.avax-dev.network/d/Gl1I20mnk/c-chain"
297+ grafana_url="${grafana_url}?orgId=1&refresh=10s"
298+ grafana_url="${grafana_url}&var-filter=is_ephemeral_node%7C%3D%7Cfalse"
299+ grafana_url="${grafana_url}&var-filter=gh_repo%7C%3D%7C${{ github.repository }}"
300+ grafana_url="${grafana_url}&var-filter=gh_run_id%7C%3D%7C${{ github.run_id }}"
301+ grafana_url="${grafana_url}&var-filter=gh_run_attempt%7C%3D%7C${{ github.run_attempt }}"
302+ grafana_url="${grafana_url}&var-filter=gh_job_id%7C%3D%7C${{ github.job }}"
303+ grafana_url="${grafana_url}&from=${from_timestamp}000&to=${to_timestamp}000"
304+ echo "Grafana: ${grafana_url}"
305+ echo "🔗 [View Grafana Dashboard](${grafana_url})" >> "$GITHUB_STEP_SUMMARY"
306+ - name : Warn about missing monitoring credentials
307+ if : needs.define-matrix.outputs.monitoring-enabled == 'true'
308+ shell : bash
309+ run : echo "::warning::Monitoring credentials not found. Metrics collection will be skipped. Is this a PR from a fork?"
310+ - name : Set execution data directory
311+ id : exec-dir
312+ shell : bash
313+ run : |
314+ TIMESTAMP=$(date '+%Y%m%d-%H%M%S')
315+ EXEC_DIR="${{ github.workspace }}/reexecution-data-${TIMESTAMP}"
316+ echo "EXECUTION_DATA_DIR=${EXEC_DIR}" >> $GITHUB_OUTPUT
317+ echo "Using execution directory: ${EXEC_DIR}"
318+ - name : Run C-Chain Re-execution Benchmark
319+ shell : nix develop --impure --command bash -x {0}
320+ run : |
321+ ./scripts/run_task.sh ${{ matrix.task }} \
322+ RUNNER_NAME="${{ matrix.runner }}" \
323+ BENCHMARK_OUTPUT_FILE="${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}/benchmark-output.txt" \
324+ EXECUTION_DATA_DIR="${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}"
325+ env :
326+ TMPNET_START_METRICS_COLLECTOR : ${{ secrets.PROMETHEUS_URL != '' }}
327+ TMPNET_START_LOGS_COLLECTOR : ${{ secrets.LOKI_URL != '' }}
328+ TMPNET_CHECK_METRICS_COLLECTED : ${{ secrets.PROMETHEUS_URL != '' }}
329+ TMPNET_CHECK_LOGS_COLLECTED : ${{ secrets.LOKI_URL != '' }}
330+ PROMETHEUS_URL : ${{ secrets.PROMETHEUS_URL }}
331+ PROMETHEUS_PUSH_URL : ${{ secrets.PROMETHEUS_PUSH_URL }}
332+ PROMETHEUS_USERNAME : ${{ secrets.PROMETHEUS_USERNAME }}
333+ PROMETHEUS_PASSWORD : ${{ secrets.PROMETHEUS_PASSWORD }}
334+ LOKI_URL : ${{ secrets.LOKI_URL }}
335+ LOKI_PUSH_URL : ${{ secrets.LOKI_PUSH_URL }}
336+ LOKI_USERNAME : ${{ secrets.LOKI_USERNAME }}
337+ LOKI_PASSWORD : ${{ secrets.LOKI_PASSWORD }}
338+ GH_REPO : ${{ github.repository }}
339+ GH_WORKFLOW : ${{ github.workflow }}
340+ GH_RUN_ID : ${{ github.run_id }}
341+ GH_RUN_NUMBER : ${{ github.run_number }}
342+ GH_RUN_ATTEMPT : ${{ github.run_attempt }}
343+ GH_JOB_ID : ${{ github.job }}
344+ AWS_REGION : us-east-2
345+ AWS_DEFAULT_REGION : us-east-2
346+ - name : Upload monitoring data
347+ if : always()
348+ uses : actions/upload-artifact@v4
349+ with :
350+ name : ${{ matrix.task }}-${{ matrix.runner }}-monitoring
351+ path : |
352+ ~/.tmpnet/networks
353+ ~/.tmpnet/prometheus/prometheus.log
354+ ~/.tmpnet/promtail/promtail.log
355+ if-no-files-found : warn
356+ - name : Upload benchmark results
357+ if : always()
358+ uses : actions/upload-artifact@v4
359+ with :
360+ name : ${{ matrix.task }}-${{ matrix.runner }}-results
361+ path : |
362+ ${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}/benchmark-output.txt
363+ ${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}
364+ if-no-files-found : warn
365+ - name : Compare Benchmark Results
366+ if : always()
367+ uses : benchmark-action/github-action-benchmark@v1
368+ with :
369+ tool : ' go'
370+ output-file-path : ${{ steps.exec-dir.outputs.EXECUTION_DATA_DIR }}/benchmark-output.txt
371+ summary-always : true
372+ github-token : ${{ secrets.GITHUB_TOKEN }}
373+ auto-push : ${{ github.event_name == 'schedule' }}
0 commit comments