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