-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
900 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.