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