]>
Commit | Line | Data |
---|---|---|
2abaa3f2 C |
1 | name: Benchmark |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
6 | - ci | |
7 | schedule: | |
9514bb3b | 8 | - cron: '0 */12 * * *' |
2abaa3f2 C |
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 | |
2abaa3f2 C |
32 | |
33 | steps: | |
388a31d2 | 34 | - uses: actions/checkout@v3 |
2abaa3f2 | 35 | |
51e9e152 | 36 | - uses: './.github/actions/reusable-prepare-peertube-build' |
2abaa3f2 | 37 | with: |
823cc35b | 38 | node-version: '14.x' |
2abaa3f2 | 39 | |
51e9e152 | 40 | - uses: './.github/actions/reusable-prepare-peertube-run' |
2abaa3f2 C |
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 | ||
82c21206 C |
56 | - name: Startup |
57 | run: | | |
1622e095 | 58 | npm run clean:server:test |
82c21206 | 59 | |
0c5639f4 | 60 | startCold=`date +%s%3N` |
82c21206 | 61 | NODE_APP_INSTANCE=1 NODE_ENV=test node dist/server --benchmark-startup |
0c5639f4 C |
62 | endCold=`date +%s%3N` |
63 | coldStartupTime=$(echo "scale=2; ($endCold-$startCold)/1000" | bc) | |
82c21206 | 64 | |
0c5639f4 | 65 | startHot=`date +%s%3N` |
82c21206 | 66 | NODE_APP_INSTANCE=1 NODE_ENV=test node dist/server --benchmark-startup |
0c5639f4 C |
67 | endHot=`date +%s%3N` |
68 | hotStartupTime=$(echo "scale=2; ($endHot-$startHot)/1000" | bc) | |
82c21206 C |
69 | |
70 | echo '{"coldStartupTime":'$coldStartupTime',"hotStartupTime":'$hotStartupTime'}'> startup-time.json | |
71 | ||
2abaa3f2 C |
72 | - name: Run benchmark |
73 | run: | | |
10874276 | 74 | node dist/scripts/benchmark.js -o benchmark.json |
2abaa3f2 C |
75 | |
76 | - name: Display result | |
77 | run: | | |
82c21206 | 78 | cat benchmark.json build-time.json startup-time.json |
2abaa3f2 C |
79 | |
80 | - name: Upload benchmark result | |
39036647 | 81 | uses: './.github/actions/reusable-deploy' |
51e9e152 C |
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 }} |