]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - .github/workflows/benchmark.yml
Add next branch to CI
[github/Chocobozzz/PeerTube.git] / .github / workflows / benchmark.yml
CommitLineData
2abaa3f2
C
1name: Benchmark
2
3on:
4 push:
5 branches:
6 - ci
7 schedule:
9514bb3b 8 - cron: '0 */12 * * *'
2abaa3f2
C
9
10jobs:
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 NODE_PENDING_JOB_WAIT: 500
33
34 steps:
35 - uses: actions/checkout@v2
36
37 - name: Use Node.js
38 uses: actions/setup-node@v1
39 with:
40 node-version: '12.x'
41
42 - name: Setup system dependencies
43 run: |
44 sudo apt-get install postgresql-client-common redis-tools parallel
45 wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
46 tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
47 mkdir -p $HOME/bin
48 cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
49 echo "$HOME/bin" >> $GITHUB_PATH
50
51 - name: Cache Node.js modules
52 uses: actions/cache@v2
53 with:
54 path: |
55 **/node_modules
56 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
57 restore-keys: |
58 ${{ runner.OS }}-node-
59 ${{ runner.OS }}-
60
61 - name: Cache fixtures
62 uses: actions/cache@v2
63 with:
64 path: |
65 fixtures
66 key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
67 restore-keys: |
68 ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
69 ${{ runner.OS }}-fixtures-
70 ${{ runner.OS }}-
71
72 - name: Install dependencies
73 run: yarn install --frozen-lockfile
74
75 - name: Build
76 run: |
77 startClient=`date +%s`
78 npm run build:client
79 endClient=`date +%s`
80 clientBuildTime=$((endClient-startClient))
81
82 startServer=`date +%s`
83 npm run build:server
84 endServer=`date +%s`
85 serverBuildTime=$((endServer-startServer))
86
87 echo '{"clientBuildTime":'$clientBuildTime',"serverBuildTime":'$serverBuildTime'}'> build-time.json
88
89 - name: Run benchmark
90 run: |
91 node dist/scripts/benchmark.js benchmark.json
92
93 - name: Display result
94 run: |
95 cat benchmark.json build-time.json
96
97 - name: Upload benchmark result
98 env:
99 STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
100 STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
101 STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }}
102 STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
103 run: |
104 mkdir -p ~/.ssh
105 chmod 700 ~/.ssh
106 if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then
107 echo "Adding ssh key to known hosts"
108 echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts;
109 fi
110
111 eval `ssh-agent -s`
112
113 if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
114 echo "Adding ssh reployement key"
115 ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}");
116 fi
117
118 if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
119 echo "Uploading files"
120 scp benchmark.json build-time.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats;
121 fi