Skip to content

Commit

Permalink
Merge pull request #121 from Hi-Folks/develop
Browse files Browse the repository at this point in the history
v0.4.4
  • Loading branch information
roberto-butti authored Oct 21, 2021
2 parents d990674 + 7279f21 commit 710a5eb
Show file tree
Hide file tree
Showing 12 changed files with 339 additions and 10 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/hifolksgh_actions_yaml_generator-20211021-194142.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: hifolks/gh-actions-yaml-generator
on:
push:
branches:
- main
- develop
- features/**

jobs:
laravel-tests:
runs-on: ubuntu-latest
# Service container Mysql mysql
services:
# Label used to access the service container
mysql:
# Docker Hub image (also with version)
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: db_test_laravel
## map the "external" 33306 port with the "internal" 3306
ports:
- 33306:3306
# Set health checks to wait until mysql database has started (it takes some seconds to start)
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '7.4','8.0' ]
dependency-stability: [ 'prefer-none' ]

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install NPM packages
run: npm ci
- name: Build frontend
run: npm run development
- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Update Dependencies with latest stable
if: matrix.dependency-stability == 'prefer-stable'
run: composer update --prefer-stable
- name: Update Dependencies with lowest stable
if: matrix.dependency-stability == 'prefer-lowest'
run: composer update --prefer-stable --prefer-lowest

- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Run Migrations
# Set environment
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: 33306
DB_USER: root

run: php artisan migrate

- name: Show dir
run: pwd
- name: PHP Version
run: php --version

# Code quality
- name: Execute tests (Unit and Feature tests) via PHPUnit
# Set environment
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: 33306
DB_USER: root

run: vendor/bin/phpunit --testdox


- name: Execute Code Sniffer via phpcs
run: |
vendor/bin/phpcs --standard=PSR12 app
- name: Execute Code Static Analysis (PHP Stan + Larastan)
run: |
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
105 changes: 105 additions & 0 deletions .github/workflows/hifolksgh_actions_yaml_generator-20211021-205930.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: hifolks/gh-actions-yaml-generator
on:
push:
branches:
- main
- develop
- features/**

jobs:
laravel-tests:
runs-on: ubuntu-latest
# Service container Mysql mysql
services:
# Label used to access the service container
mysql:
# Docker Hub image (also with version)
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: db_test_laravel
## map the "external" 33306 port with the "internal" 3306
ports:
- 33306:3306
# Set health checks to wait until mysql database has started (it takes some seconds to start)
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '7.4','8.0' ]
dependency-stability: [ 'prefer-none' ]

name: P${{ matrix.php-versions }} - L${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}

steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install NPM packages
run: npm ci
- name: Build frontend
run: npm run development
- name: Install PHP versions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Update Dependencies with latest stable
if: matrix.dependency-stability == 'prefer-stable'
run: composer update --prefer-stable
- name: Update Dependencies with lowest stable
if: matrix.dependency-stability == 'prefer-lowest'
run: composer update --prefer-stable --prefer-lowest

- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Run Migrations
# Set environment
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: 33306
DB_USER: root

run: php artisan migrate

- name: Show dir
run: pwd
- name: PHP Version
run: php --version

# Code quality
- name: Execute tests (Unit and Feature tests) via PHPUnit
# Set environment
env:
DB_CONNECTION: mysql
DB_DATABASE: db_test_laravel
DB_PORT: 33306
DB_USER: root

run: vendor/bin/phpunit --testdox


- name: Execute Code Sniffer via phpcs
run: |
vendor/bin/phpcs --standard=PSR12 app
- name: Execute Code Static Analysis (PHP Stan + Larastan)
run: |
vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ public/mix-manifest.json

/output/
/.vscode/
result.sarif
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.4.4 - WIP
It's still Hacktoberfest!
- Welcome --save option for CLI (you can define the filename of the workflow file);
- Set automatically the workflow filename for auto generation (to much automation ;) with --save=auto option
- Twitter card :)

## 0.4.3 - 2021-10-19
It is still Hacktoberfest!
- Psalm, create Sarif report for GitHub code scanning integration
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ This "magic" command, will extract information from:
- ... and other assets
- in order to guess a configuration for your GitHub Actions workflow.

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:
```shell
php artisan ghygen:generate --save=my-workflow.yml
```

If you want to autogenerate Yaml file in the .github/workflows directory use --save=auto
```shell
php artisan ghygen:generate --save=auto
```
The file name will be created with the name found in composer.json (slugified).

So if you are *superlazy* and want to generate the workflow for the project in the directory ../myproject , you can execute:
```shell
php artisan ghygen:generate --projectdir=../myproject/ --save=auto
```


## Install
Clone source code, enter the new directory and perform a couple of instructions:
```shell
Expand Down
Loading

0 comments on commit 710a5eb

Please sign in to comment.