Skip to content

Add Appwrite Tests and Matrix the workflow #123

Add Appwrite Tests and Matrix the workflow

Add Appwrite Tests and Matrix the workflow #123

Workflow file for this run

name: Tests
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE: migrations-dev
CACHE_KEY: migrations-dev-${{ github.sha }}
on:
pull_request:
push: { branches: [main] }
jobs:
setup:
name: Setup & Build Migrations Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Debug Cache
run: |
if [ -f /tmp/${{ env.IMAGE }}.tar ]; then
echo "Cache hit"
else
echo "Cache miss"
fi
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ env.CACHE_KEY }}-docker
restore-keys: |
${{ env.CACHE_KEY }}-docker
- name: Build Migrations
uses: docker/build-push-action@v3
with:
context: .
push: false
tags: ${{ env.IMAGE }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar
- name: Cache Docker Image
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
source_e2e_tests:
name: Run Source E2E Tests
runs-on: ubuntu-latest
needs: setup
env:
COMPOSE_FILE: docker-compose.yml
strategy:
fail-fast: false
matrix:
adapter: [Appwrite, Supabase, NHost]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Load Cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: /tmp/${{ env.IMAGE }}.tar
fail-on-cache-miss: true
- name: Bring up services
run: docker-compose up -d
- name: Run ${{matrix.adapter}} Tests
run: |
docker compose exec tests php ./vendor/bin/phpunit /app/tests/Migration/E2E/Sources/${{matrix.adapter}}Test.php