]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - .github/workflows/test.yml
Add fixtures cache 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
a613eea4 8 pull_request:
fc3b14e4 9 types: [synchronize, opened]
a613eea4 10 schedule:
f9e1ca70 11 - cron: '0 3 * * 1-5'
b9fe9a7f
C
12
13jobs:
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
12e8547f
C
32 ldap:
33 image: rroemhild/test-openldap
34 ports:
35 - 389:389
36
b9fe9a7f 37 strategy:
b488ba1e 38 fail-fast: false
b9fe9a7f 39 matrix:
12e8547f 40 test_suite: [ misc, api-1, api-2, api-3, api-4, cli, lint, external-plugins ]
b9fe9a7f
C
41
42 env:
43 PGUSER: peertube
44 PGHOST: localhost
b488ba1e 45 NODE_PENDING_JOB_WAIT: 2000
b9fe9a7f
C
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: |
7abb5c5d 57 sudo apt-get install postgresql-client-common redis-tools parallel
b9fe9a7f
C
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:
b488ba1e
C
67 path: |
68 **/node_modules
b9fe9a7f
C
69 key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
70 restore-keys: |
71 ${{ runner.OS }}-node-
72 ${{ runner.OS }}-
73
07491f4b
C
74 - name: Cache fixtures
75 uses: actions/cache@v2
76 with:
77 path: |
78 fixtures
79 key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
80 restore-keys: |
81 ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
82 ${{ runner.OS }}-fixtures-
83 ${{ runner.OS }}-
84
b9fe9a7f
C
85 - name: Install dependencies
86 run: yarn install --frozen-lockfile
87
f9d2deae 88 - name: Set env test variable (schedule)
a613eea4 89 if: github.event_name != 'schedule'
f9d2deae
C
90 run: |
91 echo "::set-env name=DISABLE_HTTP_IMPORT_TESTS::true"
a613eea4 92
b9fe9a7f 93 - name: Run Test
f9e1ca70
C
94 # external-plugins tests only run on schedule
95 if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
b9fe9a7f
C
96 run: NODE_PENDING_JOB_WAIT=2000 npm run ci -- ${{ matrix.test_suite }}
97
98 - name: Upload logs
99 uses: actions/upload-artifact@v2
100 if: failure()
101 with:
b488ba1e 102 name: test-storages-${{ matrix.test_suite }}
b9fe9a7f 103 path: test*/logs