-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (76 loc) · 2.57 KB
/
php.yml
File metadata and controls
90 lines (76 loc) · 2.57 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: PHP CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [8.2]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, imap
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(cd organizer/src && composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: |
${{ steps.composer-cache.outputs.dir }}
organizer/src/vendor
key: ${{ runner.os }}-composer-${{ hashFiles('organizer/src/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
run: |
cd organizer/src
composer install --prefer-dist --no-interaction --optimize-autoloader
- name: Create OpenAI API key file
run: |
mkdir -p ./secrets
echo "# This is a placeholder for the OpenAI API key" > ./secrets/openai_api_key
echo "sk-placeholder-api-key-not-real" >> ./secrets/openai_api_key
- name: Start Docker compose (organizer, postgres, greenmail, auth)
run: docker compose -f docker-compose.dev.yaml up -d greenmail postgres organizer auth
- name: Wait for PostgreSQL to be ready
run: |
echo "Waiting for PostgreSQL to be ready..."
for i in {1..30}; do
if docker exec $(docker ps -q -f name=postgres) pg_isready -U offpost; then
echo "PostgreSQL is ready!"
break
fi
echo "Retrying in 1 second..."
sleep 1
done
- name: Wait for migrations
run: |
timeout=60
until docker exec offpost-organizer-1 php /php-frontend/migrations/migrate.php || [ $timeout -eq 0 ]; do
echo "Waiting for migrations to complete..."
sleep 5
((timeout-=5))
done
if [ $timeout -eq 0 ]; then
echo "Migration verification timed out"
exit 1
fi
- name: Run unit tests
run: cd organizer/src && vendor/bin/phpunit --exclude-group integration tests
- name: Run e2e tests
run: cd organizer/src && vendor/bin/phpunit e2e-tests/