]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - .github/workflows/test.yml
Limit github actions on PR
[github/Chocobozzz/PeerTube.git] / .github / workflows / test.yml
1 name: Test Suite
2
3 on:
4 push:
5 branches:
6 - develop
7 - master
8 pull_request:
9 types: [synchronize, opened]
10 schedule:
11 - cron: '0 3 * * 1-5'
12
13 jobs:
14
15 test:
16 runs-on: ubuntu-latest
17
18 services:
19 redis:
20 image: redis
21 ports:
22 - 6379:6379
23
24 postgres:
25 image: postgres:9.6
26 ports:
27 - 5432:5432
28 env:
29 POSTGRES_USER: peertube
30 POSTGRES_HOST_AUTH_METHOD: trust
31
32 ldap:
33 image: rroemhild/test-openldap
34 ports:
35 - 389:389
36
37 strategy:
38 fail-fast: false
39 matrix:
40 test_suite: [ misc, api-1, api-2, api-3, api-4, cli, lint, external-plugins ]
41
42 env:
43 PGUSER: peertube
44 PGHOST: localhost
45 NODE_PENDING_JOB_WAIT: 2000
46
47 steps:
48 - uses: actions/checkout@v2
49
50 - name: Use Node.js
51 uses: actions/setup-node@v1
52 with:
53 node-version: '12.x'
54
55 - name: Setup system dependencies
56 run: |
57 sudo apt-get install postgresql-client-common redis-tools parallel
58 wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.3-64bit-static.tar.xz"
59 tar xf ffmpeg-release-4.0.3-64bit-static.tar.xz
60 mkdir -p $HOME/bin
61 cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
62 echo "::add-path::$HOME/bin"
63
64 - name: Cache Node.js modules
65 uses: actions/cache@v2
66 with:
67 path: |
68 **/node_modules
69 ~/fixtures
70 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
71 restore-keys: |
72 ${{ runner.OS }}-node-
73 ${{ runner.OS }}-
74
75 - name: Install dependencies
76 run: yarn install --frozen-lockfile
77
78 - name: Set env test variable (schedule)
79 if: github.event_name != 'schedule'
80 run: |
81 echo "::set-env name=DISABLE_HTTP_IMPORT_TESTS::true"
82
83 - name: Run Test
84 # external-plugins tests only run on schedule
85 if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
86 run: NODE_PENDING_JOB_WAIT=2000 npm run ci -- ${{ matrix.test_suite }}
87
88 - name: Upload logs
89 uses: actions/upload-artifact@v2
90 if: failure()
91 with:
92 name: test-storages-${{ matrix.test_suite }}
93 path: test*/logs