Skip to content

Commit 8442b4a

Browse files
committed
ci: add a test installation job
1 parent 332b7b0 commit 8442b4a

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ on:
55
branches: [ master ]
66
tags:
77
- 'v*.*.*'
8+
89
pull_request:
910
branches: [ master ]
11+
1012
workflow_dispatch:
1113

1214
jobs:
@@ -42,3 +44,61 @@ jobs:
4244

4345
- name: Run PHPUnit tests
4446
run: composer test
47+
48+
test_installation:
49+
name: Test Project Installation
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Setup PHP
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: '8.4'
60+
extensions: bcmath, ds, gmp, trader, pdo_sqlite, zip, curl, libxml, dom
61+
tools: composer:v2, symfony
62+
63+
- name: Create new Symfony project
64+
run: symfony new test-project --dir=test-project --no-git
65+
66+
- name: Configure and install Stochastix bundle
67+
working-directory: ./test-project
68+
run: |
69+
composer config --no-plugins allow-plugins.williarin/cook true
70+
composer config repositories.stochastix-core '{"type": "path", "url": "..", "options": {"symlink": false}}'
71+
composer require stochastix/core:"*@dev"
72+
73+
- name: Verify recipe installation
74+
working-directory: ./test-project
75+
run: |
76+
echo "--- Verifying config/packages/stochastix.yaml ---"
77+
test -f config/packages/stochastix.yaml || (echo "File not found!" && exit 1)
78+
echo "Found."
79+
80+
echo "--- Verifying config/routes/stochastix.yaml ---"
81+
test -f config/routes/stochastix.yaml || (echo "File not found!" && exit 1)
82+
echo "Found."
83+
84+
echo "--- Verifying data/.gitkeep ---"
85+
test -f data/.gitkeep || (echo "File not found!" && exit 1)
86+
echo "Found."
87+
88+
echo "--- Verifying Makefile ---"
89+
test -f Makefile || (echo "File not found!" && exit 1)
90+
echo "Found."
91+
92+
echo "--- Verifying src/Strategy/SampleStrategy.php ---"
93+
test -f src/Strategy/SampleStrategy.php || (echo "File not found!" && exit 1)
94+
echo "Found."
95+
96+
echo "--- Verifying .env for DATABASE_URL ---"
97+
grep -q 'DATABASE_URL="sqlite:///%kernel.project_dir%/data/queue_%kernel.environment%.db"' .env || (echo "DATABASE_URL not found or incorrect!" && exit 1)
98+
echo "Found."
99+
100+
- name: Setup Database
101+
working-directory: ./test-project
102+
run: |
103+
php bin/console doctrine:database:create --if-not-exists
104+
php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration

cook.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ files:
99
content: |-
1010
DATABASE_URL="sqlite:///%kernel.project_dir%/data/queue_%kernel.environment%.db"
1111
12+
data/.gitkeep:
13+
if_exists: ignore
14+
source: recipe/data/.gitkeep
15+
1216
directories:
13-
'%ROOT_DIR%/data/': recipe/data/
1417
'%CONFIG_DIR%/': recipe/config/
1518
'%SRC_DIR%/': recipe/src/
1619

0 commit comments

Comments
 (0)