Skip to content

Commit

Permalink
Merge pull request #3559 from 10up/feature/ci-container
Browse files Browse the repository at this point in the history
Initial version of ElasticPress DI Container
  • Loading branch information
felipeelia authored Jul 28, 2023
2 parents b3a4d07 + 0dc5cf5 commit e676057
Show file tree
Hide file tree
Showing 15 changed files with 463 additions and 66 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/gulp-tasks export-ignore
/lang export-ignore
/tests export-ignore
/vendor/ export-ignore
/node_modules export-ignore

/.babelrc export-ignore
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-and-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0' # Minimum required version
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: install node v18
uses: actions/setup-node@v3
with:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: E2E Test

env:
COMPOSER_VERSION: "2"
COMPOSER_CACHE: "${{ github.workspace }}/.composer-cache"
NODE_VERSION: "18"
NODE_CACHE: "${{ github.workspace }}/node_modules_cache"

Expand Down Expand Up @@ -37,6 +39,24 @@ jobs:
restore-keys: |
npm-${{ env.NODE_VERSION }}-
- name: Prepare composer cache
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0'
tools: cs2pr
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -101,6 +121,24 @@ jobs:
restore-keys: |
npm-${{ env.NODE_VERSION }}-
- name: Prepare composer cache
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ env.COMPOSER_VERSION }}-
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0'
tools: cs2pr
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: "Install node v${{ env.NODE_VERSION }}"
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: cs2pr
coverage: none

- name: composer install
run: composer install
run: composer install --ignore-platform-reqs

- name: PHPCS check
run: './vendor/bin/phpcs . -q --report=checkstyle --runtime-set testVersion 7.0- | cs2pr'
49 changes: 49 additions & 0 deletions .github/workflows/test-build-with-vendor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build with vendor (test)

on:
pull_request:
branches:
- develop
- '[0-9].[0-9x]*' # Version branches: 4.x.x, 4.1.x, 5.x

jobs:
wordpress:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.0' # Minimum required version
coverage: none

- name: composer install
run: composer install --no-dev -o

- name: install node v18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Build
run: |
npm ci
npm run build
- name: Setup
run: 'echo "VERSION=$(grep -Po ''\"version\": \"[0-9\\.]+\"'' package.json | grep -Po ''[0-9\\.]+'')" >> $GITHUB_ENV'

- name: Zip
run: npm run build:zip

- name: Make artifacts available
uses: actions/upload-artifact@v3
with:
name: cypress-artifact
retention-days: 2
path: |
${{ github.workspace }}/elasticpress.zip
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none

- name: Install dependencies
run: composer install
run: composer install --ignore-platform-reqs

- name: Setup WP Tests
run: |
Expand Down Expand Up @@ -108,11 +108,11 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none

- name: Install dependencies
run: composer install
run: composer install --ignore-platform-reqs

- name: Setup WP Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion bin/build-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ npm run build
rm ./elasticpress.zip

git archive --output=elasticpress.zip HEAD
zip -ur elasticpress.zip dist
zip -ur elasticpress.zip dist vendor
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
],
"require": {
"php": ">=7.0",
"composer/installers": "^1.0 || ^2.0"
"composer/installers": "^1.0 || ^2.0",
"psr/container": "^1.0 || ^2.0"
},
"require-dev": {
"10up/phpcs-composer": "dev-master",
"wpackagist-plugin/woocommerce":"*",
"phpunit/phpunit": "^9.5",
"phpcompatibility/phpcompatibility-wp": "*",
"yoast/phpunit-polyfills": "^1.0"
},
Expand All @@ -54,6 +54,9 @@
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "7.0"
}
}
}
Loading

0 comments on commit e676057

Please sign in to comment.