Initial commit #1
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
name: Tests | |
permissions: | |
contents: read | |
on: ['push', 'pull_request'] | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] | |
bun: [1.0] | |
php: [8.2, 8.3] | |
dependencies: [lowest, highest] | |
experimental: [false] | |
name: π· Test on PHP-${{ matrix.php }} ${{ matrix.dependencies }} and Bun-${{ matrix.bun }} under ${{ matrix.os }} | |
steps: | |
- name: π Get latest code | |
uses: actions/checkout@v4 | |
- name: π Setup Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: ${{ matrix.bun }} | |
- name: β¨ Install JavaScript dependencies | |
run: | | |
bun install | |
bun run e2e.install | |
- name: β‘οΈ Cache dependencies | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-dependencies-php-${{ matrix.php }}-composer- | |
- name: π¨ Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: curl, dom, gd, intl, mbstring, openssl, pdo, pdo_mysql, tokenizer, zip | |
ini-values: error_reporting=E_ALL | |
tools: composer:v2, php-cs-fixer, phpunit, vimeo/psalm | |
coverage: pcov | |
- name: π§ Install PHP dependencies | |
run: | | |
composer install -q --no-ansi --no-cache --no-interaction --no-scripts --no-progress --prefer-dist | |
composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist | |
- name: π§βπ» Configure environment | |
run: | | |
cp .env.example .env.test | |
set -e | |
sed -i "s|^\(APP_ENV=\s*\).*$|\1test|" .env.test | |
printf "The complete `.env.test` ... \n\n" | |
cat .env.test | |
- name: π¦οΈ Allow executables | |
run: | | |
set -e | |
chmod +x ./run | |
chmod +x ./artisan | |
- name: ποΈ Generate Key | |
run: | | |
set -e | |
./run key:generate --env=test | |
./run queue:restart --env=test | |
- name: π Directory Permissions | |
run: | | |
chmod -R 777 storage bootstrap/cache | |
chmod -R 777 storage/ | |
- name: π§Ή Clear Caches | |
run: set -e && ./run optimize:clear --env=test | |
- name: β Check code style | |
run: bun check | |
- name: π§ͺ Test components | |
run: bun run test | |
- name: π± Compile assets | |
run: bun run build | |
- name: π List distribution folder | |
run: ls public/static | |
- name: β‘οΈ Optimize Stuffs | |
run: set -e && ./run optimize --env=test | |
- name: β Check code lint | |
run: composer check | |
- name: βοΈ Run static analysis | |
run: composer analyse | |
- name: π§ͺ Test features | |
run: | | |
set -e && ./run serve --env=test > /dev/null 2>&1 & | |
composer test | |
- name: π Test the whole application | |
run: composer debug | |
- name: π Execute end-to-end testing | |
run: bun e2e |