]>
Commit | Line | Data |
---|---|---|
2abaa3f2 C |
1 | name: "Stats" |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
6 | - develop | |
7 | - ci | |
3fbc6974 | 8 | - next |
2abaa3f2 C |
9 | pull_request: |
10 | types: [synchronize, opened] | |
11 | ||
12 | jobs: | |
13 | ||
14 | stats: | |
15 | runs-on: ubuntu-latest | |
16 | ||
17 | env: | |
18 | CI_BRANCH_BASE: develop | |
19 | ||
20 | steps: | |
21 | - uses: actions/checkout@v2 | |
22 | ||
23 | - name: Use Node.js | |
24 | uses: actions/setup-node@v1 | |
25 | with: | |
26 | node-version: '12.x' | |
27 | ||
28 | - name: Cache Node.js modules | |
29 | uses: actions/cache@v2 | |
30 | with: | |
31 | path: | | |
32 | **/node_modules | |
33 | key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | |
34 | restore-keys: | | |
35 | ${{ runner.OS }}-node- | |
36 | ${{ runner.OS }}- | |
37 | ||
38 | - name: Install dependencies | |
39 | run: yarn install --frozen-lockfile | |
40 | ||
41 | - name: Angular bundlewatch | |
42 | uses: jackyef/bundlewatch-gh-action@master | |
43 | with: | |
44 | build-script: npm run build -- --analyze-bundle | |
45 | branch-base: develop | |
46 | bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }} | |
47 | ||
48 | - name: PeerTube client stats | |
49 | if: github.event_name != 'pull_request' | |
50 | run: | | |
51 | node dist/scripts/client-build-stats.js > client-build-stats.json | |
52 | ||
53 | - name: PeerTube code stats | |
54 | if: github.event_name != 'pull_request' | |
55 | run: | | |
56 | wget "https://github.com/boyter/scc/releases/download/v3.0.0/scc-3.0.0-x86_64-unknown-linux.zip" | |
57 | unzip "scc-3.0.0-x86_64-unknown-linux.zip" | |
58 | ./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 | |
59 | ||
60 | - name: Display stats | |
61 | if: github.event_name != 'pull_request' | |
62 | run: | | |
63 | cat client-build-stats.json | |
64 | cat scc.json | |
65 | ||
66 | - name: Upload stats | |
67 | if: github.event_name != 'pull_request' | |
68 | env: | |
69 | STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} | |
70 | STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }} | |
71 | STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }} | |
72 | STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }} | |
73 | run: | | |
74 | mkdir -p ~/.ssh | |
75 | chmod 700 ~/.ssh | |
76 | if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then | |
77 | echo "Adding ssh key to known hosts" | |
78 | echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts; | |
79 | fi | |
80 | ||
81 | eval `ssh-agent -s` | |
82 | ||
83 | if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then | |
84 | echo "Adding ssh reployement key" | |
85 | ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}"); | |
86 | fi | |
87 | ||
88 | if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then | |
89 | echo "Uploading files" | |
90 | scp client-build-stats.json scc.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats; | |
91 | fi |