2024-01-12 09:10:59 +03:00
|
|
|
name: Tests & Lint & Deploy to Railway
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
2024-02-05 13:14:29 +03:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-versions: [ '8.3' ]
|
|
|
|
node-version: ['20.x']
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up PHP ${{ matrix.php-versions }}
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
2024-02-10 11:58:47 +03:00
|
|
|
coverage: xdebug
|
2024-02-10 12:04:50 +03:00
|
|
|
extensions: :opcache, mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
|
2024-02-10 11:58:47 +03:00
|
|
|
tools: composer:v2.6.6
|
|
|
|
ini-values: opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=64M
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB }}
|
|
|
|
debug: true
|
2024-02-05 13:14:29 +03:00
|
|
|
|
|
|
|
- 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 }}
|
|
|
|
|
2024-02-10 11:58:47 +03:00
|
|
|
# - 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
|
|
|
|
# - run: echo $COMPOSER_AUTH|jq -r '.["github-oauth"]["github.com"]'|base64
|
|
|
|
# - run: echo $GITHUB_TOKEN|base64
|
|
|
|
# - name: Diagnose composer
|
|
|
|
# env:
|
|
|
|
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works
|
|
|
|
# run: composer diagnose -vvv
|
|
|
|
# - name: Install dependencies
|
|
|
|
# env:
|
|
|
|
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH_JSON }} # only this works
|
|
|
|
# run: composer install # will work
|
2024-02-05 13:14:29 +03:00
|
|
|
|
2024-02-10 12:04:50 +03:00
|
|
|
# - name: Setup sqlite3 driver
|
|
|
|
# run: apt install php${{ matrix.php-versions }}-sqlite3 -y
|
2024-02-05 13:14:29 +03:00
|
|
|
|
|
|
|
- name: Setup project
|
|
|
|
run: make setup
|
|
|
|
|
|
|
|
- name: Check lint
|
|
|
|
run: make lint
|
|
|
|
|
|
|
|
- name: Check tests
|
|
|
|
run: make test
|
2024-02-05 11:39:12 +03:00
|
|
|
|
|
|
|
deploy:
|
2024-02-05 13:14:29 +03:00
|
|
|
needs: build
|
2024-02-05 11:39:12 +03:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-02-05 11:47:28 +03:00
|
|
|
uses: appleboy/ssh-action@v1.0.3
|
2024-02-05 11:39:12 +03:00
|
|
|
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USERNAME }}
|
|
|
|
password: ${{ secrets.PASSWORD }}
|
|
|
|
port: ${{ secrets.PORT }}
|
2024-02-05 12:46:13 +03:00
|
|
|
script: |
|
2024-02-05 13:06:02 +03:00
|
|
|
cd /var/www/test-testabit/
|
2024-02-05 13:12:58 +03:00
|
|
|
git stash
|
|
|
|
git pull --rebase
|
2024-02-10 11:58:47 +03:00
|
|
|
git stash clear
|
2024-02-05 13:06:02 +03:00
|
|
|
make setup-test
|