2024-01-12 09:10:59 +03:00
|
|
|
name: Tests & Lint & Deploy to Railway
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2024-03-15 16:55:58 +03:00
|
|
|
# pull_request:
|
|
|
|
# branches:
|
|
|
|
# - main
|
2024-01-12 09:10:59 +03:00
|
|
|
|
|
|
|
jobs:
|
2024-03-14 11:57:33 +03:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-03-27 15:20:38 +03:00
|
|
|
php-version: [ '8.3' ]
|
2024-03-14 11:57:33 +03:00
|
|
|
node-version: ['20.x']
|
|
|
|
composer-version: ['2.6.6']
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up PHP ${{ matrix.php-version }} with extensions and tools
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-version }}
|
2024-04-03 12:40:05 +03:00
|
|
|
ini-values: opcache.enable_cli=1, extension=gd
|
2024-03-27 10:14:39 +03:00
|
|
|
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, gd
|
2024-03-14 11:57:33 +03:00
|
|
|
tools: composer:${{ matrix.composer-version }}
|
2024-04-03 12:40:05 +03:00
|
|
|
|
2024-03-14 11:57:33 +03:00
|
|
|
env:
|
|
|
|
debug: true
|
|
|
|
|
|
|
|
- name: PHP Security Checker
|
|
|
|
uses: StephaneBour/actions-php-security-checker@1.1
|
|
|
|
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
|
|
|
|
- name: Add keys
|
|
|
|
run: |
|
|
|
|
sudo curl -o ~/.composer/keys.tags.pub -sL https://composer.github.io/releases.pub
|
|
|
|
sudo curl -o ~/.composer/keys.dev.pub -sL https://composer.github.io/snapshots.pub
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
env:
|
|
|
|
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }}
|
|
|
|
run: composer install
|
|
|
|
|
|
|
|
- name: Setup project
|
|
|
|
run: make setup-ci
|
|
|
|
|
|
|
|
- name: Check lint
|
|
|
|
run: make lint
|
|
|
|
|
|
|
|
- name: Check tests
|
|
|
|
run: make test
|
2024-02-10 14:32:50 +03:00
|
|
|
|
2024-03-12 09:32:57 +03:00
|
|
|
deploy:
|
2024-03-14 11:57:33 +03:00
|
|
|
needs: build
|
2024-03-12 09:32:57 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: deploy to test server
|
|
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
|
|
|
|
|
|
with:
|
2024-03-14 11:49:05 +03:00
|
|
|
host: ${{ secrets.HOST }}
|
2024-03-12 09:32:57 +03:00
|
|
|
username: ${{ secrets.USERNAME }}
|
2024-03-14 11:44:50 +03:00
|
|
|
password: ${{ secrets.PASSWORD }}
|
2024-03-14 11:49:05 +03:00
|
|
|
port: ${{ secrets.PORT }}
|
2024-03-12 09:32:57 +03:00
|
|
|
script: |
|
|
|
|
cd /var/www/www-root/data/www/testabit.mkgtu.ru
|
|
|
|
git stash
|
|
|
|
git pull --rebase
|
|
|
|
git stash clear
|
|
|
|
make setup-prod
|