Passkeys, Blade components, and login improvements #435
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: Authentication Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.2", "8.3", "8.4", "8.5"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mbstring, xml, ctype, iconv, mysql, imagick | |
| - name: Cache Composer Packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.composer/cache | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.php-version }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer-git-${{ matrix.php-version }} | |
| - name: Setup Laravel Application | |
| run: composer create-project --prefer-dist --no-progress laravel/laravel laravel_app_${{ matrix.php-version }} --no-interaction | |
| - name: Install DevDojo Auth from local checkout | |
| run: | | |
| composer config repositories.local-auth '{"type": "path", "url": "../", "options": {"symlink": false}}' | |
| composer require 'devdojo/auth:@dev' --with-all-dependencies --no-progress | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Publish DevDojo Auth Assets and Config | |
| run: | | |
| php artisan vendor:publish --tag=auth:assets | |
| php artisan vendor:publish --tag=auth:config | |
| php artisan vendor:publish --tag=auth:migrations | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Setup test environment | |
| run: | | |
| rm -rf tests | |
| ln -s vendor/devdojo/auth/tests tests | |
| touch database/database_${{ matrix.php-version }}.sqlite | |
| sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env | |
| sed -i 's/^DB_DATABASE=laravel/DB_DATABASE=database\/database_${{ matrix.php-version }}.sqlite/' .env | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Install dependencies and run migrations | |
| run: | | |
| composer require doctrine/dbal --no-progress | |
| php artisan migrate | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Clean up composer.json - Remove PHPUnit | |
| run: | | |
| php -r ' | |
| $json = json_decode(file_get_contents("composer.json"), true); | |
| if (!$json) { echo "Failed to decode composer.json"; exit(1); } | |
| unset($json["require-dev"]["phpunit/phpunit"]); | |
| file_put_contents("composer.json", json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); | |
| ' | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Reinstall dependencies | |
| run: | | |
| rm composer.lock | |
| rm -rf vendor | |
| composer install --no-scripts --no-progress | |
| composer dump-autoload | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Install test dependencies | |
| run: | | |
| composer require --dev --no-progress --with-all-dependencies \ | |
| pestphp/pest \ | |
| larastan/larastan:^3.1 \ | |
| laravel/dusk \ | |
| alebatistella/duskapiconf \ | |
| protonemedia/laravel-dusk-fakes:^1.6 | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Set port number based on PHP version | |
| run: | | |
| if [[ "${{ matrix.php-version }}" == "8.2" ]]; then | |
| echo "SERVER_PORT=8000" >> $GITHUB_ENV | |
| elif [[ "${{ matrix.php-version }}" == "8.3" ]]; then | |
| echo "SERVER_PORT=8001" >> $GITHUB_ENV | |
| else | |
| echo "SERVER_PORT=8002" >> $GITHUB_ENV | |
| fi | |
| - name: Start Chrome Driver and PHP Server | |
| run: | | |
| php artisan dusk:chrome-driver --detect & | |
| ./vendor/laravel/dusk/bin/chromedriver-linux & | |
| php artisan serve --port=${{ env.SERVER_PORT }} --no-reload & | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Run Tests | |
| run: ./vendor/bin/pest --parallel | |
| working-directory: ./laravel_app_${{ matrix.php-version }} | |
| - name: Run Dusk Tests | |
| env: | |
| APP_URL: "http://127.0.0.1:${{ env.SERVER_PORT }}" | |
| APP_ENV: testing | |
| run: php artisan dusk -vvv | |
| working-directory: ./laravel_app_${{ matrix.php-version }} |