forked from directus/directus
-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (71 loc) · 2 KB
/
e2e-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: End-to-End Tests
on:
workflow_dispatch:
workflow_call:
inputs:
should_skip:
required: false
type: string
jobs:
test:
name: Test
if: inputs.should_skip != 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
db:
- mssql
- mysql
- postgres
- maria
- postgres10
# - sqlite3
node-version:
# - 12-alpine
# - 14-alpine
- 16-alpine
env:
CACHED_IMAGE: ghcr.io/directus/directus-e2e-test-cache:${{ matrix.node-version }}
steps:
- name: Login to GitHub container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull cached test image
run: |
docker pull $CACHED_IMAGE || true
docker tag $CACHED_IMAGE directus-test-image || true
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: npm
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
env:
TEST_NODE_VERSION: ${{ matrix.node-version }}
TEST_DB: ${{ matrix.db }}
run: npm run test:e2e
- name: Push updated test image
# Only push the new cache image on the main branch once per node version
if: github.ref == 'refs/heads/main' && github.repository == 'directus/directus' && matrix.db == 'postgres'
run: |
docker tag directus-test-image $CACHED_IMAGE
docker push $CACHED_IMAGE || true
result:
name: Result
if: inputs.should_skip != 'true' && always()
runs-on: ubuntu-latest
needs: test
steps:
- name: Mark result as failed
if: needs.test.result != 'success'
run: exit 1