This repository was archived by the owner on Jun 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.42 KB
/
tests.yml
File metadata and controls
81 lines (69 loc) · 2.42 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
name: Code checks
on:
pull_request:
push:
branches:
- main
- develop
jobs:
tests:
runs-on: ubuntu-latest
services:
mysql-service:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: db_test
ports:
- 33306:3306
# Set health checks to wait until mysql database has started (it takes some seconds to start)
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Write ssh key to enable composer authentication for private packages
run: |
mkdir -p ~/.ssh
echo "${{ secrets.TEST_BACKEND_SSHKEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Copy environment variables
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Update .env file
run: |
echo "DB_CONNECTION=mysql" >> .env
echo "DB_HOST=127.0.0.1" >> .env
echo "DB_PORT=33306" >> .env
echo "DB_DATABASE=db_test" >> .env
echo "DB_USERNAME=root" >> .env
echo "DB_PASSWORD=password" >> .env
echo "APP_ENV=testing" >> .env
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, mysql, xml, ctype, iconv, json, pdo_mysql, tokenizer
coverage: xdebug
- name: Update Composer Dependencies
run: composer update -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
- name: Install dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
- name: Run tests
run: vendor/bin/testbench package:test
- name: Run linter test
run: composer pint:test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
- name: Clean up SSH key
if: always()
run: rm -f ~/.ssh/id_rsa