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

Fix webpack options. #6

Merged
merged 2 commits into from
Dec 13, 2024
Merged
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
107 changes: 56 additions & 51 deletions .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,55 @@ on:
- master

jobs:
test:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ] # OS. ubuntu-18.04 is also available.
php: [ '7.2', '7.4', '8.0' ] # PHP versions to check.
wp: [ 'latest', '5.9' ] # WordPress version to check.
services:
mysql:
image: mysql:8.0
options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10
ports:
- 3306/tcp
env:
MYSQL_ROOT_PASSWORD: root
name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest
steps:
- uses: actions/checkout@master

- name: Setup PHP with composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-suggest

- name: Start MySQL
run: |
sudo systemctl start mysql
mysql -h 127.0.0.1 --port 3306 -u root --password=root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"

- name: Install WordPress
run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }}

- name: Check PHP syntax
run: composer lint

- name: PHPUnit Test
run: composer test
# test:
# runs-on: ${{ matrix.operating-system }}
# strategy:
# matrix:
# operating-system: [ ubuntu-latest ] # OS. ubuntu-18.04 is also available.
# php: [ '7.2', '7.4', '8.0' ] # PHP versions to check.
# wp: [ 'latest', '5.9' ] # WordPress version to check.
# services:
# mysql:
# image: mysql:8.0
# options: --health-cmd "mysqladmin ping --host 127.0.0.1 --port 3306" --health-interval 20s --health-timeout 10s --health-retries 10
# ports:
# - 3306/tcp
# env:
# MYSQL_ROOT_PASSWORD: root
# name: WordPress ${{ matrix.wp }} in PHP ${{ matrix.php }} UnitTest
# steps:
# - uses: actions/checkout@master
#
# - name: Setup PHP with composer
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php }}
# tools: composer
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Validate composer.json and composer.lock
# run: composer validate
#
# - name: Install dependencies
# run: composer install --prefer-dist --no-suggest
#
# - name: Start MySQL
# run: |
# sudo systemctl start mysql
# mysql -h 127.0.0.1 --port 3306 -u root --password=root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';"
#
# - name: Install WordPress
# run: bash bin/install-wp-tests.sh wordpress root root 127.0.0.1:3306 ${{ matrix.wp }}
#
# - name: PHPUnit Test
# run: composer test

lint:
name: PHP Syntax Check
uses: tarosky/workflows/.github/workflows/phpcs.yml@main
with:
version: 7.4

assets:
name: Assets Test
Expand All @@ -67,7 +70,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@master
with:
node-version: '14'
node-version: '18'

- name: Install NPM Packages
run: npm install
Expand All @@ -77,11 +80,13 @@ jobs:

status-check:
name: Status Check
needs: [ test, assets ]
needs: [ lint, assets ]
if: always()
runs-on: ubuntu-latest
steps:
- name: Status Check
run: echo "All tests passed!"
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

release:
name: Deploy WordPress.org
Expand All @@ -103,7 +108,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@master
with:
node-version: '14'
node-version: '18'

- name: Build Plugin
run: bash bin/build.sh ${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gulp.task( 'sass', function () {
} ) )
.pipe( $.sassGlob() )
.pipe( $.sourcemaps.init() )
.pipe( $.sass( {
.pipe( $.sass( require( 'sass' ) )( {
errLogToConsole: true,
outputStyle: 'compressed',
sourceComments: false,
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@babel/core": "^7.1.0",
"@babel/plugin-transform-react-jsx": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@wordpress/env": "^5.0",
"@wordpress/env": "^9.10.0",
"@wordpress/eslint-plugin": "^9.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
Expand All @@ -47,17 +47,18 @@
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.0",
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.2",
"gulp-sass": "^5.1.0",
"gulp-sass-glob": "^1.0.9",
"gulp-sourcemaps": "^3.0",
"gulp-stylelint": "^13.0.0",
"sass": "^1.83.0",
"stylelint": "^13.13.1",
"stylelint-config-wordpress": "^17.0.0",
"vinyl-named": "^1.1.0",
"webpack": "^5.3",
"webpack-stream": "^6.1"
},
"volta": {
"node": "14.21.3"
"node": "18.20.5"
}
}
8 changes: 8 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ module.exports = {
minimize: true,
minimizer: [
new TerserPlugin( {
terserOptions: {
mangle: {
reserved: [ '__', '_x', '_n', '_nx', 'sprintf' ],
},
output: {
comments: /translators:/i,
},
},
extractComments: {
condition: true,
filename: ( fileData ) => {
Expand Down
Loading