Skip to content

Commit 710a5eb

Browse files
Merge pull request #121 from Hi-Folks/develop
v0.4.4
2 parents d990674 + 7279f21 commit 710a5eb

12 files changed

+339
-10
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: hifolks/gh-actions-yaml-generator
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
- features/**
8+
9+
jobs:
10+
laravel-tests:
11+
runs-on: ubuntu-latest
12+
# Service container Mysql mysql
13+
services:
14+
# Label used to access the service container
15+
mysql:
16+
# Docker Hub image (also with version)
17+
image: mysql:5.7
18+
env:
19+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20+
MYSQL_DATABASE: db_test_laravel
21+
## map the "external" 33306 port with the "internal" 3306
22+
ports:
23+
- 33306:3306
24+
# Set health checks to wait until mysql database has started (it takes some seconds to start)
25+
options: >-
26+
--health-cmd="mysqladmin ping"
27+
--health-interval=10s
28+
--health-timeout=5s
29+
--health-retries=3
30+
31+
strategy:
32+
matrix:
33+
operating-system: [ubuntu-latest]
34+
php-versions: [ '7.4','8.0' ]
35+
dependency-stability: [ 'prefer-none' ]
36+
37+
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: '16.x'
45+
- name: Install NPM packages
46+
run: npm ci
47+
- name: Build frontend
48+
run: npm run development
49+
- name: Install PHP versions
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: ${{ matrix.php-versions }}
53+
- name: Copy .env
54+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
55+
- name: Install Dependencies
56+
if: steps.vendor-cache.outputs.cache-hit != 'true'
57+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
58+
59+
- name: Update Dependencies with latest stable
60+
if: matrix.dependency-stability == 'prefer-stable'
61+
run: composer update --prefer-stable
62+
- name: Update Dependencies with lowest stable
63+
if: matrix.dependency-stability == 'prefer-lowest'
64+
run: composer update --prefer-stable --prefer-lowest
65+
66+
- name: Generate key
67+
run: php artisan key:generate
68+
- name: Directory Permissions
69+
run: chmod -R 777 storage bootstrap/cache
70+
- name: Run Migrations
71+
# Set environment
72+
env:
73+
DB_CONNECTION: mysql
74+
DB_DATABASE: db_test_laravel
75+
DB_PORT: 33306
76+
DB_USER: root
77+
78+
run: php artisan migrate
79+
80+
- name: Show dir
81+
run: pwd
82+
- name: PHP Version
83+
run: php --version
84+
85+
# Code quality
86+
- name: Execute tests (Unit and Feature tests) via PHPUnit
87+
# Set environment
88+
env:
89+
DB_CONNECTION: mysql
90+
DB_DATABASE: db_test_laravel
91+
DB_PORT: 33306
92+
DB_USER: root
93+
94+
run: vendor/bin/phpunit --testdox
95+
96+
97+
- name: Execute Code Sniffer via phpcs
98+
run: |
99+
vendor/bin/phpcs --standard=PSR12 app
100+
101+
- name: Execute Code Static Analysis (PHP Stan + Larastan)
102+
run: |
103+
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
104+
105+
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: hifolks/gh-actions-yaml-generator
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- develop
7+
- features/**
8+
9+
jobs:
10+
laravel-tests:
11+
runs-on: ubuntu-latest
12+
# Service container Mysql mysql
13+
services:
14+
# Label used to access the service container
15+
mysql:
16+
# Docker Hub image (also with version)
17+
image: mysql:5.7
18+
env:
19+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20+
MYSQL_DATABASE: db_test_laravel
21+
## map the "external" 33306 port with the "internal" 3306
22+
ports:
23+
- 33306:3306
24+
# Set health checks to wait until mysql database has started (it takes some seconds to start)
25+
options: >-
26+
--health-cmd="mysqladmin ping"
27+
--health-interval=10s
28+
--health-timeout=5s
29+
--health-retries=3
30+
31+
strategy:
32+
matrix:
33+
operating-system: [ubuntu-latest]
34+
php-versions: [ '7.4','8.0' ]
35+
dependency-stability: [ 'prefer-none' ]
36+
37+
name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v1
43+
with:
44+
node-version: '16.x'
45+
- name: Install NPM packages
46+
run: npm ci
47+
- name: Build frontend
48+
run: npm run development
49+
- name: Install PHP versions
50+
uses: shivammathur/setup-php@v2
51+
with:
52+
php-version: ${{ matrix.php-versions }}
53+
- name: Copy .env
54+
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
55+
- name: Install Dependencies
56+
if: steps.vendor-cache.outputs.cache-hit != 'true'
57+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
58+
59+
- name: Update Dependencies with latest stable
60+
if: matrix.dependency-stability == 'prefer-stable'
61+
run: composer update --prefer-stable
62+
- name: Update Dependencies with lowest stable
63+
if: matrix.dependency-stability == 'prefer-lowest'
64+
run: composer update --prefer-stable --prefer-lowest
65+
66+
- name: Generate key
67+
run: php artisan key:generate
68+
- name: Directory Permissions
69+
run: chmod -R 777 storage bootstrap/cache
70+
- name: Run Migrations
71+
# Set environment
72+
env:
73+
DB_CONNECTION: mysql
74+
DB_DATABASE: db_test_laravel
75+
DB_PORT: 33306
76+
DB_USER: root
77+
78+
run: php artisan migrate
79+
80+
- name: Show dir
81+
run: pwd
82+
- name: PHP Version
83+
run: php --version
84+
85+
# Code quality
86+
- name: Execute tests (Unit and Feature tests) via PHPUnit
87+
# Set environment
88+
env:
89+
DB_CONNECTION: mysql
90+
DB_DATABASE: db_test_laravel
91+
DB_PORT: 33306
92+
DB_USER: root
93+
94+
run: vendor/bin/phpunit --testdox
95+
96+
97+
- name: Execute Code Sniffer via phpcs
98+
run: |
99+
vendor/bin/phpcs --standard=PSR12 app
100+
101+
- name: Execute Code Static Analysis (PHP Stan + Larastan)
102+
run: |
103+
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
104+
105+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ public/mix-manifest.json
2020

2121
/output/
2222
/.vscode/
23+
result.sarif

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.4.4 - WIP
4+
It's still Hacktoberfest!
5+
- Welcome --save option for CLI (you can define the filename of the workflow file);
6+
- Set automatically the workflow filename for auto generation (to much automation ;) with --save=auto option
7+
- Twitter card :)
8+
39
## 0.4.3 - 2021-10-19
410
It is still Hacktoberfest!
511
- Psalm, create Sarif report for GitHub code scanning integration

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ This "magic" command, will extract information from:
5252
- ... and other assets
5353
- in order to guess a configuration for your GitHub Actions workflow.
5454

55+
By default the command will show the Yaml workflow file in the standard output. If you want to save it in a file for example "my-workflow.yml" you can use --save option:
56+
```shell
57+
php artisan ghygen:generate --save=my-workflow.yml
58+
```
59+
60+
If you want to autogenerate Yaml file in the .github/workflows directory use --save=auto
61+
```shell
62+
php artisan ghygen:generate --save=auto
63+
```
64+
The file name will be created with the name found in composer.json (slugified).
65+
66+
So if you are *superlazy* and want to generate the workflow for the project in the directory ../myproject , you can execute:
67+
```shell
68+
php artisan ghygen:generate --projectdir=../myproject/ --save=auto
69+
```
70+
71+
5572
## Install
5673
Clone source code, enter the new directory and perform a couple of instructions:
5774
```shell

0 commit comments

Comments
 (0)