Skip to content

Commit

Permalink
Merge pull request #6 from Codeinwp/development
Browse files Browse the repository at this point in the history
Initial Version
  • Loading branch information
HardeepAsrani authored Feb 28, 2024
2 parents b5727d5 + 9d29734 commit ce06263
Show file tree
Hide file tree
Showing 41 changed files with 24,024 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Browsers that we support

last 1 version
> 1%
not ie > 0
not ie_mob > 0
not dead
37 changes: 37 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.git
.distignore
.gitignore
.travis.yml
.jshintrc
Gruntfile.js
phpcs.xml
.eslintrc
.gitattributes
.releaserc.yml
.DS_Store
.editorconfig
.browserslistrc
postcss.config.js
docker-compose.yml
webpack.config.js
CONTRIBUTING.md
package.json
composer.json
composer.lock
package-lock.json
themeisle-hash.json
npm-debug.log
phpstan.neon
tailwind.config.js
/grunt
/node_modules
/logs
/.github
/.wordpress-org
/.idea
/src
/bin
/tests
/phpunit.xml
/dist
/artifact
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
66 changes: 66 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": "wordpress",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2021,
"sourceType": "module"
},
"ignorePatterns": [ "node_modules", "assets" ],
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"prefer-destructuring": [
"warn",
{
"array": false,
"object": true
},
{
"enforceForRenamedProperties": false
}
],
"array-bracket-spacing": [
"warn",
"always",
{
"arraysInArrays": false,
"objectsInArrays": false
}
],
"key-spacing": [
"warn",
{
"beforeColon": false,
"afterColon": true
}
],
"object-curly-spacing": [
"warn",
"always",
{
"arraysInObjects": true,
"objectsInObjects": false
}
],
}
}
100 changes: 100 additions & 0 deletions .github/workflows/create-build-url.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build and publish the ZIP build file

on:
pull_request:
types: [opened, synchronize, ready_for_review]
branches-ignore:
- 'update_dependencies'
jobs:
dev-zip:
name: Build ZIP and upload to s3
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
outputs:
branch-name: ${{ steps.retrieve-branch-name.outputs.branch_name }}
git-sha-8: ${{ steps.retrieve-git-sha-8.outputs.sha8 }}
steps:
- name: Check out source files
uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Configure Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer deps
run: composer install --no-dev --prefer-dist --no-progress --no-suggest
- name: Install npm deps
run: npm ci
- name: Build files
run: npm run build
- name: Create zip
run: npm run dist
- name: Retrieve branch name
id: retrieve-branch-name
run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')"
- name: Retrieve git SHA-8 string
id: retrieve-git-sha-8
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Upload Latest Version to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_DEV_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_KEY_ARTIFACTS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_ARTIFACTS }}
SOURCE_DIR: artifact/
DEST_DIR: ${{ github.event.pull_request.base.repo.name }}-${{ steps.retrieve-branch-name.outputs.branch_name }}-${{ steps.retrieve-git-sha-8.outputs.sha8 }}/

comment-on-pr:
name: Comment on PR with links to plugin ZIPs
if: ${{ github.head_ref && github.head_ref != null }}
runs-on: ubuntu-latest
needs: dev-zip
env:
CI: true
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
outputs:
pr_number: ${{ steps.get-pr-number.outputs.num }}
comment_body: ${{ steps.get-comment-body.outputs.body }}
steps:
- name: Get PR number
id: get-pr-number
run: echo "::set-output name=num::$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')"

- name: Check if a comment was already made
id: find-comment
uses: peter-evans/find-comment@v2
with:
issue-number: ${{ steps.get-pr-number.outputs.num }}
comment-author: github-actions[bot]
body-includes: Download QuickWP - [Download]

- name: Get comment body
id: get-comment-body
run: |
body="Plugin build for ${{ github.event.pull_request.head.sha }} is ready :bellhop_bell:!
- Download QuickWP - [Download](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/quickwp.zip)"
body="${body//$'\n'/'%0A'}"
echo "::set-output name=body::$body"
- name: Create comment on PR with links to plugin builds
if: ${{ steps.find-comment.outputs.comment-id == '' }}
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ steps.get-pr-number.outputs.num }}
body: ${{ steps.get-comment-body.outputs.body }}

- name: Update comment on PR with links to plugin builds
if: ${{ steps.find-comment.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.get-comment-body.outputs.body }}
29 changes: 29 additions & 0 deletions .github/workflows/test-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test JS

on:
pull_request:
types: [opened, synchronize, ready_for_review]

jobs:
run:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
strategy:
matrix:
node-version: [20.x]
name: JS Test
steps:
- uses: actions/checkout@master
with:
persist-credentials: false
- name: Build files using ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Lint js files
run: |
npm install -g npm
npm ci
npm run lint:js
env:
CI: true
62 changes: 62 additions & 0 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test PHP

on:
pull_request:
types: [opened, synchronize, ready_for_review]

jobs:
phplint:
name: PHPLint
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
steps:
- name: Setup PHP version
uses: shivammathur/setup-php@v1
with:
php-version: '7.4'
extensions: simplexml
- name: Checkout source code
uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run PHPCS
run: composer run lint

phpstan:
name: PHPStan
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
steps:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: simplexml, mysql
- name: Checkout source code
uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Setup Composer cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install composer
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPStan Static Analysis
run: composer phpstan
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.idea
node_modules
logs
dist
build
artifact
vendor
.DS_Store
.vscode
todo.md
artifacts
*.results.json
.phpunit.result.cache
.fleet
26 changes: 26 additions & 0 deletions bin/dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

BUILD_VERSION=$(node -pe "require('./package.json').version")
export BUILD_VERSION
BUILD_NAME=$(node -pe "require('./package.json').name")
export BUILD_NAME

echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_ENV
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV

if [ ! -d "dist" ]; then
mkdir "dist"
fi

if [ ! -d "artifact" ]; then
mkdir "artifact"
fi

# Take all the files, filter the dev ones (e.g. node_modules, src), and save the result to './dist'
rsync -rc --exclude-from ".distignore" "./" "dist/$BUILD_NAME"

cd dist
# Create a zip file in './artifact' from the filtered files in the './dist'
zip -r "../artifact/$BUILD_NAME" "./$BUILD_NAME/"
cd -

Loading

0 comments on commit ce06263

Please sign in to comment.