Last active
December 25, 2015 14:39
-
-
Save flenter/6992234 to your computer and use it in GitHub Desktop.
wercker.yml for php with a yui compressor step
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
box: wercker/php | |
# Build definition | |
build: | |
# The steps that will be executed on build | |
steps: | |
# A custom script s tep, name value is used in the UI | |
# and the code value contains the command that get executed | |
- script: | |
name: echo php information | |
code: | | |
echo "php version $(php --version) running" | |
echo "from location $(which php)" | |
# Add more steps here: | |
#- script: | |
# name: run unit tests | |
# code: phpunit | |
after-steps: | |
- hipchat-notify: | |
token: $HIPCHAT_TOKEN | |
room-id: 199099 | |
from-name: Wercker | |
deploy: | |
steps: | |
- script: | |
name: simple ls step | |
code: | | |
ls -la | |
after-steps: | |
- hipchat-notify: | |
token: $HIPCHAT_TOKEN | |
room-id: 199099 | |
from-name: Wercker |
Ok. And for ftp, we can change the deploy steps content into:
- install-packages:
packages: python-pip
- script:
name: install pyftpsync
code: |
sudo pip install pyftpsync
- script:
name: sync with remote
code: |
pyftpsync upload . ftp://username:[email protected]/target/folder -x
You can see some of the options for the ftp command here:
https://github.com/mar10/pyftpsync/wiki
note: you may want to run the command first without -x . It just tries to see if it can upload files without changing anything (dry run)
edit: ftpsync corrected to: pyftpsync
edit: switched : and @
Alternatively we could use this:
- install-packages:
packages: lftp
- script:
name: prepare lftp settings
code: |
mkdir -p $HOME/.lftp
echo "set ssl:verify-certificate no" > $HOME/.lftp/rc
- script:
name: sync with remote
code: |
lftp -e "mirror -R . /;bye" -u username,$MY_PASSWORD example.com
note: mkdir -p added, use of tilde replaced with $HOME
For minifying we can do the following changing the build steps from
# A custom script s tep, name value is used in the UI
# and the code value contains the command that get executed
- script:
name: echo php information
code: |
echo "php version $(php --version) running"
echo "from location $(which php)"
# Add more steps here:
#- script:
# name: run unit tests
# code: phpunit
to:
- install-packages:
packages: yui-compressor
- script:
name: move code to output dir
code: |
mkdir -p $WERCKER_OUTPUT_DIR/views
cp -r * $WERCKER_OUTPUT_DIR/views
- script:
name: run yui compressor for js
code: |
cd $WERCKER_OUTPUT_DIR
for file in `find . -name "*.js"`; do java -jar /usr/share/yui-compressor/yui-compressor.jar --type js -v -o $file $file; done
- script:
name: run yui compressor for css
code: |
cd $WERCKER_OUTPUT_DIR
for file in `find . -name "*.css"`; do java -jar /usr/share/yui-compressor/yui-compressor.jar --type css -v -o $file $file; done
edit: Yui compressor doesn't like more than 1 layer of directories. compress step split into two steps.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Making the code available as a zip file can be done like this. Add before your after-steps for the build phase the following code:
If you go to the
make available as download
step in wercker and you'll find a artifacts tab (if the total code code is less than 50MB). You can see in the log of the step if there's more than 50MB of data.