-
Notifications
You must be signed in to change notification settings - Fork 119
46 lines (42 loc) · 2.15 KB
/
cron-test.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
name: Upload test
on:
push:
paths:
- '.github/workflows/cron-test.yml'
schedule:
- cron: '*/10 * * * *'
workflow_dispatch:
jobs:
upload-test:
name: Upload test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- uses: bahmutov/npm-install@v1
- run: npm install -g @web3-storage/w3
- name: Add small file via w3
run: |
echo "$(date --utc --iso-8601=seconds) web3.storage upload test" > ./upload-test-small
w3 put ./upload-test-small --token ${{ secrets.WEB3_TOKEN }}
# test adding a file larger than LOCAL_ADD_THRESHOLD see: packages/api/src/constants.js
# Create a random file. upload it via w3 and time the duration in seconds
# `usr/bin/time -f "%e" -o ./duration_secs` writes the wall-clock runtime in seconds of the command to the file ./duration_secs
# the rest is wrapping it up as a metric in the prometheus format and sending it off to the push gateway
# see: https://github.com/prometheus/pushgateway/blob/master/README.md
- name: Add 3MiB file via w3 and push duration to prometheus push gateway
run: |
dd if=/dev/urandom of=./upload-test-3mib bs=1024 count=3072
/usr/bin/time -f "%e" -o ./duration_secs w3 put ./upload-test-3mib --token ${{ secrets.WEB3_TOKEN }}
cat ./duration_secs
echo "# HELP web3storage_upload_duration_seconds How long it took to upload a file via w3" > ./metric
echo "# TYPE web3storage_upload_duration_seconds gauge" >> ./metric
echo "web3storage_upload_duration_seconds{endpoint=\"/car\",size=\"3MiB\",cmd=\"w3\"} $(cat ./duration_secs)" >> ./metric
cat ./metric
curl --silent --show-error --data-binary "@./metric" --basic --user "${{ secrets.PUSHGATEWAY_BASIC_AUTH }}" https://pushgateway.k8s.locotorp.info/metrics/job/web3storage_ci/instance/github_action
- name: Heartbeat
if: ${{ success() }}
run: ./packages/tools/scripts/cli.js heartbeat --token ${{ secrets.OPSGENIE_KEY }} --name cron-web3storage-upload-test