]>
Commit | Line | Data |
---|---|---|
2abaa3f2 C |
1 | name: "Stats" |
2 | ||
3 | on: | |
4 | push: | |
5 | branches: | |
6 | - develop | |
7 | - ci | |
8 | pull_request: | |
9 | types: [synchronize, opened] | |
10 | ||
11 | jobs: | |
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 |