Skip to content

Merge pull request #209 from ShaerWare/feat/commercial-auction-fixes #72

Merge pull request #209 from ShaerWare/feat/commercial-auction-fixes

Merge pull request #209 from ShaerWare/feat/commercial-auction-fixes #72

Workflow file for this run

name: CI/CD
on:
pull_request:
push:
branches: [develop, main]
concurrency:
group: cicd-${{ github.ref }}
# Cancel superseded PR checks, but never cancel an in-progress deploy.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, dom, xml, bcmath, gd, zip, pcntl, sockets, pdo_sqlite, sqlite3, exif
coverage: none
- name: Prepare .env
run: cp .env.example .env
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Generate app key
run: php artisan key:generate
- name: Run tests
run: php artisan test
pint:
name: Code style (Pint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, dom, xml, bcmath, gd, zip, pcntl, sockets, pdo_sqlite, sqlite3, exif
coverage: none
- name: Cache Composer packages
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-
- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist --no-progress
- name: Check code style (Pint)
run: ./vendor/bin/pint --test
assets:
name: Assets freshness
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
- name: Install npm dependencies
run: npm ci
# Verify assets compile. We intentionally do NOT byte-compare against the
# committed public/build: Vite/Tailwind output hashes are not identical
# across machines (local vs CI), which caused false "stale" failures.
- name: Build assets
run: npm run build
deploy-test:
name: Deploy develop -> test.bizzio.ru
runs-on: ubuntu-latest
needs: [tests, pint, assets]
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
steps:
- name: Deploy over SSH
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script_stop: true
command_timeout: 20m
script: |
set -e
cd /var/www/bizzio-test
git fetch origin develop
git reset --hard origin/develop
bash scripts/deploy.sh
deploy-prod:
name: Deploy main -> bizzio.ru
runs-on: ubuntu-latest
needs: [tests, pint, assets]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# Requires manual approval (repo Settings -> Environments -> production).
environment: production
steps:
- name: Deploy over SSH
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script_stop: true
command_timeout: 20m
script: |
set -e
cd /var/www/BIZZIO
git fetch origin main
git reset --hard origin/main
bash scripts/deploy.sh