-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.52 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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