103 lines
1.9 KiB
YAML
103 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
jobs:
|
|
test:
|
|
name: 🧪 Tests Laravel
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 📥 Checkout
|
|
uses: actions/checkout@v4
|
|
- name: 🐘 Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.3'
|
|
extensions: bcmath,ctype,curl,dom,fileinfo,mbstring,openssl,pdo,tokenizer,xml,zip
|
|
coverage: none
|
|
|
|
- name: Cache Composer
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.composer/cache
|
|
key: composer-cache
|
|
|
|
- name: Install Composer dependencies
|
|
run: |
|
|
composer install \
|
|
--no-interaction \
|
|
--prefer-dist \
|
|
--no-progress
|
|
|
|
- name: ⚙️ Prepare Laravel
|
|
run: |
|
|
|
|
cp .env.example .env
|
|
|
|
php artisan key:generate
|
|
|
|
touch database/database.sqlite
|
|
|
|
php artisan migrate --force
|
|
|
|
|
|
- name: 🧪 Run PHPUnit
|
|
run: |
|
|
php artisan test
|
|
|
|
|
|
|
|
docker:
|
|
|
|
|
|
name: 🐳 Build & Push Image
|
|
|
|
needs: test
|
|
|
|
if: ${{ github.ref == 'refs/heads/main' }}
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
steps:
|
|
|
|
|
|
- name: 📥 Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: 🔐 Login Registry Gitea
|
|
run: |
|
|
|
|
docker login git.leonmorival.xyz \
|
|
-u "${{ secrets.REGISTRY_USER }}" \
|
|
-p "${{ secrets.REGISTRY_PASSWORD }}"
|
|
|
|
|
|
|
|
- name: 🏗️ Build image
|
|
run: |
|
|
|
|
docker build \
|
|
-t git.leonmorival.xyz/leonm/landing-api:latest \
|
|
-t git.leonmorival.xyz/leonm/landing-api:${{ github.sha }} \
|
|
.
|
|
|
|
|
|
|
|
- name: 📤 Push image
|
|
run: |
|
|
|
|
docker push git.leonmorival.xyz/leonm/landing-api:latest
|
|
|
|
docker push git.leonmorival.xyz/leonm/landing-api:${{ github.sha }}
|