Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ayment into dev
  • Loading branch information
[email protected] authored and [email protected] committed Jun 17, 2024
2 parents 25dc0f9 + 9fadd09 commit ddecfa4
Show file tree
Hide file tree
Showing 63 changed files with 3,295 additions and 6,517 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[*.yml]
indent_size = 2
tab_width = 2

[*.blade.php]
ij_blade_keep_indents_on_empty_lines = false

Expand Down
53 changes: 25 additions & 28 deletions .github/workflows/code_standarts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ run-name: Check code standarts

on:
pull_request:
types: [opened, reopened, synchronize]
branches: [ "master", "dev" ]
types: [ opened, reopened, synchronize ]
branches: [ "master", "dev" ]

permissions:
contents: write
Expand All @@ -14,31 +14,28 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Get composer cache directory
- id: get-composer-cache-directory
name: Get Composer caches directory path
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash

# Mount composer cache directory
- id: mount-composer-cache-directory
name: Mount composer cache directory
uses: actions/cache@v3
with:
path: ${{ steps.get-composer-cache-directory.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- uses: actions/checkout@v4

- name: Get Composer caches directory path
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
shell: bash

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
${{ runner.os }}-composer-
# Install composer deps, if .lock file was changed
- id: install-composer-dependencies
name: Install composer dependencies
run: composer install --prefer-dist --no-progress
shell: bash

- name: PHP Code Standarts
run: |
chmod +x ./bin/phpcs.sh
./bin/phpcs.sh -full
shell: bash
- id: install-composer-dependencies
name: Install composer dependencies
run: composer install --prefer-dist --no-progress
shell: bash

- name: PHP Code Standarts
run: |
chmod +x ./bin/phpcs.sh
./bin/phpcs.sh -full
shell: bash
79 changes: 79 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Deploy Plugin to Test Site

on:
workflow_dispatch:
push:
branches:
- '*'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Bun
run: npm install -g bun

- name: Get code
uses: actions/checkout@v4

- name: Extract branch name
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Get Composer caches directory path
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
shell: bash

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
${{ runner.os }}-composer-
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: node_modules
key: "${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}"
restore-keys: |
${{ runner.os }}-node-
- name: Cache vite dependencies
uses: actions/cache@v4
with:
path: vite/node_modules
key: "${{ runner.os }}-vite-${{ hashFiles('vite/bun.lockb') }}"
restore-keys: |
${{ runner.os }}-vite-
- name: Update Plugin Name
run: |
export TZ=Europe/Moscow
BRANCH_NAME=${{ env.BRANCH_NAME }}
CURRENT_DATE=$(date +"%d.%m.%Y %H:%M:%S")
sed -i "s/\(Plugin Name: .*\)/\1 (${BRANCH_NAME})/" reepay-woocommerce-payment.php
sed -i "s/\(Description: .*\)/\1 (Upload date: ${CURRENT_DATE})/" reepay-woocommerce-payment.php
- name: Build and zip project
run: |
chmod +x ./bin/zip.sh
./bin/zip.sh
shell: bash

- name: Deploy code via SSH
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_NAME }}
password: ${{ secrets.DEPLOY_PASSWORD }}
source: "build/reepay-woocommerce-payment/*"
target: public_html/wp-content/plugins/billwerk-woocommerce-payment-${{ env.BRANCH_NAME }}
rm: true
overwrite: true
strip_components: 2
90 changes: 53 additions & 37 deletions .github/workflows/download.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Download
run-name: Download

on: [workflow_dispatch]
on: [ workflow_dispatch ]

permissions:
contents: write

Expand All @@ -12,40 +12,56 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Get composer cache directory
- id: get-composer-cache-directory
name: Get Composer caches directory path
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
shell: bash

# Mount composer cache directory
- id: mount-composer-cache-directory
name: Mount composer cache directory
uses: actions/cache@v3
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install Bun
run: npm install -g bun

- uses: actions/checkout@v4

- name: Get Composer caches directory path
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
shell: bash

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.get-composer-cache-directory.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

# Mount composer cache directory
- id: mount-npm-cache-directory
name: Mount npm cache directory
uses: actions/cache@v3
path: ${{ env.COMPOSER_CACHE_DIR }}
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
${{ runner.os }}-composer-
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: "${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}"
restore-keys: |
${{ runner.os }}-node-
- name: Cache vite dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
vite/node_modules
key: "${{ runner.os }}-vite-${{ hashFiles('vite/bun.lockb') }}"
restore-keys: |
${{ runner.os }}-vite-
- name: Build and zip project
run: |
chmod +x ./bin/zip.sh
./bin/zip.sh
shell: bash

- name: Add archive to artifacts
uses: actions/upload-artifact@v3
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- name: Build and zip project
run: |
chmod 777 ./bin/zip.sh
sudo bash ./bin/zip.sh
shell: bash

- name: Add archive to artifacts
uses: actions/upload-artifact@v3
with:
name: reepay-woocommerce-payment
path: ./build/reepay-woocommerce-payment/
name: reepay-woocommerce-payment
path: ./build/reepay-woocommerce-payment/
61 changes: 31 additions & 30 deletions .github/workflows/phpunit_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,47 @@ run-name: PHPUnit - Dev

on:
pull_request:
types: [opened, reopened, synchronize]
types: [ opened, reopened, synchronize ]
branches: [ "dev" ]

jobs:
run:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.4', '8.0', '8.1', '8.2']
operating-system: [ ubuntu-latest ]
php-versions: [ '7.4', '8.0', '8.1', '8.2' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl #optional, setup extensions
ini-values-csv: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL

- name: Check PHP Version
run: php -v

- name: Composer install
run: |
- name: Checkout
# @TODO update version
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extension-csv: mbstring, intl #optional, setup extensions
ini-values-csv: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL

- name: Check PHP Version
run: php -v

- name: Composer install
run: |
composer update
composer install --optimize-autoloader --prefer-dist
- name: Set up MySQL
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql --user="root" --password="root" --execute="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: Install WP Tests
run: bash bin/install-wp-tests.sh wordpress_test root root
- name: phpunit tests
run: npm run phpunit
sudo /etc/init.d/mysql start
mysql --user="root" --password="root" --execute="ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
- name: Install WP Tests
run: bash bin/install-wp-tests.sh wordpress_test root root

- name: phpunit tests
run: npm run phpunit
Loading

0 comments on commit ddecfa4

Please sign in to comment.