Tests #3346
This file contains hidden or 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
| 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 || github.sha }} | |
| on: [pull_request, workflow_dispatch] | |
| jobs: | |
| setup: | |
| name: Setup & Build Docker Image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker Image | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| 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 | |
| uses: actions/checkout@v4 | |
| - 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 --wait | |
| - name: Run Unit Tests | |
| run: docker compose exec -e XDEBUG_MODE=off tests vendor/bin/paratest --configuration phpunit.xml --functional --processes 4 /usr/src/code/tests/unit | |
| adapter_test: | |
| name: "Adapter Tests (${{ matrix.adapter }})" | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - adapter: MongoDB | |
| profiles: "--profile mongo" | |
| - adapter: MariaDB | |
| profiles: "--profile mariadb" | |
| - adapter: MySQL | |
| profiles: "--profile mysql" | |
| - adapter: Postgres | |
| profiles: "--profile postgres" | |
| - adapter: SQLite | |
| profiles: "" | |
| - adapter: Mirror | |
| profiles: "--profile mariadb --profile mariadb-mirror --profile redis-mirror" | |
| - adapter: Pool | |
| profiles: "--profile mysql" | |
| - adapter: SharedTables/MongoDB | |
| profiles: "--profile mongo" | |
| - adapter: SharedTables/MariaDB | |
| profiles: "--profile mariadb" | |
| - adapter: SharedTables/MySQL | |
| profiles: "--profile mysql" | |
| - adapter: SharedTables/Postgres | |
| profiles: "--profile postgres" | |
| - adapter: SharedTables/SQLite | |
| profiles: "" | |
| - adapter: Schemaless/MongoDB | |
| profiles: "--profile mongo" | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - 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 ${{ matrix.profiles }} up -d --wait | |
| - name: Run Tests | |
| run: docker compose exec -T -e XDEBUG_MODE=off tests vendor/bin/paratest --configuration phpunit.xml --functional --processes 4 /usr/src/code/tests/e2e/Adapter/${{matrix.adapter}}Test.php |