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

Merge feature/35-travis #37

Merged
merged 37 commits into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9a02fe6
#35: Add travis.yml with a basic installation test
Sep 25, 2017
6a5d868
#35: Fix document root
Sep 25, 2017
9a2a605
#35: Check if extension is correctly installed and test removal
Sep 25, 2017
37d1960
#35: Stop on failure
Sep 25, 2017
467d52c
#35: Add debug output
Sep 25, 2017
c4e3c55
#35: Decrease verbosity for Composer commands
Sep 25, 2017
4f84f6d
#35: Move to separate script
Sep 25, 2017
aac91f5
#35: Whoops, wrong file
Sep 25, 2017
f972846
#35: Test the actual branch instead of from latest release
Sep 25, 2017
8101291
#35: Fix path
Sep 25, 2017
cc50ed0
#35: Clone via HTTPS
Sep 25, 2017
5899afe
#35: Fix site name
Sep 25, 2017
271b295
#35: Fix site name
Sep 25, 2017
a073673
#35: Add debug
Sep 25, 2017
9979998
#35: Fix repo path
Sep 25, 2017
ee573dc
#35: Make sure to keep package name and type
Sep 25, 2017
9db4bdd
#35: Git can't clone from another shallow clone
Sep 25, 2017
4685e4b
#35: Clean-up
Sep 25, 2017
4de1f61
Merge branch 'master' into feature/35-travis
Sep 25, 2017
1e71ce8
#35: Increase clone depth
Sep 25, 2017
7e0d481
#35: Fix repo path
Sep 25, 2017
f836b0d
#35: Fix path to helloworld.php
Sep 25, 2017
165d75a
#35: Clean-up
Sep 25, 2017
f208981
#35: Don't remove dependencies on remove command
Sep 25, 2017
d569853
#35: Remove uninstall tests
Sep 25, 2017
2964418
#35: Add support for testing on Joomlatools Platform
Sep 25, 2017
a8f9ee2
#35: Add support for testing on Joomlatools Platform
Sep 25, 2017
fdf0a42
#35: Clean-up
Sep 25, 2017
4e0ee0e
#35: Only test on PHP 7.1 for now, include Joomla 3.6
Sep 25, 2017
543a946
#35: Test to see if Travis PR contains all branch changes?
Sep 25, 2017
f06f727
#35: Remove test code
Sep 25, 2017
997d114
#35: Add more logging statemetns
Sep 25, 2017
d23894c
#35: Fix file path for Platform
Sep 25, 2017
f94d1c0
#35: Better logging
Sep 25, 2017
3d92441
#35: Test if $REPO contains joomlatools/joomlatools-platform string
Sep 25, 2017
a993ada
#35: Fix database name for platform
Sep 25, 2017
23a486f
#35: Correct database name
Sep 25, 2017
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
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: php
sudo: false

php:
- 7.1
env:
- RELEASE=3.6 REPO=https://github.com/joomla/joomla-cms.git
- RELEASE=3.7 REPO=https://github.com/joomla/joomla-cms.git
- RELEASE=latest REPO=https://github.com/joomla/joomla-cms.git
- RELEASE=latest REPO=https://github.com/joomlatools/joomlatools-platform.git

services:
- mysql

git:
depth: 999999 # We can't use a shallow clone for testing. See: https://github.com/travis-ci/travis-ci/issues/4942#issuecomment-159132444

before_install:
- export PATH=$PATH:/home/travis/.composer/vendor/bin/
- export DOCUMENTROOT=/tmp/www/
- chmod +x $TRAVIS_BUILD_DIR/_travis/install.sh
- $TRAVIS_BUILD_DIR/_travis/install.sh

before_script:
- chmod +x $TRAVIS_BUILD_DIR/_travis/setup.sh
- $TRAVIS_BUILD_DIR/_travis/setup.sh

script:
- chmod +x $TRAVIS_BUILD_DIR/_travis/script.sh
- $TRAVIS_BUILD_DIR/_travis/script.sh
7 changes: 7 additions & 0 deletions _travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

echo "** Installing joomlatools/console"
composer global require --no-interaction joomlatools/console
joomla -V
38 changes: 38 additions & 0 deletions _travis/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -e

FILE="$DOCUMENTROOT/testsite/administrator/components/com_helloworld/helloworld.php"
DB="sites_testsite.j_extensions"

if [[ "$REPO" == *"joomlatools/joomlatools-platform"* ]]; then
FILE="$DOCUMENTROOT/testsite/app/administrator/components/com_helloworld/helloworld.php"
DB="sites_testsite.extensions"
fi

echo "** Installing test extension"
composer require -vv --working-dir=$DOCUMENTROOT/testsite --no-interaction joomlatools/composer-helloworld:dev-testbranch

# Verify if component file is present
echo "** Looking for helloworld.php"

echo "** Verifying helloworld.php contents"
if [ ! -f $FILE ]; then
echo "$FILE does not exist"
exit 1
fi

if ! grep -q "echo 'Hello World\!'" $FILE; then
echo "$FILE does not contain string"
exit 1
fi

# Test if the row exists in the database
echo "** Verifying extensions row in database"

COUNT=$(mysql -uroot -s -N -e "SELECT COUNT(extension_id) FROM $DB WHERE element = 'com_helloworld';")
echo "Matched $COUNT rows"

if [ $COUNT -le 0 ]; then
exit 1
fi
42 changes: 42 additions & 0 deletions _travis/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -e

echo "** Configuring PHP"
phpenv config-rm xdebug.ini
echo 'error_reporting = 22519' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

echo "** Create documentroot directory"
mkdir -p $DOCUMENTROOT

echo "** Checkout test branch"
git checkout -b testbranch
git commit -a -m "Commit PR changes"

# Based on the instructions from https://github.com/joomlatools/joomlatools-composer/wiki
echo "** Set up joomlatools/composer-helloworld"
git clone https://github.com/joomlatools/joomlatools-composer-helloworld.git /tmp/joomlatools-composer-helloworld/

cd /tmp/joomlatools-composer-helloworld/
git checkout -b testbranch
cat >/tmp/joomlatools-composer-helloworld/composer.json <<EOL
{
"name": "joomlatools/composer-helloworld",
"type": "joomlatools-composer",
"require": {
"joomlatools/composer": "dev-testbranch"
}
}
EOL

git commit -a -m "Add test dependencies"

echo "** Set up test site v$RELEASE (from $REPO)"
joomla site:create --www=$DOCUMENTROOT --repo=$REPO --release=$RELEASE --mysql-login="root" testsite

composer --no-interaction --working-dir=$DOCUMENTROOT/testsite config repositories.plugin vcs file:///$TRAVIS_BUILD_DIR
composer --no-interaction --working-dir=$DOCUMENTROOT/testsite config repositories.component vcs file:////tmp/joomlatools-composer-helloworld/
composer --no-interaction --working-dir=$DOCUMENTROOT/testsite config minimum-stability dev

# Reset working directory
cd $TRAVIS_BUILD_DIR