aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-23 09:44:40 +0100
committerChocobozzz <me@florianbigard.com>2021-02-23 11:02:35 +0100
commit2abaa3f27ec9870749a3a6f001922740e26c3830 (patch)
tree36fb2e99802ff9a47ec778187cae1a1867982b46
parent8281cf00c0f31a45f6c66f6b6b31224696e130ab (diff)
downloadPeerTube-2abaa3f27ec9870749a3a6f001922740e26c3830.tar.gz
PeerTube-2abaa3f27ec9870749a3a6f001922740e26c3830.tar.zst
PeerTube-2abaa3f27ec9870749a3a6f001922740e26c3830.zip
Add stats to github actions
-rw-r--r--.github/workflows/benchmark.yml121
-rw-r--r--.github/workflows/bundlewatch.yml45
-rw-r--r--.github/workflows/stats.yml90
-rw-r--r--.github/workflows/test.yml1
4 files changed, 212 insertions, 45 deletions
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
new file mode 100644
index 000000000..50a3d0246
--- /dev/null
+++ b/.github/workflows/benchmark.yml
@@ -0,0 +1,121 @@
1name: Benchmark
2
3on:
4 push:
5 branches:
6 - ci
7 schedule:
8 - cron: '0 4 * * *'
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
diff --git a/.github/workflows/bundlewatch.yml b/.github/workflows/bundlewatch.yml
deleted file mode 100644
index a829368e8..000000000
--- a/.github/workflows/bundlewatch.yml
+++ /dev/null
@@ -1,45 +0,0 @@
1name: "Bundlewatch Github Action"
2
3on:
4 push:
5 branches:
6 - develop
7 pull_request:
8 types: [synchronize, opened]
9
10jobs:
11
12 bundlewatch:
13 runs-on: ubuntu-latest
14
15 env:
16 CI_BRANCH_BASE: develop
17
18 steps:
19 - uses: actions/checkout@v2
20
21 - name: Use Node.js
22 uses: actions/setup-node@v1
23 with:
24 node-version: '12.x'
25
26 - name: Cache Node.js modules
27 uses: actions/cache@v2
28 with:
29 path: |
30 **/node_modules
31 ~/fixtures
32 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
33 restore-keys: |
34 ${{ runner.OS }}-node-
35 ${{ runner.OS }}-
36
37 - name: Install dependencies
38 run: yarn install --frozen-lockfile
39
40 - name: Angular bundlewatch
41 uses: jackyef/bundlewatch-gh-action@master
42 with:
43 build-script: npm run build -- --analyze-bundle
44 branch-base: develop
45 bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml
new file mode 100644
index 000000000..b5fb6d2a6
--- /dev/null
+++ b/.github/workflows/stats.yml
@@ -0,0 +1,90 @@
1name: "Stats"
2
3on:
4 push:
5 branches:
6 - develop
7 - ci
8 pull_request:
9 types: [synchronize, opened]
10
11jobs:
12
13 stats:
14 runs-on: ubuntu-latest
15
16 env:
17 CI_BRANCH_BASE: develop
18
19 steps:
20 - uses: actions/checkout@v2
21
22 - name: Use Node.js
23 uses: actions/setup-node@v1
24 with:
25 node-version: '12.x'
26
27 - name: Cache Node.js modules
28 uses: actions/cache@v2
29 with:
30 path: |
31 **/node_modules
32 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
33 restore-keys: |
34 ${{ runner.OS }}-node-
35 ${{ runner.OS }}-
36
37 - name: Install dependencies
38 run: yarn install --frozen-lockfile
39
40 - name: Angular bundlewatch
41 uses: jackyef/bundlewatch-gh-action@master
42 with:
43 build-script: npm run build -- --analyze-bundle
44 branch-base: develop
45 bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
46
47 - name: PeerTube client stats
48 if: github.event_name != 'pull_request'
49 run: |
50 node dist/scripts/client-build-stats.js > client-build-stats.json
51
52 - name: PeerTube code stats
53 if: github.event_name != 'pull_request'
54 run: |
55 wget "https://github.com/boyter/scc/releases/download/v3.0.0/scc-3.0.0-x86_64-unknown-linux.zip"
56 unzip "scc-3.0.0-x86_64-unknown-linux.zip"
57 ./scc --format=json --exclude-dir .git,node_modules,client/node_modules,client/dist,dist,yarn.lock,client/yarn.lock,client/src/locale,test1,test2,test3,client/src/assets/images,config,storage,server/tests/fixtures,support/openapi,.idea,.vscode,docker-volume,ffmpeg-3,ffmpeg-4 > ./scc.json
58
59 - name: Display stats
60 if: github.event_name != 'pull_request'
61 run: |
62 cat client-build-stats.json
63 cat scc.json
64
65 - name: Upload stats
66 if: github.event_name != 'pull_request'
67 env:
68 STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
69 STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
70 STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }}
71 STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
72 run: |
73 mkdir -p ~/.ssh
74 chmod 700 ~/.ssh
75 if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then
76 echo "Adding ssh key to known hosts"
77 echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts;
78 fi
79
80 eval `ssh-agent -s`
81
82 if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
83 echo "Adding ssh reployement key"
84 ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}");
85 fi
86
87 if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
88 echo "Uploading files"
89 scp client-build-stats.json scc.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats;
90 fi
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index aba652586..f8706d4be 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -5,6 +5,7 @@ on:
5 branches: 5 branches:
6 - develop 6 - develop
7 - master 7 - master
8 - ci
8 pull_request: 9 pull_request:
9 types: [synchronize, opened] 10 types: [synchronize, opened]
10 schedule: 11 schedule: