-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (118 loc) · 3.7 KB
/
ci.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on: [push]
env:
PHP_VERSION: "8.1"
PHP_EXTENSIONS: "xdebug, zip, xmlwriter, xmlreader, xml, tokenizer, pdo, phar, openssl, pcre, simplexml, gd, dom, curl"
NODE_VERSION: "19"
jobs:
codestyle:
name: Code style
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{env.PHP_VERSION}}
extensions: ${{env.PHP_EXTENSIONS}}
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Easy coding Standard
run: vendor/bin/ecs check --config=ecs.php --no-progress-bar
frontend:
name: Front-end test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
- name: Install yarn dependencies
run: yarn install
- name: Compile assets
run: |
yarn prod
tests:
name: PHP tests
runs-on: ubuntu-latest
env:
MYSQL_USER: ranonkeltje
MYSQL_PASSWORD: ranonkeltje
MYSQL_DATABASE: aas2
MYSQL_ROOT_PASSWORD: ranonkeltje
services:
mariadb:
image: mariadb:10
ports:
- 3306
env:
MYSQL_USER: ranonkeltje
MYSQL_PASSWORD: ranonkeltje
MYSQL_DATABASE: aas2
MYSQL_ROOT_PASSWORD: ranonkeltje
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{env.PHP_VERSION}}
extensions: ${{env.PHP_EXTENSIONS}}
coverage: xdebug
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Setup project
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
envsubst < .env.github > .env
php artisan key:generate
php artisan env
php artisan migrate --seed
- name: Run unit tests
run: vendor/bin/phpunit
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [tests, codestyle, frontend]
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/feature/github-actions'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
- name: Install yarn dependencies
run: yarn install
- name: Compile assets
run: |
yarn prod
- name: Move assets for transport
run: "mkdir deploy-unit && mv -t deploy-unit public/css public/js public/fonts"
- name: Upload assets
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.FTP_HOSTNAME }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: "./deploy-unit/"
server-dir: ${{ secrets.FTP_REMOTE_DIR }}
- name: Deploy application
id: req
uses: fjogeleit/http-request-action@master
with:
url: https://aas2.anderwijs.nl/updater/update?secret=${{ secrets.UPDATER_SECRET }}
method: GET
timeout: 60000
preventFailureOnNoResponse: true
- name: Show response
run: echo ${{ steps.req.outputs.response }}