Closed ptondereau closed 8 years ago
Thanks @ptondereau 😄 I've never used a Makefile with travis before so I will read up on this as soon as possible
btw @chihab, according to @ptondereau this will solve the previous reported issue
Thanks @ptondereau.
I did a lot of Makefiles before back when I was programming C, never came to my mind to use it on a PHP/JS project ! :)
Makefile and .travis config file are a lot similar as they both run commands (in a shell environment) in a particular order.
Before deciding the way to do it, what would be the best trigger for building and testing a stable release using composer create-project ? I would say on each stable release but how could travis know that ? (It probably depends on the way we link composer stable release to the stable tag/branch on our repo).
Hate to be the one that point this but Makefiles won't work in Windows if they're written in Standard Unix so we will need to be carefull about that, or especify that it's required to have Cygwin installed, so it can runs without troubles, that by the way it's included in Laragon as discused in https://github.com/jadjoubran/laravel5-angular-material-starter/issues/290#issuecomment-230073483
Thanks @flick36, we could use a Makefile here since we're doing doing CI using Travis CI, which can test on Linux and OS X only. However, the commands run in the Makefile should better be platform agnostic since they would normally be run by project users.
Once we'll have a stable branch, the one targeted by composer create-project, each PR/commit on that particular branch would run the "composer create-project" whilst the others branches would run only the the classical travis build steps.
We could do this using TRAVIS_BRANCH environment variable prepared by Travis-ci which gives us the name of the branch in which a PR or a commit has been done. We'd do something like:
install:
- script: ./scripts/run-install.sh
before_script:
- mysql -e 'create database laravel;'
- export DB_DATABASE=laravel
- export DB_USERNAME=travis
- export DB_PASSWORD=
script:
- php artisan migrate --force && gulp && vendor/bin/phpunit
./scripts/run-install.sh
#!/bin/bash
set -ev
if [ "${TRAVIS_BRANCH}" = "stable" ]; then
composer install && cd laravel5-angular-material-starter
else
cp .env.example .env
php artisan key:generate
php artisan jwt:generate
fi
npm install -g gulp bower && npm install && bower install
For that, we'd need a stable branch, @jadjoubran. :)
@chihab would you recommend keeping master for stable and then having new releases in branches?
@jadjoubran yes ! as suggested by this very known post by Vincent Driessen: http://nvie.com/posts/a-successful-git-branching-model/
We consider origin/master to be the main branch where the source code of HEAD always reflects a production-ready state.
The shell script above would be:
if [ "${TRAVIS_BRANCH}" = "master" ]; then
...
fi
:)
@chihab I actually use this for all my projects.. why not use it here as well 😄
Thanks for the recommendation
Btw master is stable right now, and I just pushed a develop
branch where I'll be working from now on
Would anyone be interested in sending a PR? thanks a lot!
Okay thanks @jadjoubran. I'll send a PR asap.
Closing since this is going to be the last release (supposedly) for Angular 1
According to the trello's task; Makefile might be the right solution.
Indeed, here is a PoC:
First create a
Makefile
file at the root of the repo then I suggest to put this in for your goal:To finish, your
.travis.yml
should look like this:But sure, you can add other Makefile or command to run in it!
Don't know if it's what you want but we never know...
Cheers!