WIP React version #16
Workflow file for this run
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 | |
on: | |
push: | |
paths: | |
- "**.js" | |
- "**.jsx" | |
- "**.php" | |
- "**.vue" | |
- composer.json | |
- package-lock.json | |
- "demo-app/.env.example" | |
- "demo-app/composer.json" | |
- "demo-app/package.json" | |
- "demo-app/phpunit.xml.dist" | |
- ".github/workflows/tests.yml" | |
jobs: | |
tests: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[only-tests]') && !contains(github.event.head_commit.message, '[only-quality]') && !contains(github.event.head_commit.message, '[ci-skip]') && !contains(github.event.head_commit.message, '[skip-ci]')" | |
strategy: | |
fail-fast: true | |
matrix: | |
stack: [vue] | |
name: Tests | |
env: | |
APP_URL: "http://127.0.0.1:8000" | |
DB_CONNECTION: sqlite | |
APP_STACK: ${{ matrix.stack }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, mysql, mysqli, pdo_mysql | |
coverage: none | |
- name: Prepare The Environment | |
run: | | |
cd demo-app | |
cp .env.example .env | |
- name: Set React Environment Variables | |
if: ${{ matrix.stack == 'react' }} | |
run: | | |
cd demo-app | |
sed -i -e "s|APP_STACK=vue|APP_STACK=react|g" .env | |
- name: Build React library | |
if: ${{ matrix.stack == 'react' }} | |
run: | | |
cd react | |
npm install | |
npm run build | |
- name: Test React library | |
if: ${{ matrix.stack == 'react' }} | |
run: | | |
cd react | |
npm run test | |
- name: Build Vue library | |
if: ${{ matrix.stack == 'vue' }} | |
run: | | |
cd vue | |
npm install | |
npm run build | |
- name: Test Vue library | |
if: ${{ matrix.stack == 'vue' }} | |
run: | | |
cd vue | |
npm run test | |
- name: Prepare Laravel app | |
run: | | |
cd demo-app | |
composer install --no-progress --prefer-dist --optimize-autoloader | |
npm install | |
npm run build | |
php artisan key:generate | |
touch database/database.sqlite | |
php artisan migrate --seed | |
php artisan dusk:chrome-driver --detect | |
- name: Run HTTP server | |
run: | | |
cd demo-app | |
php artisan serve --no-reload & | |
- name: Start Chrome Driver | |
run: | | |
cd demo-app | |
./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 & | |
- name: Run Dusk tests | |
run: | | |
cd demo-app | |
php artisan dusk | |
- name: Upload Screenshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots | |
path: demo-app/tests/Browser/screenshots | |
- name: Upload Snapshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: snapshots | |
path: demo-app/tests/Browser/__snapshots__ | |
- name: Upload Console Logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: console | |
path: demo-app/tests/Browser/console | |
- name: Upload Logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs | |
path: demo-app/storage/logs |