try runner
This commit is contained in:
@@ -1,16 +1,13 @@
|
|||||||
name: CI
|
name: CI/CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- master
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Tests (PHP 8.5)
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -40,8 +37,121 @@ jobs:
|
|||||||
- name: Generate application key
|
- name: Generate application key
|
||||||
run: php artisan key:generate
|
run: php artisan key:generate
|
||||||
|
|
||||||
- name: Check code style
|
|
||||||
run: vendor/bin/pint --test --format github
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: php artisan test --compact
|
run: php artisan test --compact
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
needs: test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.5'
|
||||||
|
extensions: mbstring, dom, curl, sqlite3, pdo_sqlite
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Cache Composer packages
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: vendor
|
||||||
|
key: composer-prod-${{ hashFiles('composer.lock') }}
|
||||||
|
restore-keys: composer-prod-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies (production)
|
||||||
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
|
||||||
|
- name: Cache Node modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: node-${{ hashFiles('package-lock.json') }}
|
||||||
|
restore-keys: node-
|
||||||
|
|
||||||
|
- name: Install Node dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build frontend assets
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Create deployment archive
|
||||||
|
run: |
|
||||||
|
tar --exclude='.git' \
|
||||||
|
--exclude='.gitea' \
|
||||||
|
--exclude='node_modules' \
|
||||||
|
--exclude='tests' \
|
||||||
|
--exclude='.env' \
|
||||||
|
--exclude='*.md' \
|
||||||
|
-czf /tmp/deploy.tar.gz .
|
||||||
|
|
||||||
|
- name: Upload deployment artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: deploy-${{ github.sha }}
|
||||||
|
path: /tmp/deploy.tar.gz
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download deployment artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: deploy-${{ github.sha }}
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
|
- name: Setup SSH known hosts
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
ssh-keyscan -p ${{ secrets.SSH_PORT || 22 }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Install sshpass
|
||||||
|
run: sudo apt-get install -y sshpass
|
||||||
|
|
||||||
|
- name: Upload archive to server
|
||||||
|
run: |
|
||||||
|
sshpass -p "${{ secrets.SSH_PASSWORD }}" \
|
||||||
|
rsync -az --no-perms \
|
||||||
|
-e "ssh -p ${{ secrets.SSH_PORT || 22 }}" \
|
||||||
|
/tmp/deploy.tar.gz \
|
||||||
|
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DEPLOY_PATH }}/deploy.tar.gz
|
||||||
|
|
||||||
|
- name: Extract and deploy on server
|
||||||
|
run: |
|
||||||
|
sshpass -p "${{ secrets.SSH_PASSWORD }}" \
|
||||||
|
ssh -p ${{ secrets.SSH_PORT || 22 }} \
|
||||||
|
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'ENDSSH'
|
||||||
|
|
||||||
|
set -e
|
||||||
|
DEPLOY_PATH="${{ secrets.DEPLOY_PATH }}"
|
||||||
|
|
||||||
|
cd "$DEPLOY_PATH"
|
||||||
|
|
||||||
|
# Extract archive
|
||||||
|
tar -xzf deploy.tar.gz
|
||||||
|
rm deploy.tar.gz
|
||||||
|
|
||||||
|
# Write .env from secret
|
||||||
|
echo "${{ secrets.ENV_FILE }}" > .env
|
||||||
|
|
||||||
|
# Run post-deploy commands
|
||||||
|
php artisan config:cache
|
||||||
|
php artisan route:cache
|
||||||
|
php artisan view:cache
|
||||||
|
php artisan migrate --force --no-interaction
|
||||||
|
php artisan queue:restart
|
||||||
|
|
||||||
|
ENDSSH
|
||||||
|
|||||||
47
.gitea/workflows/ori_ci.yml
Normal file
47
.gitea/workflows/ori_ci.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Tests (PHP 8.5)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.5'
|
||||||
|
extensions: mbstring, dom, curl, sqlite3, pdo_sqlite
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Cache Composer packages
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: vendor
|
||||||
|
key: composer-${{ hashFiles('composer.lock') }}
|
||||||
|
restore-keys: composer-
|
||||||
|
|
||||||
|
- name: Install Composer dependencies
|
||||||
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
|
- name: Copy environment file
|
||||||
|
run: cp .env.example .env
|
||||||
|
|
||||||
|
- name: Generate application key
|
||||||
|
run: php artisan key:generate
|
||||||
|
|
||||||
|
- name: Check code style
|
||||||
|
run: vendor/bin/pint --test --format github
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: php artisan test --compact
|
||||||
@@ -53,6 +53,10 @@
|
|||||||
|
|
||||||
<p>hello world</p>
|
<p>hello world</p>
|
||||||
|
|
||||||
|
<p>my name is saufi</p>
|
||||||
|
|
||||||
|
<p>this is git class to use gitea</p>
|
||||||
|
|
||||||
@if (Route::has('login'))
|
@if (Route::has('login'))
|
||||||
<div class="h-14.5 hidden lg:block"></div>
|
<div class="h-14.5 hidden lg:block"></div>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
Reference in New Issue
Block a user