-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (116 loc) · 3.16 KB
/
test.yml
File metadata and controls
136 lines (116 loc) · 3.16 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Test
on:
push:
branches:
- "*"
- "**"
tags-ignore:
- v*
pull_request:
jobs:
test:
name: PHP
runs-on: ubuntu-latest
concurrency:
group: nexus-test-${{ github.ref }}
cancel-in-progress: true
strategy:
matrix:
php: ["8.4"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
#
# ENVIRONMENT DEPENDENCIES SETUP
#
- name: Configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
# Start MySQL and Create Databases
- name: Create Databases
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE IF NOT EXISTS nexus;' -h127.0.0.1 -uroot -proot
#
# COMPOSER DEPENDENICES
#
# Add Github Auth to Composer
- name: Add Composer GitHub Token
run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Composer Cache
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ hashFiles('**/composer.lock') }}
composer-
# Install
- name: Install Composer Dependencies
run: composer install --prefer-dist --no-interaction --optimize-autoloader --no-suggest
#
# NODE DEPENDENCIES
#
- name: Node Cache
uses: actions/cache@v4
with:
path: |
node_modules
public/build
public/css
public/js
public/mix-manifest.json
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ hashFiles('**/package-lock.json') }}
npm-
# Install
- name: Install assets
run: npm ci
- name: Compile assets
run: npm run build
- name: Set Environment Variables
uses: allenevans/set-env@v2.0.0
with:
APP_ENV: testing
APP_KEY: base64:wx/g4ayECKlSzOYSguRFoCrsd+KSbAyEiy0J8zWxxyU=
APP_URL: http://127.0.0.1
CACHE_DRIVER: array
DB_HOST: localhost
DB_PORT: 3306
DB_USERNAME: root
DB_PASSWORD: root
DB_DATABASE: nexus
# Run Database Migration
- name: Migrate Database
run: php artisan migrate
# Cache Setup
- name: Cache Routes
run: php artisan route:cache
- name: Clear Config Cache
run: php artisan config:clear
# Start Application
- name: Serve Application
run: php artisan serve -q &
# Run Tests
- name: Execute Tests
run: php artisan test
trigger-deploy:
name: Trigger Deployment
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
#
# DEPLOY (main only)
#
- name: Trigger Deploy workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PAT }}
event-type: deploy-trigger