Skip to content

Commit

Permalink
Add Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdichaouch committed Jun 12, 2018
1 parent 57769af commit 0cf3d94
Show file tree
Hide file tree
Showing 9 changed files with 403 additions and 1 deletion.
100 changes: 100 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
sudo: false
dist: precise
language: php

php:
# - 5.3
# - 5.4
# - 5.5
- 5.6
# - 7.0

matrix:
fast_finish: true
#allow_failures:
# - php: 5.6
exclude:
# Newer Magento versions uses newer PHP versions
- php: 5.3
env: MAGENTO_VERSION="magento-mirror-1.9.3.1"
# Old Magento Versions are not officially supported to run with PHP 5.5
- php: 5.5
env: MAGENTO_VERSION="magento-mirror-1.6.2.0"
- php: 5.5
env: MAGENTO_VERSION="magento-mirror-1.7.0.2"
# Old Magento Versions are not officially supported to run with PHP 5.6
- php: 5.6
env: MAGENTO_VERSION="magento-mirror-1.6.2.0"
- php: 5.6
env: MAGENTO_VERSION="magento-mirror-1.7.0.2"
- php: 5.6
env: MAGENTO_VERSION="magento-mirror-1.8.1.0"
- php: 5.6
env: MAGENTO_VERSION="magento-mirror-1.9.0.1"
# Old Magento Versions are not officially supported to run with PHP 7.0
- php: 7.0
env: MAGENTO_VERSION="magento-mirror-1.6.2.0"
- php: 7.0
env: MAGENTO_VERSION="magento-mirror-1.7.0.2"
- php: 7.0
env: MAGENTO_VERSION="magento-mirror-1.8.1.0"
- php: 7.0
env: MAGENTO_VERSION="magento-mirror-1.9.0.1"

env:
global:
- MAGENTO_DB_ALLOWSAME=1
- SKIP_CLEANUP=1
- TEST_BASEDIR=.modman/Advocodo_Group/app/code/community/Advocodo/Group/Test
matrix:
- MAGENTO_VERSION="magento-mirror-1.6.2.0"
- MAGENTO_VERSION="magento-mirror-1.7.0.2"
- MAGENTO_VERSION="magento-mirror-1.8.1.0"
- MAGENTO_VERSION="magento-mirror-1.9.3.1"

cache:
apt: true
directories:
- "$HOME/.composer/cache"
- "$HOME/.cache/bin"

before_install:
- test -n "$GITHUB_TOKEN" && echo "Found GitHub token" && composer config github-oauth.github.com "$GITHUB_TOKEN" || echo "No GitHub token found"

install:
- composer install --no-interaction
- phpenv rehash

script:
- mkdir -p build/logs
#- curl --retry 2 --retry-delay 5 -H "Authorization":"token $GITHUB_TOKEN" -f -sSL https://raw.githubusercontent.com/mehdichaouch/MageTestStand/master/setup.sh | bash
- curl --retry 2 --retry-delay 5 -H "Authorization":"token $GITHUB_TOKEN" -f -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand/master/setup.sh | bash

before_deploy:
- ./bin/before_deploy.sh

deploy:
provider: releases
api_key: $GITHUB_TOKEN
skip_cleanup: true
file_glob: true
file:
- travis_release/Advocodo_Group.*.tar.gz
- /home/travis/build/advocodo/Advocodo_Group/var/connect/Advocodo_Group-0.1.0-RC6.tgz
- $TRAVIS_BUILD_DIR/README.md
on:
branch: travis
condition: "$AUTO_DEPLOY = true"
repo: advocodo/Advocodo_Group
tags: true

#after_success:
#- ./bin/set_tags.sh

#after_deploy:
# - ./bin/notification.sh

notifications:
email:
on_success: never # options: [always|never|change] default: always
on_failure: never # options: [always|never|change] default: always
6 changes: 6 additions & 0 deletions bin/after_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

#rm -rf travis_release


echo "YEAH"
53 changes: 53 additions & 0 deletions bin/before_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

set -e
set -x

echo "================================================ INIT PACKING ================================================"

mkdir travis_release

# Get buildenv var
cd /tmp/mageteststand.* && BUILDENV=`pwd`

# Create folder
ls -lsha $BUILDENV/.modman
mkdir -p $BUILDENV/.modman/Advocodo_Group/var/connect/ #$BUILDENV/.modman/Advocodo_Group/var/downloader/


echo $TRAVIS_BUILD_DIR # /home/travis/build/advocodo/Advocodo_Group
ls -lsha $TRAVIS_BUILD_DIR

echo $BUILDENV
ls -lsha $BUILDENV

# Copy old .xml
cp -a $TRAVIS_BUILD_DIR/var/connect/* $BUILDENV/.modman/Advocodo_Group/var/connect/

# Set new version to xml
#$TRAVIS_BUILD_

# Run modman update to re-create these files under [magento]/var/connect folder as symlinks
cd $BUILDENV #&& ./tools/modman update Advocodo_Group

ls -lsha $BUILDENV/htdocs

echo "ENV: BUILDENV/htdocs/app/code/community/Advocodo/Group"
ls -lsha $BUILDENV/htdocs/app/code/community/Advocodo/Group

# Give rights and execute mage
cd $BUILDENV/htdocs && chmod +x mage
ls -lsha $BUILDENV/htdocs

cat /home/travis/build/advocodo/Advocodo_Group/var/connect/package.xml

# Build package
./mage package $TRAVIS_BUILD_DIR/var/connect/package.xml

ls -lsha $TRAVIS_BUILD_DIR/var/connect/

cp -a $TRAVIS_BUILD_DIR/var/connect/Advocodo_Group-*.tgz $TRAVIS_BUILD_DIR/travis_release

ls -lsha $TRAVIS_BUILD_DIR/travis_release

echo "================================================ PACKING DONE ================================================"
49 changes: 49 additions & 0 deletions bin/get_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -e
set -x

if [ -z $TRAVIS_TAG ]; then
TRAVIS_TAG="9.0.0" # ERROR NOT TAGGED COMMIT
else
TRAVIS_TAG=$(echo $TRAVIS_TAG | cut -c2-)
fi


#cd var/connect
cd .modman/Advocodo_Group/var/connect

# Get old version from package.xml
OLD_VERSION=$(cat package.xml | grep "<version>" | cut -f2 -d \> | cut -f1 -d \<)


# Check if version have change
if [[ $TRAVIS_TAG = $OLD_VERSION ]]; then
echo -e "\033[31mError: version hasn't change since last time ($OLD_VERSION)\033[0m"
exit 1
fi


# Check if version is greater than old one
#$(printf "$TRAVIS_TAG\n$OLD_VERSION" | sort -V | tac | head -n 1)
if [[ $(printf "$TRAVIS_TAG\n$OLD_VERSION" | sort -V | sed 'x;1!H;$!d;x' | head -n 1) != $TRAVIS_TAG ]]; then
echo -e "\033[31mError: version has been downgraded ($TRAVIS_TAG < $OLD_VERSION)\033[0m"
exit 1
fi


# Create tmp package.xml and Advocodo_Group.xml with new version
sed 's/<version>'$OLD_VERSION'<\/version>/<version>'$TRAVIS_TAG'<\/version>/g' package.xml > package_tmp.xml
sed 's/<version>'$OLD_VERSION'<\/version>/<version>'$TRAVIS_TAG'<\/version>/g' Advocodo_Group.xml > Advocodo_Group_tmp.xml


# Delete old xml
rm -f package.xml Advocodo_Group.xml


# Put tmp xml as real xml
mv package_tmp.xml package.xml
mv Advocodo_Group_tmp.xml Advocodo_Group.xml


echo -e "\033[32mdone\033[0m"
29 changes: 29 additions & 0 deletions bin/set_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -e
set -x

BRANCH="travis"

# Are we on the right branch?
if [ "$TRAVIS_BRANCH" = "$BRANCH" ]; then

# Is this not a Pull Request?
if [ "$TRAVIS_PULL_REQUEST" = false ]; then

# Is this not a build which was triggered by setting a new tag?
if [ -z "$TRAVIS_TAG" ]; then
echo -e "Starting to tag commit.\n"

git config --global user.email "[email protected]"
git config --global user.name "Travis"

# Add tag and push to travis.
git tag -a v${TRAVIS_BUILD_NUMBER} -m "Travis build $TRAVIS_BUILD_NUMBER pushed a tag."
git push origin --tags
git fetch origin

echo -e "Done magic with tags.\n"
fi
fi
fi
19 changes: 19 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e
set -x

echo "START OF TEST.SH"

TRAVIS_TAG="v5.5.5"

if [ -z $TRAVIS_TAG ]; then
TRAVIS_TAG="1.1.2"
else
TRAVIS_TAG=$(echo $TRAVIS_TAG | cut -c2-)
fi


echo $TRAVIS_TAG

echo "END OF TEST.SH"
30 changes: 29 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,35 @@
"role": "owner"
}
],
"config": {
"optimize-autoloader": true
},
"require": {
"magento-hackathon/magento-composer-installer": "*"
"php": ">=5.3",
"magento-hackathon/magento-composer-installer": "*"
},
"minimum-stability": "dev",
"require-dev": {
"phpunit/phpunit": "4.1.*@dev",
"firegento/mage-ci": "dev-master",
"squizlabs/php_codesniffer": "^2.2 || ^3.0",
"magento-ecg/coding-standard": "dev-php-5.3-compatible || ^3.1",
"sebastian/phpdcd": "*",
"sebastian/phpcpd": "*",
"phpmd/phpmd": "*",
"phploc/phploc": "*",
"wimg/php-compatibility": "*",
"simplyadmire/composer-plugins": "@dev"
},
"repositories": {
"firegento": {
"type": "composer",
"url": "https://packages.firegento.com"
}
},
"support": {
"issues": "https://github.com/advocodo/Advocodo_Group/issues",
"source": "https://github.com/advocodo/Advocodo_Group",
"build": "https://travis-ci.org/advocodo/Advocodo_Group"
}
}
100 changes: 100 additions & 0 deletions var/connect/Advocodo_Group.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<_>
<form_key>2049crR5om9XOXAT</form_key>
<name>Advocodo_Group</name>
<channel>community</channel>
<version_ids>
<version_ids>2</version_ids>
</version_ids>
<summary>Magento module to add group list and custom group input in customer create account form.</summary>
<description>Magento module to add group list and custom group input in customer create account form.</description>
<license>Apache</license>
<license_uri>https://www.apache.org/licenses/LICENSE-2.0.txt</license_uri>
<version>0.1.0-RC6</version>
<stability>stable</stability>
<notes>Check https://github.com/advocodo/Advocodo_Group/releases/latest for details.</notes>
<authors>
<name>
<name>Advocodo</name>
</name>
<user>
<user>Group</user>
</user>
<email>
<email>[email protected]</email>
</email>
</authors>
<depends_php_min>5.3.0</depends_php_min>
<depends_php_max>8.0.0</depends_php_max>
<depends>
<package>
<name>
<name/>
</name>
<channel>
<channel/>
</channel>
<min>
<min/>
</min>
<max>
<max/>
</max>
<files>
<files> </files>
</files>
</package>
<extension>
<name>
<name>Core</name>
</name>
<min>
<min/>
</min>
<max>
<max/>
</max>
</extension>
</depends>
<contents>
<target>
<target>magelocal</target>
<target>magecommunity</target>
<target>magedesign</target>
<target>magedesign</target>
<target>mageetc</target>
<target>magelocale</target>
</target>
<path>
<path/>
<path>Advocodo/Group</path>
<path>frontend/base/default/layout/advocodo_group.xml</path>
<path>frontend/base/default/template/advocodo</path>
<path>modules/Advocodo_Group.xml</path>
<path/>
</path>
<type>
<type>file</type>
<type>dir</type>
<type>file</type>
<type>dir</type>
<type>file</type>
<type>dir</type>
</type>
<include>
<include/>
<include/>
<include/>
<include/>
<include/>
<include>#Advocodo_Group.csv#</include>
</include>
<ignore>
<ignore/>
<ignore/>
<ignore/>
<ignore/>
<ignore/>
<ignore/>
</ignore>
</contents>
</_>
Loading

0 comments on commit 0cf3d94

Please sign in to comment.