Added Cache to CICD
This commit is contained in:
63
.github/workflows/lint.yml
vendored
63
.github/workflows/lint.yml
vendored
@@ -20,30 +20,59 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
quality:
|
quality:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- 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 }}-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
composer-${{ runner.os }}-
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# 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
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.4'
|
php-version: '8.4'
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Install dependencies
|
||||||
|
# -------------------------
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
composer install --no-interaction --prefer-dist --no-progress --no-scripts
|
||||||
npm install
|
npm ci
|
||||||
|
|
||||||
- name: Run Pint
|
# -------------------------
|
||||||
run: composer lint
|
# Run linters in parallel
|
||||||
|
# -------------------------
|
||||||
- name: Format Frontend
|
- name: Run linters
|
||||||
run: npm run format
|
run: |
|
||||||
|
composer lint &
|
||||||
- name: Lint Frontend
|
npm run format &
|
||||||
run: npm run lint
|
npm run lint &
|
||||||
|
wait
|
||||||
# - name: Commit Changes
|
|
||||||
# uses: stefanzweifel/git-auto-commit-action@v7
|
|
||||||
# with:
|
|
||||||
# commit_message: fix code style
|
|
||||||
# commit_options: '--no-verify'
|
|
||||||
|
|||||||
56
.github/workflows/tests.yml
vendored
56
.github/workflows/tests.yml
vendored
@@ -25,32 +25,66 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
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
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
coverage: xdebug
|
coverage: none
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Install dependencies
|
||||||
|
# -------------------------
|
||||||
- name: Install Node Dependencies
|
- name: Install Node Dependencies
|
||||||
run: npm i
|
run: npm ci
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install PHP Dependencies
|
||||||
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress
|
||||||
|
|
||||||
- name: Copy Environment File
|
# -------------------------
|
||||||
run: cp .env.example .env
|
# Laravel setup
|
||||||
|
# -------------------------
|
||||||
- name: Generate Application Key
|
- name: Prepare environment
|
||||||
run: php artisan key:generate
|
run: |
|
||||||
|
cp .env.example .env
|
||||||
|
php artisan key:generate
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Build (optional – remove if not needed for tests)
|
||||||
|
# -------------------------
|
||||||
- name: Build Assets
|
- name: Build Assets
|
||||||
run: npm run build
|
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