-
Notifications
You must be signed in to change notification settings - Fork 278
130 lines (123 loc) · 3.84 KB
/
main.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
deployment:
workflow_dispatch:
env:
DB_DATABASE: enso
DB_USERNAME: enso
DB_PASSWORD: secret
jobs:
yarn:
runs-on: ubuntu-20.04
env:
NODE_OPTIONS: --max_old_space_size=3072
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: borales/[email protected]
- uses: actions/setup-node@v2
with:
node-version: '16'
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'test node'
run: node -v
- name: 'install & build'
run: |
sudo composer install
sed -i 's/GOOGLE_ANALITICS_TOKEN/${{ secrets.GOOGLE_ANALITICS_TOKEN }}/g' resources/views/stubs/production-index.blade.stub
sudo cp -f resources/views/stubs/production-index.blade.stub vendor/laravel-enso/core/stubs
cd client
cp .env.example .env
yarn install
yarn build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: resources
path: |
public/css/
public/js/
public/images/
resources/views
phpunit:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'PhpUnit'
run: |
sudo composer install
sudo php artisan test
phpcpd:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'Run Phpcpd'
run: |
sudo composer install
sudo test -f phpcpd.phar || curl -L https://phar.phpunit.de/phpcpd.phar -o phpcpd.phar
sudo php phpcpd.phar app/
php-insights:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'Run php-insight'
run: |
sudo composer install
sudo php artisan insights --min-quality=90 --min-complexity=90 --min-architecture=80 --min-style=90 --no-interaction
security:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'Run php-insight'
run: |
PHP_SC_VERSION=$(curl -s "https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/^v//')
curl -LSs https://github.com/fabpot/local-php-security-checker/releases/download/v${PHP_SC_VERSION}/local-php-security-checker_${PHP_SC_VERSION}_linux_amd64 > ./php-security-checker
chmod +x ./php-security-checker
unset PHP_SC_VERSION
./php-security-checker
migration:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mirromutth/[email protected]
with:
mysql database: ${{env.DB_DATABASE}}
mysql user: ${{env.DB_USERNAME}}
mysql password: ${{env.DB_PASSWORD}}
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: 'Run migration'
run: |
sudo composer install
php artisan migrate --force
deploy:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'deployment' || github.event_name == 'push' }}
needs: [phpunit, phpcpd, migration, yarn, security, php-insights]
steps:
- uses: actions/checkout@v2
- name: 'Trig envoyer'
run: |
curl ${{ secrets.DEPLOY_WEBHOOK }}