2024-01-12 09:10:59 +03:00
|
|
|
name: Tests & Lint & Deploy to Railway
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-versions: [ '8.1' ]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up PHP ${{ matrix.php-versions }}
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
|
|
|
|
|
|
|
- name: PHP Security Checker
|
|
|
|
uses: StephaneBour/actions-php-security-checker@1.1
|
|
|
|
|
2024-01-16 10:55:50 +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-01-16 11:03:04 +03:00
|
|
|
- name: Setup sqlite3 driver
|
|
|
|
run: apt install php8.1-sqlite3
|
|
|
|
|
2024-01-12 09:10:59 +03:00
|
|
|
- name: Setup project
|
|
|
|
run: make setup
|
|
|
|
|
|
|
|
- name: Check lint
|
|
|
|
run: make lint
|
|
|
|
|
2024-01-16 11:05:22 +03:00
|
|
|
- name: Check tests
|
|
|
|
run: make test
|
2024-01-12 09:10:59 +03:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
needs: build
|
|
|
|
runs-on: ubuntu-latest
|
2024-01-15 18:37:02 +03:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-versions: [ '8.1' ]
|
|
|
|
|
2024-01-12 09:10:59 +03:00
|
|
|
steps:
|
2024-01-15 18:37:02 +03:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up PHP ${{ matrix.php-versions }}
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: ${{ matrix.php-versions }}
|
2024-01-16 10:36:18 +03:00
|
|
|
github_token: ${{ secrets.COMPOSER_GITHUB_TOKEN }}
|
2024-01-16 09:49:35 +03:00
|
|
|
tools: composer, phpcs, phpstan, phpunit, symfony
|
2024-01-15 18:37:02 +03:00
|
|
|
|
|
|
|
- name: PHP Security Checker
|
|
|
|
uses: StephaneBour/actions-php-security-checker@1.1
|
2024-01-12 09:10:59 +03:00
|
|
|
|
2024-01-15 18:37:02 +03:00
|
|
|
- name: Deploy to Server
|
|
|
|
uses: easingthemes/ssh-deploy@main
|
2024-01-12 09:10:59 +03:00
|
|
|
env:
|
2024-01-15 18:37:02 +03:00
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
ARGS: "-rlgoDzvc -i --delete"
|
|
|
|
SOURCE: "dist/"
|
|
|
|
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
|
|
|
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
|
|
|
TARGET: ${{ secrets.REMOTE_TARGET }}
|
|
|
|
EXCLUDE: "/dist/, /node_modules/"
|