Bump actions/setup-node from 1 to 4 #42
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] | |
jobs: | |
dusk: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: | |
- "8.1" | |
node-version: | |
- 16 | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.head_ref }} | |
- name: "Install Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "${{ matrix.node-version }}" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "${{ matrix.php-version }}" | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
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 }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit == 'false' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- name: "Install locked dependencies with npm" | |
run: "npm ci --ignore-scripts" | |
- name: "Cache dependencies installed with composer" | |
uses: "actions/cache@v2" | |
with: | |
path: "~/.composer/cache" | |
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}" | |
restore-keys: "php-${{ matrix.php-version }}-composer-" | |
- name: "Install locked dependencies with composer" | |
run: "composer install --no-interaction --no-progress --no-suggest" | |
- name: Prepare The Environment | |
run: cp .env.example .env | |
- name: Compile assets | |
run: npm run build | |
- name: Generate Application Key | |
run: php artisan key:generate | |
- name: Clone docs | |
run: git clone https://github.com/protonemedia/laravel-splade-docs docs | |
- name: Run Tests | |
run: php artisan test | |
env: | |
TORCHLIGHT_TOKEN: ${{ secrets.TORCHLIGHT_TOKEN }} | |
- name: Upgrade Chrome Driver | |
run: php artisan dusk:chrome-driver `/opt/google/chrome/chrome --version | cut -d " " -f3 | cut -d "." -f1` | |
- name: Start Chrome Driver | |
run: ./vendor/laravel/dusk/bin/chromedriver-linux & | |
- name: Run Laravel Server | |
run: php artisan serve --no-reload & | |
env: | |
TORCHLIGHT_TOKEN: ${{ secrets.TORCHLIGHT_TOKEN }} | |
- name: Run Dusk Tests | |
run: php artisan dusk | |
env: | |
APP_URL: "http://127.0.0.1:8000" | |
TORCHLIGHT_TOKEN: ${{ secrets.TORCHLIGHT_TOKEN }} | |
- name: Upload Screenshots | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: tests/Browser/screenshots | |
- name: Upload Console Logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: console | |
path: tests/Browser/console | |
- name: Upload Logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: logs | |
path: storage/logs |