]>
Commit | Line | Data |
---|---|---|
1 | name: Benchmark | |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
6 | - ci | |
7 | schedule: | |
8 | - cron: '0 */12 * * *' | |
9 | ||
10 | jobs: | |
11 | ||
12 | test: | |
13 | runs-on: ubuntu-latest | |
14 | ||
15 | services: | |
16 | redis: | |
17 | image: redis | |
18 | ports: | |
19 | - 6379:6379 | |
20 | ||
21 | postgres: | |
22 | image: postgres:9.6 | |
23 | ports: | |
24 | - 5432:5432 | |
25 | env: | |
26 | POSTGRES_USER: peertube | |
27 | POSTGRES_HOST_AUTH_METHOD: trust | |
28 | ||
29 | env: | |
30 | PGUSER: peertube | |
31 | PGHOST: localhost | |
32 | ||
33 | steps: | |
34 | - uses: actions/checkout@v3 | |
35 | ||
36 | - uses: './.github/actions/reusable-prepare-peertube-build' | |
37 | with: | |
38 | node-version: '14.x' | |
39 | ||
40 | - uses: './.github/actions/reusable-prepare-peertube-run' | |
41 | ||
42 | - name: Build | |
43 | run: | | |
44 | startClient=`date +%s` | |
45 | npm run build:client | |
46 | endClient=`date +%s` | |
47 | clientBuildTime=$((endClient-startClient)) | |
48 | ||
49 | startServer=`date +%s` | |
50 | npm run build:server | |
51 | endServer=`date +%s` | |
52 | serverBuildTime=$((endServer-startServer)) | |
53 | ||
54 | echo '{"clientBuildTime":'$clientBuildTime',"serverBuildTime":'$serverBuildTime'}'> build-time.json | |
55 | ||
56 | - name: Startup | |
57 | run: | | |
58 | npm run clean:server:test | |
59 | ||
60 | startCold=`date +%s%3N` | |
61 | NODE_APP_INSTANCE=1 NODE_ENV=test node dist/server --benchmark-startup | |
62 | endCold=`date +%s%3N` | |
63 | coldStartupTime=$(echo "scale=2; ($endCold-$startCold)/1000" | bc) | |
64 | ||
65 | startHot=`date +%s%3N` | |
66 | NODE_APP_INSTANCE=1 NODE_ENV=test node dist/server --benchmark-startup | |
67 | endHot=`date +%s%3N` | |
68 | hotStartupTime=$(echo "scale=2; ($endHot-$startHot)/1000" | bc) | |
69 | ||
70 | echo '{"coldStartupTime":'$coldStartupTime',"hotStartupTime":'$hotStartupTime'}'> startup-time.json | |
71 | ||
72 | - name: Run benchmark | |
73 | run: | | |
74 | node dist/scripts/benchmark.js -o benchmark.json | |
75 | ||
76 | - name: Display result | |
77 | run: | | |
78 | cat benchmark.json build-time.json startup-time.json | |
79 | ||
80 | - name: Upload benchmark result | |
81 | uses: './.github/actions/reusable-deploy' | |
82 | with: | |
83 | source: benchmark.json build-time.json startup-time.json | |
84 | destination: peertube-stats | |
85 | knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} | |
86 | deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }} | |
87 | deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }} | |
88 | deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }} |