-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (42 loc) · 1.36 KB
/
run-tests.yml
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
name: Run Tests
on: [push, workflow_dispatch]
jobs:
phpunit:
runs-on: ubuntu-22.04
env:
TEST_DB_CONNECTION: pgsql
TEST_DB_USERNAME: test
TEST_DB_PASSWORD: password
TEST_DB_DATABASE: test
TEST_DB_HOST: 127.0.0.1
TEST_DB_PORT: 5432
steps:
- name: Setup Postgres
run: |
sudo systemctl start postgresql.service
sudo -u postgres psql -c "CREATE USER $TEST_DB_USERNAME WITH PASSWORD '$TEST_DB_PASSWORD'"
sudo -u postgres psql -c "CREATE DATABASE $TEST_DB_DATABASE WITH OWNER = $TEST_DB_USERNAME"
- name: Get code
uses: actions/checkout@v3
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ./src/vendor
key: composer-deps-${{ hashFiles('./src/composer.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ./src
run: composer install
- name: Create dummy .env
working-directory: ./src
run: echo "APP_KEY=" > .env
- name: Generate dummy APP_KEY
working-directory: ./src
run: php artisan key:generate
- name: Reset composer auto-load
working-directory: ./src
run: composer dump-autoload
- name: Run PHPUnit
working-directory: ./src
run: php artisan test