2021-10-23 04:26:17 +13:00
|
|
|
name: "Tests"
|
2022-02-10 08:29:26 +13:00
|
|
|
|
2023-02-22 11:58:26 +13:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-09-09 07:03:55 +12:00
|
|
|
env:
|
2023-09-09 10:11:40 +12:00
|
|
|
IMAGE: appwrite-dev
|
2023-09-09 07:03:55 +12:00
|
|
|
|
2021-10-23 04:26:17 +13:00
|
|
|
on: [pull_request]
|
2023-09-09 08:07:13 +12:00
|
|
|
|
2021-10-23 04:26:17 +13:00
|
|
|
jobs:
|
2023-09-09 07:03:55 +12:00
|
|
|
setup:
|
|
|
|
name: Setup & Build Appwrite Image
|
2022-09-05 08:05:30 +12:00
|
|
|
runs-on: ubuntu-latest
|
2021-10-23 04:26:17 +13:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-10-08 20:02:58 +13:00
|
|
|
uses: actions/checkout@v3
|
2021-10-23 04:26:17 +13:00
|
|
|
with:
|
|
|
|
# We must fetch at least the immediate parents so that if this is
|
|
|
|
# a pull request then we can checkout the head.
|
|
|
|
fetch-depth: 2
|
2022-11-16 12:37:13 +13:00
|
|
|
# Fetch submodules
|
|
|
|
submodules: recursive
|
2021-10-23 04:26:17 +13:00
|
|
|
|
|
|
|
# If this run was triggered by a pull request event, then checkout
|
|
|
|
# the head of the pull request instead of the merge commit.
|
|
|
|
- run: git checkout HEAD^2
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
2023-09-09 07:06:10 +12:00
|
|
|
# This is a separate action that sets up buildx runner
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
2023-09-09 07:11:00 +12:00
|
|
|
|
2022-02-10 08:29:26 +13:00
|
|
|
- name: Build Appwrite
|
2023-02-16 08:27:26 +13:00
|
|
|
uses: docker/build-push-action@v3
|
2023-02-14 08:15:09 +13:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: false
|
2023-09-09 10:39:11 +12:00
|
|
|
tags: ${{ env.IMAGE }}
|
2023-02-14 10:26:26 +13:00
|
|
|
load: true
|
2023-02-14 08:15:09 +13:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2023-09-09 11:12:11 +12:00
|
|
|
# outputs: type=docker,dest=/tmp/${{ env.IMAGE }}.tar
|
2023-02-14 08:15:09 +13:00
|
|
|
build-args: |
|
|
|
|
DEBUG=false
|
|
|
|
TESTING=true
|
|
|
|
VERSION=dev
|
2023-09-09 11:44:19 +12:00
|
|
|
|
|
|
|
- name: Pull Docker Images
|
|
|
|
run: docker compose pull --ignore-pull-failures --ignore-buildable
|
2023-09-09 10:53:50 +12:00
|
|
|
|
2023-09-09 11:44:19 +12:00
|
|
|
- name: List Files and images
|
2023-09-09 11:12:11 +12:00
|
|
|
run: |
|
2023-09-09 11:54:27 +12:00
|
|
|
docker compose config --images | sort -u
|
2023-09-09 12:00:06 +12:00
|
|
|
docker save $(docker compose config --images | sort -u) -o /tmp/allinone.tar
|
2023-09-09 11:12:11 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
- name: Cache Docker Image
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: ${{ env.IMAGE }}-${{ github.sha }}
|
|
|
|
path: /tmp/allinone.tar
|
2023-09-09 10:53:50 +12:00
|
|
|
|
|
|
|
# - name: Upload Docker Image
|
|
|
|
# uses: actions/upload-artifact@v3
|
|
|
|
# with:
|
|
|
|
# name: ${{ env.IMAGE }}
|
|
|
|
# path: /tmp/${{ env.IMAGE }}.tar
|
2023-09-09 06:49:02 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
unit_test:
|
|
|
|
name: Unit Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: setup
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
submodules: recursive
|
2023-09-09 10:53:50 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
- name: Load Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: ${{ env.IMAGE }}-${{ github.sha }}
|
|
|
|
path: /tmp/allinone.tar
|
|
|
|
fail-on-cache-miss: true
|
2023-09-09 10:53:50 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
- name: Load and Start Appwrite
|
|
|
|
run: |
|
|
|
|
docker load --input /tmp/allinone.tar
|
|
|
|
docker compose up -d
|
|
|
|
sleep 10
|
2023-09-09 11:12:11 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
- name: Doctor
|
|
|
|
run: docker compose exec -T appwrite doctor
|
2023-09-09 11:12:11 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
- name: Environment Variables
|
|
|
|
run: docker compose exec -T appwrite vars
|
2023-09-09 11:12:11 +12:00
|
|
|
|
2023-09-09 12:00:06 +12:00
|
|
|
- name: Run Unit Tests
|
|
|
|
run: docker compose exec appwrite test /usr/src/code/tests/unit
|
2023-09-09 11:12:11 +12:00
|
|
|
|
2023-09-09 12:11:14 +12:00
|
|
|
e2e_test:
|
|
|
|
name: E2E Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: setup
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
services: [Account,Avatars,Console,Databases,Functions,GraphQL,Health,Locale,Projects,Realtime,Storage,Teams,Users,Webhooks]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 2
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Load Cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: ${{ env.IMAGE }}-${{ github.sha }}
|
|
|
|
path: /tmp/allinone.tar
|
|
|
|
fail-on-cache-miss: true
|
|
|
|
|
|
|
|
- name: Load and Start Appwrite
|
|
|
|
run: |
|
|
|
|
docker load --input /tmp/allinone.tar
|
|
|
|
docker compose up -d
|
|
|
|
sleep 20
|
2023-09-09 06:49:02 +12:00
|
|
|
|
2023-09-09 12:11:14 +12:00
|
|
|
- name: Run ${{matrix.services}} Tests
|
|
|
|
run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.services}} --debug
|