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