-
Notifications
You must be signed in to change notification settings - Fork 47
112 lines (88 loc) · 3.36 KB
/
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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv, mysql
- name: Cache Composer Packages
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-git
- name: Setup Laravel Application
run: composer create-project --prefer-dist laravel/laravel laravel_app --no-interaction
- name: Set Working Directory
run: echo "Change directory context to Laravel app"
working-directory: ./laravel_app
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
id: extract_branch
- name: Install DevDojo Auth from current branch
run: composer require devdojo/auth:dev-${{ env.branch }} --with-all-dependencies
working-directory: ./laravel_app
- name: Publish the DevDojo Auth Assets
run: php artisan vendor:publish --tag=auth:assets
working-directory: ./laravel_app
- name: Publish the DevDojo Configs
run: php artisan vendor:publish --tag=auth:config
working-directory: ./laravel_app
- name: Remove current tests and symlink to DevDojo Auth
run: |
rm -rf tests
ln -s vendor/devdojo/auth/tests tests
working-directory: ./laravel_app
- name: Create sqlite file
run: touch database/database.sqlite
working-directory: ./laravel_app
- name: List out .env
run: cat .env
working-directory: ./laravel_app
# Testing on a mac, this command should be:
# sed -i '' 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
# sed -i '' 's/^DB_DATABASE=laravel/#DB_DATABASE=laravel/' .env
- name: Updating values in the .env
run: |
sed -i 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' .env
sed -i 's/^DB_DATABASE=laravel/#DB_DATABASE=laravel/' .env
working-directory: ./laravel_app
- name: Include Doctrine DBAL Package which is used for renaming columns
run: composer require doctrine/dbal
working-directory: ./laravel_app
- name: Run the migrations
run: php artisan migrate
working-directory: ./laravel_app
- name: Run the Auth Migrations
run: php artisan migrate --path=vendor/devdojo/auth/database/migrations
working-directory: ./laravel_app
# Testing on a mac, this command should be:
# sed -i '' '/"phpunit\/phpunit"/d' composer.json
- name: Remove PHPUnit from composer.json
run: sed -i '/"phpunit\/phpunit"/d' composer.json
working-directory: ./laravel_app
- name: Remove composer.lock and re-run composer install
run: |
rm composer.lock
composer install
working-directory: ./laravel_app
- name: Install PestPHP
run: composer require pestphp/pest --dev --with-all-dependencies
working-directory: ./laravel_app
- name: Clear all view caches
run: php artisan view:clear
working-directory: ./laravel_app
- name: Run Tests
run: ./vendor/bin/pest
working-directory: ./laravel_app