Skip to content

Commit

Permalink
Merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ho-man-chan committed May 26, 2021
2 parents 8a2f66c + 1d0f9c6 commit db970a3
Show file tree
Hide file tree
Showing 44 changed files with 900 additions and 192 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/.pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: CI workflow
on:
push:
branches: [ dev, main ]
tags:
- '*.*.*'
pull_request:
branches: [ dev ]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php: [ 7.3 ]
os: [ ubuntu-18.04 ]
wordpress: [ 5.6.2, 5.7.2 ]

name: Test - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}

env:
WP_VERSION: ${{ matrix.wordpress }}
WP_MULTISITE: 1

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v2
with:
node-version: '10'

- name: Install OS dependencies
run: sudo apt-get install libxml2-utils ghostscript poppler-utils

- name: Start required services
run: sudo systemctl start mysql.service

- name: Cache PHP dependencies
uses: actions/cache@v1
with:
path: vendor
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: phpcs, composer:v1
coverage: pcov

- name: Install dependencies
run: |
node -v
npm install -g lerna
npm install
npm run bootstrap
npm run install-build-tools
lerna run install-build-tools
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer install --no-interaction
composer global require "phpunit/phpunit:7.5.20"
- name: Run Lint
run: composer standards

- name: Install WP tests
run: bash bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wordpress }}

- name: Run Coverage
run: composer require pcov/clobber; vendor/bin/pcov clobber; vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml

- name: Run Frontend Tests
run: |
npm run test
lerna run test
- name: Run PHP Tests
run: vendor/bin/phpunit

- name: Upload Coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)

- name: Prepare Build
if: startsWith(github.ref, 'refs/tags/')
run: |
export GITHUB_BUILD_PATH=${{github.workspace}}
export GITHUB_REPO_SLUG="$(basename ${{github.workspace}})"
export GITHUB_TAG="$(basename ${{github.ref}})"
echo "File to be created : $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip"
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
wp package install wp-cli/dist-archive-command
npm run build:production
composer install --no-dev --optimize-autoloader
cd ..
wp dist-archive $GITHUB_REPO_SLUG $GITHUB_BUILD_PATH/$GITHUB_REPO_SLUG-$GITHUB_TAG.zip
cd $GITHUB_BUILD_PATH
ls $GITHUB_BUILD_PATH
- name: Deploy
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files:
${{github.workspace}}/*.zip
37 changes: 37 additions & 0 deletions .github/workflows/update-pot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Update POT file

on:
push:
branches:
- dev
paths:
- '**.php'
- '**.js'

jobs:
update-pot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
tools: composer, wp-cli
- name: Install dependencies
run: |
wp package install wp-cli/i18n-command:2.2.6
wp package install pressbooks/pb-cli:dev-dev#800cec8
composer require jenssegers/blade:1.1.0
- name: Update POT file
run: wp pb make-pot . languages/pressbooks-book.pot --require=vendor/autoload.php --domain=pressbooks-book --slug=pressbooks-book --package-name="McLuhan" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/pressbooks/pressbooks-book/issues\"}"
# Remove the next four lines and uncomment the last five lines once the process has been confirmed to work as desired.
- uses: actions/upload-artifact@v2
with:
name: pressbooks-book.pot
path: languages/pressbooks-book.pot
# - name: Commit updated POT file
# uses: stefanzweifel/[email protected]
# with:
# commit_message: 'chore(l10n): update languages/pressbooks-book.pot'
# file_pattern: '*.pot'
73 changes: 0 additions & 73 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Then, from the GitHub Updater interface, navigate to the "Install Theme" tab. En

## Changelog

### 2.11.1
### 2.11.2

* See: https://github.com/pressbooks/pressbooks-book/releases/tag/2.11.1
* See: https://github.com/pressbooks/pressbooks-book/releases/tag/2.11.2
* Full release history available at: https://github.com/pressbooks/pressbooks-book/releases
6 changes: 3 additions & 3 deletions assets/src/scripts/routes/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default {
let $svgArrow = jQuery( 'button[aria-expanded] > svg' );
let $toggleButton = jQuery( 'button[aria-expanded]' );

jQuery( $toggleButton, $svgArrow ).click( function ( e ) {
jQuery( $toggleButton, $svgArrow ).on( 'click', function ( e ) {
// Cast the state as a boolean
let expanded = btn.getAttribute( 'aria-expanded' ) === 'true' || false;

Expand Down Expand Up @@ -173,7 +173,7 @@ export default {
$( '#h5p-show-hide' ).text( $( '#h5p-show-hide' ).attr( 'show-all-text' ) );
$( '.h5p-row-item' ).text( $( '.h5p-row-item' ).attr( 'show-activity-text' ) );

$h5pActivities.click( function () {
$h5pActivities.on( 'click', function () {
if ( $( this ).text() === $( this ).attr( 'show-activity-text' ) ) {
$activityContainer.hide();
$( this ).closest( 'tr' ).next( this ).show( 'slow' );
Expand All @@ -185,7 +185,7 @@ export default {
}
} );

$( '#h5p-show-hide' ).click( function () {
$( '#h5p-show-hide' ).on( 'click', function () {
if ( $( this ).text() === $( this ).attr( 'show-all-text' ) ) {
$activityContainer.show();
$( this ).text( $( this ).attr( 'hide-all-text' ) );
Expand Down
2 changes: 1 addition & 1 deletion assets/src/scripts/routes/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
.find(
'ol'
)
.removeAttr( 'hidden' );
.prop( 'hidden', false );
} );
$target.parents( '.toc__toggle' ).attr( 'aria-expanded', 'true' );
} );
Expand Down
18 changes: 9 additions & 9 deletions assets/src/scripts/routes/single.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default {
// Javascript to be fired on single reading view
jQuery( $ => {
let toggle = $( '.block-reading-meta__compare__toggle' );
toggle.click( event => {
toggle.on( 'click', event => {
let activity = $( '.block-reading-meta__compare__activity' );
let alert = $( '.alert' );
let container = $( '.block-reading-meta__compare__comparison' );
Expand All @@ -12,9 +12,9 @@ export default {
alert.addClass( 'visually-hidden' );
if ( $( event.currentTarget ).attr( 'aria-expanded' ) === 'false' ) {
toggle.attr( 'aria-expanded', true );
activity.removeAttr( 'hidden' );
activity.prop( 'hidden', false );
if ( container.hasClass( 'populated' ) ) {
container.removeAttr( 'hidden' );
container.prop( 'hidden', false );
activity.attr( 'hidden', true );
} else {
alert.text( pressbooksBook.comparison_loading );
Expand Down Expand Up @@ -54,7 +54,7 @@ export default {
.text( deletions );
activity.attr( 'hidden', true );
alert.text( pressbooksBook.comparison_loaded );
container.removeAttr( 'hidden' );
container.prop( 'hidden', false );
}
});
} );
Expand All @@ -78,7 +78,7 @@ export default {
const offset = 250;
const duration = 0;

$( window ).scroll( function () {
$( window ).on( 'scroll', function () {
if ( $( window ).scrollTop() > offset ) {
$( '.nav-reading__up' ).animate( { opacity: 1 }, duration );
}
Expand All @@ -87,7 +87,7 @@ export default {
}
} );

$( '.nav-reading__up' ).click( function ( event ) {
$( '.nav-reading__up' ).on( 'click', function ( event ) {
event.preventDefault();
$( '.nav-reading__up' )
.blur()
Expand All @@ -96,7 +96,7 @@ export default {
return false;
} );

$( document ).keydown( function ( e ) {
$( document ).on( 'keydown', function ( e ) {
if ( $( 'body' ).hasClass( 'no-navigation' ) ) {
return;
}
Expand Down Expand Up @@ -124,15 +124,15 @@ export default {
.removeAttr( 'width' );
} );

$( window ).resize( function () {
$( window ).on( 'resize', function () {
$allVideos.each( function () {
let $el = $( this );
let newWidth = $el.parent().parent().width();
$el
.width( newWidth )
.height( newWidth * $el.data( 'aspectRatio' ) );
} );
} ).resize();
} ).trigger( 'resize' );
} )();
} );
} );
Expand Down
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/scripts/book.js": "/scripts/book.js?id=209ba93d22103a35854d",
"/scripts/book.js": "/scripts/book.js?id=af07185482a38384a7bf",
"/styles/book.css": "/styles/book.css?id=3cbb775c3b4e63c64468",
"/styles/web-house-style.css": "/styles/web-house-style.css?id=d3c1aedc7525b0f30ccd",
"/scripts/collapse-sections.js": "/scripts/collapse-sections.js?id=ba8eb815cea5fd273013",
Expand Down
Loading

0 comments on commit db970a3

Please sign in to comment.