]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - .github/workflows/test.yml
Add stats to github actions
[github/Chocobozzz/PeerTube.git] / .github / workflows / test.yml
CommitLineData
b9fe9a7f
C
1name: Test Suite
2
a613eea4
C
3on:
4 push:
fc3b14e4
C
5 branches:
6 - develop
7 - master
2abaa3f2 8 - ci
a613eea4 9 pull_request:
fc3b14e4 10 types: [synchronize, opened]
a613eea4 11 schedule:
f9e1ca70 12 - cron: '0 3 * * 1-5'
b9fe9a7f
C
13
14jobs:
15
16 test:
17 runs-on: ubuntu-latest
18
19 services:
20 redis:
21 image: redis
22 ports:
23 - 6379:6379
24
25 postgres:
26 image: postgres:9.6
27 ports:
28 - 5432:5432
29 env:
30 POSTGRES_USER: peertube
31 POSTGRES_HOST_AUTH_METHOD: trust
32
12e8547f 33 ldap:
0158eeb0 34 image: chocobozzz/docker-test-openldap
12e8547f 35 ports:
0158eeb0 36 - 10389:10389
12e8547f 37
b9fe9a7f 38 strategy:
b488ba1e 39 fail-fast: false
b9fe9a7f 40 matrix:
12e8547f 41 test_suite: [ misc, api-1, api-2, api-3, api-4, cli, lint, external-plugins ]
b9fe9a7f
C
42
43 env:
44 PGUSER: peertube
45 PGHOST: localhost
fae6e4da 46 NODE_PENDING_JOB_WAIT: 500
b9fe9a7f
C
47
48 steps:
49 - uses: actions/checkout@v2
50
51 - name: Use Node.js
52 uses: actions/setup-node@v1
53 with:
54 node-version: '12.x'
55
56 - name: Setup system dependencies
57 run: |
7abb5c5d 58 sudo apt-get install postgresql-client-common redis-tools parallel
c655c9ef
C
59 wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
60 tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
b9fe9a7f
C
61 mkdir -p $HOME/bin
62 cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
79389bff 63 echo "$HOME/bin" >> $GITHUB_PATH
b9fe9a7f
C
64
65 - name: Cache Node.js modules
66 uses: actions/cache@v2
67 with:
b488ba1e
C
68 path: |
69 **/node_modules
b9fe9a7f
C
70 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
71 restore-keys: |
72 ${{ runner.OS }}-node-
73 ${{ runner.OS }}-
74
07491f4b
C
75 - name: Cache fixtures
76 uses: actions/cache@v2
77 with:
78 path: |
79 fixtures
80 key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
81 restore-keys: |
82 ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
83 ${{ runner.OS }}-fixtures-
84 ${{ runner.OS }}-
85
b9fe9a7f
C
86 - name: Install dependencies
87 run: yarn install --frozen-lockfile
88
f9d2deae 89 - name: Set env test variable (schedule)
a613eea4 90 if: github.event_name != 'schedule'
f9d2deae 91 run: |
79389bff 92 echo "DISABLE_HTTP_IMPORT_TESTS=true" >> $GITHUB_ENV
a613eea4 93
b9fe9a7f 94 - name: Run Test
f9e1ca70
C
95 # external-plugins tests only run on schedule
96 if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
fae6e4da 97 run: npm run ci -- ${{ matrix.test_suite }}
b9fe9a7f 98
12554857 99 - name: Display errors
4f5a90ef 100 if: ${{ always() }}
0484ec9e 101 run: |
5ec8a71f
C
102 ( \
103 test -f dist/scripts/parse-log.js && \
104 cat *-ci.log | uniq -c && \
105 NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log \
106 ) || \
34caef7f 107 echo "parse-log.js script does not exist, skipping."
0484ec9e 108
b9fe9a7f
C
109 - name: Upload logs
110 uses: actions/upload-artifact@v2
111 if: failure()
112 with:
b488ba1e 113 name: test-storages-${{ matrix.test_suite }}
83ef31fe
C
114 path: artifacts
115 retention-days: 7