13 runs-on: ubuntu-latest
26 POSTGRES_USER: peertube
27 POSTGRES_HOST_AUTH_METHOD: trust
32 NODE_PENDING_JOB_WAIT: 500
35 - uses: actions/checkout@v2
38 uses: actions/setup-node@v1
42 - name: Setup system dependencies
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
48 cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
49 echo "$HOME/bin" >> $GITHUB_PATH
51 - name: Cache Node.js modules
52 uses: actions/cache@v2
56 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
58 ${{ runner.OS }}-node-
61 - name: Cache fixtures
62 uses: actions/cache@v2
66 key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
68 ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
69 ${{ runner.OS }}-fixtures-
72 - name: Install dependencies
73 run: yarn install --frozen-lockfile
77 startClient=`date +%s`
80 clientBuildTime=$((endClient-startClient))
82 startServer=`date +%s`
85 serverBuildTime=$((endServer-startServer))
87 echo '{"clientBuildTime":'$clientBuildTime',"serverBuildTime":'$serverBuildTime'}'> build-time.json
91 npm run clean:server:test
93 startCold=`date +%s%3N`
94 NODE_APP_INSTANCE=1 NODE_ENV=test node dist/server --benchmark-startup
96 coldStartupTime=$(echo "scale=2; ($endCold-$startCold)/1000" | bc)
98 startHot=`date +%s%3N`
99 NODE_APP_INSTANCE=1 NODE_ENV=test node dist/server --benchmark-startup
101 hotStartupTime=$(echo "scale=2; ($endHot-$startHot)/1000" | bc)
103 echo '{"coldStartupTime":'$coldStartupTime',"hotStartupTime":'$hotStartupTime'}'> startup-time.json
105 - name: Run benchmark
107 node dist/scripts/benchmark.js benchmark.json
109 - name: Display result
111 cat benchmark.json build-time.json startup-time.json
113 - name: Upload benchmark result
115 STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
116 STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
117 STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }}
118 STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
122 if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then
123 echo "Adding ssh key to known hosts"
124 echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts;
129 if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
130 echo "Adding ssh reployement key"
131 ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}");
134 if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
135 echo "Uploading files"
136 scp benchmark.json build-time.json startup-time.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats;