diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 81f80c4e9..8e9e2bda6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,8 +6,8 @@ on: - '**' jobs: - tests: - name: Tests + mysql: + name: MySQL runs-on: ubuntu-latest strategy: fail-fast: false @@ -23,6 +23,22 @@ jobs: ports: - 3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + env: + APP_ENV: testing + APP_DEBUG: "false" + APP_KEY: ThisIsARandomStringForTests12345 + APP_TIMEZONE: UTC + APP_URL: http://localhost/ + APP_ENVIRONMENT_ONLY: "true" + CACHE_DRIVER: array + MAIL_MAILER: array + SESSION_DRIVER: array + QUEUE_CONNECTION: sync + HASHIDS_SALT: alittlebitofsalt1234 + DB_CONNECTION: mysql + DB_HOST: 127.0.0.1 + DB_DATABASE: testing + DB_USERNAME: root steps: - name: Code Checkout uses: actions/checkout@v4 @@ -48,15 +64,9 @@ jobs: tools: composer:v2 coverage: none - - name: Setup .env - run: cp .env.example .env - - name: Install dependencies run: composer install --no-interaction --no-suggest --prefer-dist - - name: Generate App Key - run: php artisan key:generate - - name: Unit tests run: vendor/bin/phpunit tests/Unit if: ${{ always() }} @@ -69,3 +79,65 @@ jobs: env: DB_PORT: ${{ job.services.database.ports[3306] }} DB_USERNAME: root + + sqlite: + name: SQLite + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [8.2, 8.3] + env: + APP_ENV: testing + APP_DEBUG: "false" + APP_KEY: ThisIsARandomStringForTests12345 + APP_TIMEZONE: UTC + APP_URL: http://localhost/ + APP_ENVIRONMENT_ONLY: "true" + CACHE_DRIVER: array + MAIL_MAILER: array + SESSION_DRIVER: array + QUEUE_CONNECTION: sync + HASHIDS_SALT: alittlebitofsalt1234 + DB_CONNECTION: sqlite + DB_DATABASE: ${{ github.workspace }}/database/testing.sqlite + steps: + - name: Code Checkout + uses: actions/checkout@v4 + + - name: Get cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer-${{ matrix.php }}- + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: bcmath, cli, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --no-suggest --prefer-dist + + - name: Create SQLite file + run: touch database/testing.sqlite + + - name: Unit tests + run: vendor/bin/phpunit tests/Unit + if: ${{ always() }} + env: + DB_HOST: UNIT_NO_DB + SKIP_MIGRATIONS: true + + - name: Integration tests + run: vendor/bin/phpunit tests/Integration