]>
Commit | Line | Data |
---|---|---|
1 | name: Test | |
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:10 | |
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 | s3ninja: | |
35 | image: chocobozzz/s3-ninja | |
36 | ports: | |
37 | - 9444:9000 | |
38 | ||
39 | strategy: | |
40 | fail-fast: false | |
41 | matrix: | |
42 | test_suite: [ types-package, client, api-1, api-2, api-3, api-4, api-5, cli-plugin, lint, external-plugins ] | |
43 | ||
44 | env: | |
45 | PGUSER: peertube | |
46 | PGHOST: localhost | |
47 | NODE_PENDING_JOB_WAIT: 250 | |
48 | ENABLE_OBJECT_STORAGE_TESTS: true | |
49 | OBJECT_STORAGE_SCALEWAY_KEY_ID: ${{ secrets.OBJECT_STORAGE_SCALEWAY_KEY_ID }} | |
50 | OBJECT_STORAGE_SCALEWAY_ACCESS_KEY: ${{ secrets.OBJECT_STORAGE_SCALEWAY_ACCESS_KEY }} | |
51 | YOUTUBE_DL_DOWNLOAD_BEARER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
52 | ||
53 | steps: | |
54 | - uses: actions/checkout@v3 | |
55 | ||
56 | - uses: './.github/actions/reusable-prepare-peertube-build' | |
57 | with: | |
58 | node-version: '14.x' | |
59 | ||
60 | - uses: './.github/actions/reusable-prepare-peertube-run' | |
61 | ||
62 | - name: Cache fixtures | |
63 | uses: actions/cache@v3 | |
64 | with: | |
65 | path: | | |
66 | fixtures | |
67 | key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }} | |
68 | restore-keys: | | |
69 | ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}- | |
70 | ${{ runner.OS }}-fixtures- | |
71 | ${{ runner.OS }}- | |
72 | ||
73 | - name: Set env test variable (schedule) | |
74 | if: github.event_name != 'schedule' | |
75 | run: | | |
76 | echo "DISABLE_HTTP_IMPORT_TESTS=true" >> $GITHUB_ENV | |
77 | ||
78 | - name: Run Test | |
79 | # external-plugins tests only run on schedule | |
80 | if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins' | |
81 | env: | |
82 | AKISMET_KEY: ${{ secrets.AKISMET_KEY }} | |
83 | run: npm run ci -- ${{ matrix.test_suite }} | |
84 | ||
85 | - name: Display errors | |
86 | if: ${{ always() }} | |
87 | run: | | |
88 | ( \ | |
89 | test -f dist/scripts/parse-log.js && \ | |
90 | NODE_ENV=test node dist/scripts/parse-log.js -l error -f artifacts/*.log \ | |
91 | ) || \ | |
92 | echo "parse-log.js script does not exist, skipping." | |
93 | ||
94 | - name: Upload logs | |
95 | uses: actions/upload-artifact@v3 | |
96 | if: failure() | |
97 | with: | |
98 | name: test-storages-${{ matrix.test_suite }} | |
99 | path: artifacts | |
100 | retention-days: 7 |