]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - .github/workflows/test.yml
Merge branch 'master' into release/3.3.0
[github/Chocobozzz/PeerTube.git] / .github / workflows / test.yml
1 name: Test Suite
2
3 on:
4 push:
5 branches:
6 - develop
7 - master
8 - ci
9 - next
10 pull_request:
11 types: [synchronize, opened]
12 schedule:
13 - cron: '0 3 * * 1-5'
14
15 jobs:
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
34 ldap:
35 image: chocobozzz/docker-test-openldap
36 ports:
37 - 10389:10389
38
39 strategy:
40 fail-fast: false
41 matrix:
42 test_suite: [ client, api-1, api-2, api-3, api-4, cli-plugin, lint, external-plugins ]
43
44 env:
45 PGUSER: peertube
46 PGHOST: localhost
47 NODE_PENDING_JOB_WAIT: 250
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: |
59 sudo apt-get install postgresql-client-common redis-tools parallel
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
62 mkdir -p $HOME/bin
63 cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
64 echo "$HOME/bin" >> $GITHUB_PATH
65
66 - name: Cache Node.js modules
67 uses: actions/cache@v2
68 with:
69 path: |
70 **/node_modules
71 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
72 restore-keys: |
73 ${{ runner.OS }}-node-
74 ${{ runner.OS }}-
75
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
87 - name: Install dependencies
88 run: yarn install --frozen-lockfile
89
90 - name: Set env test variable (schedule)
91 if: github.event_name != 'schedule'
92 run: |
93 echo "DISABLE_HTTP_IMPORT_TESTS=true" >> $GITHUB_ENV
94
95 - name: Run Test
96 # external-plugins tests only run on schedule
97 if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
98 run: npm run ci -- ${{ matrix.test_suite }}
99
100 - name: Display errors
101 if: ${{ always() }}
102 run: |
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 ) || \
108 echo "parse-log.js script does not exist, skipping."
109
110 - name: Upload logs
111 uses: actions/upload-artifact@v2
112 if: failure()
113 with:
114 name: test-storages-${{ matrix.test_suite }}
115 path: artifacts
116 retention-days: 7