File tree 4 files changed +211
-0
lines changed
4 files changed +211
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Install
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ pull_request :
7
+ branches : [ main ]
8
+
9
+ jobs :
10
+
11
+ install :
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - uses : actions/checkout@v3
16
+
17
+ - name : Setup PHP
18
+ uses : shivammathur/setup-php@v2
19
+ with :
20
+ php-version : ' 8.3'
21
+
22
+ - name : Setup Node.js
23
+ uses : actions/setup-node@v3
24
+ with :
25
+ node-version : ' 20'
26
+
27
+
28
+ - name : Start database
29
+ run : sudo /etc/init.d/mysql start
30
+
31
+ - name : Create database
32
+ run : mysql -e "CREATE DATABASE IF NOT EXISTS liberu;" -uroot -proot
33
+
34
+ - name : Copy environment file
35
+ run : cp .env.testing .env
36
+
37
+ - name : Install dependencies
38
+ run : composer install
39
+
40
+ - name : Generate application key
41
+ run : php artisan key:generate
42
+
43
+ - name : Run database migrations
44
+ run : php artisan migrate
45
+
46
+ - name : Seed database
47
+ run : php artisan db:seed
48
+
49
+ - name : Install npm dependencies
50
+ run : npm install
51
+
52
+ - name : Build frontend assets
53
+ run : npm run build
Original file line number Diff line number Diff line change
1
+ name : Docker
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ pull_request :
7
+ branches : [ main ]
8
+ deployment :
9
+ workflow_dispatch :
10
+
11
+ env :
12
+ DB_DATABASE : liberu
13
+ DB_USERNAME : liberu
14
+ DB_PASSWORD : secret
15
+
16
+ jobs :
17
+ docker :
18
+ if : github.event_name == 'push'
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ -
22
+ name : Login to Docker Hub
23
+ uses : docker/login-action@v3
24
+ with :
25
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
26
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
27
+
28
+ -
29
+ name : Extract metadata (tags, labels) for Docker
30
+ id : meta
31
+ uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
32
+ with :
33
+ images : liberu/genealogy
34
+
35
+ -
36
+ # Setting up Docker Buildx with docker-container driver is required
37
+ # at the moment to be able to use a subdirectory with Git context
38
+ name : Set up Docker Buildx
39
+ uses : docker/setup-buildx-action@v3
40
+
41
+ - name : Build and push Docker image
42
+ uses : docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
43
+ with :
44
+ # context: "{{defaultContext}}:.docker/prod/app/"
45
+ file : Dockerfile
46
+ push : true
47
+ tags : ${{ steps.meta.outputs.tags }}
48
+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change
1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches : [ master ]
6
+ pull_request :
7
+ branches : [ master ]
8
+ deployment :
9
+ workflow_dispatch :
10
+
11
+ env :
12
+ DB_DATABASE : liberu
13
+ DB_USERNAME : liberu
14
+ DB_PASSWORD : secret
15
+
16
+ jobs :
17
+
18
+ phpcpd :
19
+ runs-on : ubuntu-22.04
20
+ steps :
21
+ - uses : actions/checkout@v4
22
+ - uses : shivammathur/setup-php@v2
23
+ with :
24
+ php-version : ' 8.3'
25
+ - name : ' Run Phpcpd'
26
+ run : |
27
+ sudo composer install
28
+ sudo test -f phpcpd.phar || curl -L https://phar.phpunit.de/phpcpd.phar -o phpcpd.phar
29
+ sudo php phpcpd.phar app/
30
+
31
+ php-insights :
32
+ runs-on : ubuntu-22.04
33
+ steps :
34
+ - uses : actions/checkout@v4
35
+ - uses : shivammathur/setup-php@v2
36
+ with :
37
+ php-version : ' 8.3'
38
+ - name : ' Run php-insight'
39
+ run : |
40
+ sudo composer install
41
+ sudo php artisan insights --min-quality=90 --min-complexity=90 --min-architecture=80 --min-style=90 --no-interaction
42
+
43
+ security :
44
+ runs-on : ubuntu-22.04
45
+ steps :
46
+ - uses : actions/checkout@v4
47
+ - uses : shivammathur/setup-php@v2
48
+ with :
49
+ php-version : ' 8.3'
50
+ - name : ' Run php-insight'
51
+ run : |
52
+ 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//')
53
+ 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
54
+ chmod +x ./php-security-checker
55
+ unset PHP_SC_VERSION
56
+ ./php-security-checker
Original file line number Diff line number Diff line change
1
+ name : Tests
2
+
3
+ on :
4
+ push :
5
+ branches : [ main ]
6
+ pull_request :
7
+ branches : [ main ]
8
+
9
+ jobs :
10
+
11
+ tests :
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - uses : actions/checkout@v3
16
+
17
+ - name : Setup PHP
18
+ uses : shivammathur/setup-php@v2
19
+ with :
20
+ php-version : ' 8.3'
21
+
22
+
23
+ - name : Start database
24
+ run : sudo /etc/init.d/mysql start
25
+
26
+ - name : Create database
27
+ run : mysql -e "CREATE DATABASE IF NOT EXISTS liberu;" -uroot -proot
28
+
29
+ - name : Copy environment file
30
+ run : cp .env.testing .env
31
+
32
+ - name : Install dependencies
33
+ run : composer install
34
+
35
+ - name : Generate application key
36
+ run : php artisan key:generate
37
+
38
+ - name : Run database migrations
39
+ run : php artisan migrate
40
+
41
+ - name : Seed database
42
+ run : php artisan db:seed
43
+
44
+ - name : Run tests
45
+ run : vendor/bin/phpunit --coverage-clover=coverage.xml
46
+ - name : Upload coverage to Codecov
47
+ uses : codecov/codecov-action@v3
48
+ with :
49
+ token : ${{ secrets.CODECOV_TOKEN }}
50
+ files : ./coverage.xml
51
+ flags : unittests
52
+ name : codecov-umbrella
53
+ fail_ci_if_error : true
54
+ run : vendor/bin/phpunit --coverage-clover=coverage.xml
You can’t perform that action at this time.
0 commit comments