Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: workflows #85

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
ij_any_keep_indents_on_empty_lines = false
# quote_type = single

[*.ts]
ij_typescript_force_quote_style = true
ij_typescript_use_double_quotes = false
# ij_typescript_imports_wrap = split_into_lines
ij_typescript_spaces_within_imports = true
ij_typescript_spaces_within_object_type_braces = true
ij_typescript_spaces_within_object_literal_braces = true
quote_type = single

[*.{html,json,twig}]
indent_size = 2
# [*.php]
# indent_size = 4

[*.md]
max_line_length = off
Expand Down
13 changes: 12 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,23 @@ Please delete options that are not relevant.

**Test Configuration**:

- MyAAC Version: (latest: 0.8.15)
- MyAAC Version: (latest: 0.8.16)
- Browser:
- [ ] Chrome
- [ ] Firefox
- [ ] Opera
- [ ] Safari
- [ ] Edge
- [ ] Other
- Operating System:
- [ ] Windows
- [ ] Ubuntu
- [ ] MacOS
- [ ] Other

## Checklist

- [ ] I've created separated branch from main updated
- [ ] My code follows the style guidelines of this project
- [ ] I followed project rules, best practices, and code indentation
- [ ] I have performed a self-review of my own code
Expand Down
4 changes: 3 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- any: ['install/**/*']

"Area: Plugins":
- any: ['plugins/**/*']
- any: ['plugins/**/*', 'payments/**/*']

"Area: System":
- any: ['system/**/*']
Expand All @@ -20,3 +20,5 @@
"Area: Tools":
- any: ['tools/**/*']

"Area: Workflow":
- any: ['./github/**/*']
23 changes: 10 additions & 13 deletions .github/workflows/phplint.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: PHP Linting
on:
pull_request:
branches: [master]
push:
branches: [master]

pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
jobs:
phplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: overtrue/[email protected]
with:
path: .
options: --exclude="system/libs/polyfill-mbstring/bootstrap80.php"
phplint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: overtrue/[email protected]
with:
path: .
options: --exclude="system/libs/polyfill-mbstring/bootstrap80.php"
62 changes: 62 additions & 0 deletions .github/workflows/prettier-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
#---
#name: Format Prettier
#on:
# pull_request:
# types: [ opened, synchronize, reopened, ready_for_review ]
# merge_group:
# push:
# paths:
# - "/**"
#jobs:
# cancel-runs:
# if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main'
# runs-on: ubuntu-latest
# steps:
# - name: Cancel Previous Runs
# uses: styfle/[email protected]
# with:
# access_token: ${{ github.token }}
#
# prettier:
# runs-on: ubuntu-latest
# steps:
# - name: Set up Git
# if: ${{ github.ref != 'refs/heads/main' }}
# run: |
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global user.name "GitHub Actions"
#
# - name: Actions checkout
# if: ${{ github.ref != 'refs/heads/main' }}
# uses: actions/checkout@v3
# with:
# repository: ${{ github.event.pull_request.head.repo.full_name }}
# ref: ${{ github.event.pull_request.head.ref }}
# token: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Setup Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 18
#
# - name: Install Dependencies
# run: npm install --save-dev prettier @prettier/plugin-php husky
#
# - name: Run prettier code format
# run: npm run prettier:format
#
#
## npx prettier --write $(git diff --name-only --diff-filter d | grep -E '\.(php|css|js)$' | xargs) --plugin=@prettier/plugin-php
#
# # npx prettier --write "**/workflow_test/*.{php,css,js}" --plugin=@prettier/plugin-php
#
# - name: Run add and commit
# if: ${{ github.ref != 'refs/heads/main' }}
# uses: EndBug/add-and-commit@v9
# with:
# author_name: GitHub Actions
# author_email: github-actions[bot]@users.noreply.github.com
# message: "PHP code format - (prettier)"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .husky/_/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
36 changes: 36 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
15 changes: 15 additions & 0 deletions .prettierignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Ignore system libs

plugins/
system/libs/PagSeguroLibrary
system/libs/phpmailer
system/libs/polyfill-mbstring
system/libs/pot
system/libs/semver
system/libs/Twig
system/cache
system/php_sessions
node_modules

# Files
login.php
43 changes: 43 additions & 0 deletions .prettierrc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"overrides": [
{
"files": [
"*.php"
],
"options": {
"parser": "php",
"singleQuote": true,
"semi": false,
"tabWidth": 2,
"printWidth": 100,
"trailingComma": "none"
}
},
{
"files": [
"*.css"
],
"options": {
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"semi": true,
"experimentalTernaries": false,
"singleQuote": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "all",
"singleAttributePerLine": false,
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"proseWrap": "preserve",
"insertPragma": true,
"requirePragma": false,
"tabWidth": 2,
"useTabs": false,
"embeddedLanguageFormatting": "auto",
"printWidth": 80
}
}
]
}
Loading