Skip to content

Commit

Permalink
Merge pull request #35 from ensi-platform/ensitech-74
Browse files Browse the repository at this point in the history
ENSITECH-74
  • Loading branch information
MsNatali authored Jun 26, 2024
2 parents 7a5607d + a740141 commit 56e1eba
Show file tree
Hide file tree
Showing 51 changed files with 491 additions and 1,202 deletions.
37 changes: 0 additions & 37 deletions .git_hooks/external_runtime

This file was deleted.

1 change: 1 addition & 0 deletions .git_hooks/post-checkout/01-install-dependencies.sh
19 changes: 0 additions & 19 deletions .git_hooks/post-checkout/install-dependencies.sh

This file was deleted.

1 change: 1 addition & 0 deletions .git_hooks/post-merge/01-install-dependencies.sh
19 changes: 0 additions & 19 deletions .git_hooks/post-merge/install-dependencies.sh

This file was deleted.

1 change: 1 addition & 0 deletions .git_hooks/pre-commit/01-lint-php.sh
1 change: 1 addition & 0 deletions .git_hooks/pre-commit/02-php-cs-fixer.sh
1 change: 1 addition & 0 deletions .git_hooks/pre-push/01-composer-validate.sh
1 change: 1 addition & 0 deletions .git_hooks/pre-push/02-phpstan.sh
1 change: 1 addition & 0 deletions .git_hooks/pre-push/03-test-code.sh
23 changes: 0 additions & 23 deletions .git_hooks/pre-push/var-dump-checker.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/bin/bash

source $(pwd)/.git_hooks/external_runtime

# validate composer
# Validate composer.json before commit

ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"0;31m"
COL_GREEN=$ESC_SEQ"0;32m"
COL_YELLOW=$ESC_SEQ"0;33m"

echo
echo
printf "$COL_YELLOW%s$COL_RESET\n" "Running pre-push hook: \"composer-validate\""

VALID=$(composer validate --strict --no-check-publish --no-check-all | grep "is valid")
Expand Down
18 changes: 18 additions & 0 deletions .git_hooks/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# - 'composer update' if changed composer.json

ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"0;31m"
COL_GREEN=$ESC_SEQ"0;32m"
COL_YELLOW=$ESC_SEQ"0;33m"

changed_files="$(git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD)"

check_run() {
echo "$changed_files" | grep -q "$1" && echo " * changes detected in $1" && echo " * running $2" && eval "$2"
}

check_run composer.json "composer update"
exit 0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source $(pwd)/.git_hooks/external_runtime
# Lint all added php-files via 'php -l'

ROOT_DIR="$(pwd)/"
LIST=$(git diff-index --cached --name-only --diff-filter=ACMR HEAD)
Expand Down Expand Up @@ -33,13 +33,13 @@ do
fi
done
if [ "$ERRORS_BUFFER" != "" ]; then
echo
echo
echo "These errors were found in try-to-commit files: "
echo -e $ERRORS_BUFFER
echo
echo
printf "$COL_RED%s$COL_RESET\r\n\r\n" "Can't commit, fix errors first."
exit 1
else
echo "Okay"
exit 0
fi
fi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source $(pwd)/.git_hooks/external_runtime
# Check code style via '.php-cs-fixer.php'

EXECUTABLE_NAME=php-cs-fixer
EXECUTABLE_COMMAND=fix
Expand Down
20 changes: 20 additions & 0 deletions .git_hooks/scripts/phpstan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Run composer phpstan

ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"0;31m"
COL_GREEN=$ESC_SEQ"0;32m"
COL_YELLOW=$ESC_SEQ"0;33m"

echo
printf "$COL_YELLOW%s$COL_RESET\n" "Running pre-push hook: \"phpstan\""

if composer phpstan; then
echo "Okay"
exit 0
else
printf "$COL_RED%s$COL_RESET\r\n" "phpstan analysis failed."
exit 1
fi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

source $(pwd)/.git_hooks/external_runtime
# Run composer test

ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
Expand Down
53 changes: 53 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Requirements

If the project maintainer has any additional requirements, you will find them listed here.

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

**Happy coding**!
3 changes: 3 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Security Policy

If you discover any security related issues, please email [email protected] instead of using the issue tracker.
27 changes: 10 additions & 17 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,8 @@ jobs:
fail-fast: true
matrix:
php: [8.1, 8.2, 8.3]
laravel: [8.*, 9.*, 10.*, 11.*]
include:
- laravel: 8.*
testbench: ^6.23
- laravel: 9.*
testbench: 7.*
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
laravel: [9.*, 10.*, 11.*]
exclude:
- laravel: 10.*
php: 8.0

- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1

Expand All @@ -52,7 +38,14 @@ jobs:
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-stable --prefer-dist --no-interaction
- name: Composer Validate
run: ./.git_hooks/scripts/composer-validate.sh

- name: Execute tests
run: vendor/bin/pest
run: composer test-ci

- name: Execute phpstan
run: ./.git_hooks/scripts/phpstan.sh
Loading

0 comments on commit 56e1eba

Please sign in to comment.