-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from utopia-php/feat-isolation-mode
Feat isolation mode
- Loading branch information
Showing
54 changed files
with
1,589 additions
and
726 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,100 @@ | ||
name: "Tests" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
IMAGE: databases-dev | ||
CACHE_KEY: databases-dev-${{ github.event.pull_request.head.sha }} | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
tests: | ||
name: Unit & E2E | ||
setup: | ||
name: Setup & Build Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: false | ||
tags: ${{ env.IMAGE }} | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
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 | ||
|
||
unit_test: | ||
name: Unit Test | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
submodules: recursive | ||
|
||
- run: git checkout HEAD^2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: false | ||
tags: database-dev | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Start Databases | ||
run: | | ||
docker compose up -d | ||
sleep 10 | ||
- name: Run Tests | ||
run: docker compose exec -T tests vendor/bin/phpunit --configuration phpunit.xml | ||
|
||
- name: Check Coverage | ||
run: docker compose exec -T tests vendor/bin/coverage-check tmp/clover.xml 90 | ||
- 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: Load and Start Services | ||
run: | | ||
docker load --input /tmp/${{ env.IMAGE }}.tar | ||
docker compose up -d | ||
sleep 10 | ||
- name: Run Unit Tests | ||
run: docker compose exec tests vendor/bin/phpunit /usr/src/code/tests/unit | ||
|
||
adapter_test: | ||
name: Adapter Tests | ||
runs-on: ubuntu-latest | ||
needs: setup | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
adapter: | ||
[ | ||
MariaDB, | ||
MySQL, | ||
Postgres, | ||
SQLite, | ||
MongoDB, | ||
] | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Load Cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ env.CACHE_KEY }} | ||
path: /tmp/${{ env.IMAGE }}.tar | ||
fail-on-cache-miss: true | ||
|
||
- name: Load and Start Services | ||
run: | | ||
docker load --input /tmp/${{ env.IMAGE }}.tar | ||
docker compose up -d | ||
sleep 10 | ||
- name: Run ${{matrix.service}} Tests | ||
run: docker compose exec -T tests vendor/bin/phpunit /usr/src/code/tests/e2e/Adapter/${{matrix.adapter}}Test.php --debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.