Added Cache to CICD
This commit is contained in:
56
.github/workflows/tests.yml
vendored
56
.github/workflows/tests.yml
vendored
@@ -25,32 +25,66 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# -------------------------
|
||||
# Cache Composer
|
||||
# -------------------------
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.composer/cache
|
||||
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
composer-${{ runner.os }}-${{ matrix.php-version }}-
|
||||
|
||||
# -------------------------
|
||||
# Cache Node
|
||||
# -------------------------
|
||||
- name: Cache Node dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-${{ runner.os }}-
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
tools: composer:v2
|
||||
coverage: xdebug
|
||||
coverage: none
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
# -------------------------
|
||||
# Install dependencies
|
||||
# -------------------------
|
||||
- name: Install Node Dependencies
|
||||
run: npm i
|
||||
run: npm ci
|
||||
|
||||
- name: Install Dependencies
|
||||
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||
- name: Install PHP Dependencies
|
||||
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress
|
||||
|
||||
- name: Copy Environment File
|
||||
run: cp .env.example .env
|
||||
|
||||
- name: Generate Application Key
|
||||
run: php artisan key:generate
|
||||
# -------------------------
|
||||
# Laravel setup
|
||||
# -------------------------
|
||||
- name: Prepare environment
|
||||
run: |
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
|
||||
# -------------------------
|
||||
# Build (optional – remove if not needed for tests)
|
||||
# -------------------------
|
||||
- name: Build Assets
|
||||
run: npm run build
|
||||
|
||||
- name: Tests
|
||||
run: ./vendor/bin/phpunit
|
||||
# -------------------------
|
||||
# Run tests (parallel)
|
||||
# -------------------------
|
||||
- name: Run Tests
|
||||
run: php artisan test --parallel
|
||||
|
||||
Reference in New Issue
Block a user