Skip to content

Commit 89450af

Browse files
adds ci, updates composer (#75)
* adds ci, updates composer * dont really need this for api projects * add setup steps in ci * composer run * Adds postgres service * remove the test script * try postgres host localhost * try mapping port * try localhost again
1 parent c3951f1 commit 89450af

File tree

2 files changed

+94
-15
lines changed

2 files changed

+94
-15
lines changed

.github/workflows/ci.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- v*
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-22.04
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
stability: [prefer-stable]
18+
php: [8.1, 8.2, 8.3, 8.4]
19+
laravel: [10]
20+
21+
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
22+
23+
# Service containers to run with `container-job`
24+
services:
25+
# Label used to access the service container
26+
postgres:
27+
# Docker Hub image
28+
image: postgres
29+
# Provide the password for postgres
30+
env:
31+
POSTGRES_PASSWORD: secret
32+
# Set health checks to wait until postgres has started
33+
options: >-
34+
--health-cmd pg_isready
35+
--health-interval 10s
36+
--health-timeout 5s
37+
--health-retries 5
38+
ports:
39+
- 5432:5432
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
# Docs: https://github.com/shivammathur/setup-php
46+
- name: Setup PHP
47+
uses: shivammathur/setup-php@v2
48+
with:
49+
php-version: ${{ matrix.php }}
50+
extensions: dom, curl, libxml, mbstring, zip
51+
ini-values: error_reporting=E_ALL
52+
tools: composer:v2
53+
# todo: Add
54+
coverage: none
55+
56+
- name: Install dependencies
57+
run: |
58+
composer require "illuminate/contracts=^${{ matrix.laravel }}" --no-update
59+
composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
60+
61+
- name: Prepare the application
62+
run: |
63+
composer run post-root-package-install
64+
composer run post-create-project-cmd
65+
66+
- name: Clear Config
67+
run: |
68+
php artisan config:clear
69+
php artisan cache:clear
70+
71+
- name: Set postgres envs for app
72+
run: |
73+
echo "DB_HOST=localhost" >> .env
74+
echo "DB_DATABASE=postgres" >> .env
75+
echo "DB_DATABASE_TEST=postgres" >> .env
76+
echo "DB_USERNAME=postgres" >> .env
77+
78+
- name: Run phpunit tests
79+
run: composer test

composer.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^7.3|^8.0",
21-
"fideloper/proxy": "^4.4",
22-
"fruitcake/laravel-cors": "^2.0",
23-
"guzzlehttp/guzzle": "^7.0.1",
24-
"laravel/framework": "^8.0",
25-
"laravel/tinker": "^2.5",
26-
"specialtactics/l5-api": "^3.0"
20+
"php": ">=8.1",
21+
"guzzlehttp/guzzle": "^7.6",
22+
"laravel/framework": "^10.43",
23+
"laravel/tinker": "^2.9",
24+
"specialtactics/l5-api": "^5.0"
2725
},
2826
"require-dev": {
29-
"barryvdh/laravel-ide-helper": "^2.9",
30-
"beyondcode/laravel-dump-server": "^1.4",
31-
"facade/ignition": "^2.7",
32-
"fakerphp/faker": "^1.9.1",
33-
"mockery/mockery": "^1.4.1",
34-
"nunomaduro/collision": "^5.0",
27+
"barryvdh/laravel-ide-helper": "^2.15",
28+
"beyondcode/laravel-dump-server": "^1.9",
29+
"fakerphp/faker": "^1.15",
30+
"mockery/mockery": "^1.5",
31+
"nunomaduro/collision": "^6.5",
3532
"phpunit/phpunit": "^9.3.3",
36-
"laravel/telescope": "^4.4"
33+
"laravel/telescope": "^5.1"
3734
},
3835
"autoload": {
3936
"psr-4": {
4037
"App\\": "app/",
4138
"Database\\Factories\\": "database/factories/",
4239
"Database\\Seeders\\": "database/seeders/"
43-
}
40+
},
41+
"classmap": [
42+
"database/migrations"
43+
]
4444
},
4545
"autoload-dev": {
4646
"psr-4": {

0 commit comments

Comments
 (0)