Repository navigation
82 lines (65 loc) · 1.99 KB
/
Copy pathphp.yml
File metadata and controls
82 lines (65 loc) · 1.99 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
name: Tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: ['8.1', '8.2', '8.3']
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-versions }}-
- name: Install dependencies
run: composer update --prefer-dist --no-progress
- name: Run PHP-CS-Fixer
run: composer cs:check
- name: Run PHPStan
run: composer phpstan
- name: Run Rector
run: composer rector:check
- name: Create env
run: php qt core:env
- name: Create app key
run: php qt core:key --length=64
- name: Run tests
run: composer test
- name: Generate the demo API module
run: php qt module:generate Api --template=DemoApi --yes
- name: Smoke test the API
run: |
php qt serve --host=127.0.0.1 --port=8000 > server.log 2>&1 &
for i in $(seq 1 20); do
curl -s -o /dev/null http://127.0.0.1:8000/ && break
sleep 1
done
status=$(curl -s -o response.json -w '%{http_code}' http://127.0.0.1:8000/api/posts)
echo "GET /api/posts returned $status"
cat response.json
echo
if [ "$status" != "200" ]; then
echo "Expected 200. Server log:"
cat server.log
exit 1
fi
grep -q '"status":"success"' response.json