Update deploy-app-staging.yml #3187
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: Test | |
on: [push] | |
jobs: | |
feature-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.3' | |
- name: Install Composer Dependencies | |
run: composer install --no-progress --prefer-dist --optimize-autoloader | |
- name: Prepare The Environment | |
run: cp .env.example .env | |
- name: Generate Application Key | |
run: php artisan key:generate | |
- name: Run Feature Tests | |
run: php artisan test | |
js-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '18.x' | |
- name: Install Dependencies | |
run: npm ci | |
- name: Jest | |
run: npm test | |
browser-test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Prepare The Environment | |
run: cp .env.dusk.ci .env | |
- name: Create Database | |
run: | | |
sudo systemctl start mysql | |
# workaround for php/mysql-8 incompatibility: https://stackoverflow.com/a/50776838 | |
mysql --user="root" --password="root" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'" | |
mysql --user="root" --password="root" -e "CREATE DATABASE dusk character set UTF8mb4 collate utf8mb4_bin;" | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.3' | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: '18.x' | |
- name: Install Dependencies | |
run: | | |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader | |
chmod -R 777 storage bootstrap/cache | |
npm install | |
npm run production | |
- name: Generate Application Key | |
run: | | |
php artisan key:generate | |
- name: Upgrade Chrome Driver | |
run: php artisan dusk:chrome-driver | |
# Following step is a workaround for a bug in older versions of dusk. It should be removed after dusk is updated (>=v7.x) | |
- name: Install Chrome | |
run: | | |
CHROME_VERSION=$(php artisan dusk:chrome-driver | sed 's/.* //' | awk '{ print substr( $0, 1, length($0)-1 ) }')"-1" | |
sudo wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \ | |
&& sudo apt install -y --allow-downgrades /tmp/chrome.deb \ | |
&& sudo rm /tmp/chrome.deb | |
- name: Start Chrome Driver | |
run: ./vendor/laravel/dusk/bin/chromedriver-linux > /dev/null 2>&1 & | |
- name: Run Laravel Server | |
run: php artisan serve > /dev/null 2>&1 & | |
- name: Run Dusk Tests | |
run: | | |
chmod -R 0755 vendor/laravel/dusk/bin/ | |
php artisan dusk | |
env: | |
APP_ENV: local | |
APP_URL: "http://127.0.0.1:8000" | |
DB_CONNECTION: mysql | |
DB_DATABASE: dusk | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
DB_USER: root | |
DB_PASSWORD: root | |
- name: Upload Laravel Logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs | |
path: ./storage/logs | |
- name: Upload Screenshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots | |
path: tests/Browser/screenshots | |
- name: Upload Console Logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: console | |
path: tests/Browser/console |