mirror of
https://github.com/directus/directus.git
synced 2026-01-29 22:57:55 -05:00
81 lines
2.0 KiB
YAML
81 lines
2.0 KiB
YAML
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
|
|
# - 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
|