Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ZaforAbdullah authored Nov 17, 2024
1 parent 69485fc commit 9ed696c
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: GitHub Action

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Build Docker containers
- name: Build containers
run: docker compose -f docker-compose.dev.yml up -d --force-recreate --build

# Application configuration
- name: Configure application
run: |
docker exec -i local /bin/bash -c 'composer update'
docker exec -i local /bin/bash -c '/usr/local/bin/php artisan config:clear'
docker exec -i local /bin/bash -c '/usr/local/bin/php artisan cache:clear'
docker exec -i local /bin/bash -c '/usr/local/bin/php artisan view:clear'
docker exec -i local /bin/bash -c '/usr/local/bin/php artisan DBConnection'
docker exec -i local /bin/bash -c '/usr/local/bin/php artisan migrate'
env:
# Add any environment variables here if needed
APP_ENV: testing

# Run PHPUnit tests
- name: Run PHPUnit tests
run: docker exec -i local /bin/bash -c '/usr/local/bin/php artisan test'

# Run Larastan static analysis
- name: Larastan analysis
run: docker exec -i local /bin/bash -c './vendor/bin/phpstan analyse --generate-baseline --memory-limit=2G'

# Cleanup after the job
- name: Cleanup resources
run: |
docker compose -f docker-compose.dev.yml down
docker volume prune -f
docker image prune -f

0 comments on commit 9ed696c

Please sign in to comment.