Skip to content

Commit

Permalink
Merge pull request #1 from charliestrawn/top-level-makefile
Browse files Browse the repository at this point in the history
Fix travis builds for forks, don't publish if not Workiva/frugal, add top level Makefile
  • Loading branch information
charliestrawn-wf authored and charliestrawn committed Apr 24, 2018
2 parents 4a407a9 + 777183a commit 9af2396
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 17 deletions.
28 changes: 13 additions & 15 deletions .travis.yml
Expand Up @@ -2,33 +2,31 @@ sudo: required
dist: trusty
group: deprecated-2017Q3
language: go
git:
depth: 1

env:
- TWINE_USERNAME=messaging
- TWINE_REPOSITORY=pypi
- TWINE_REPOSITORY_URL=https://upload.pypi.org/latest/

before_install:
- sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
- sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- mkdir $HOME/.virtuanenvs && echo "export WORKON_HOME=$HOME/.virtualenvs" >> $HOME/.bashrc
- mkdir -p $GOPATH/src/github.com/Workiva/frugal
- rsync -av $TRAVIS_BUILD_DIR/ $GOPATH/src/github.com/Workiva/frugal
- export TRAVIS_BUILD_DIR=$GOPATH/src/github.com/Workiva/frugal
- cd $TRAVIS_BUILD_DIR
# No need to install dart yet as we can't run the tests until thrift publishes dart to pub
# - sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
# - sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- sudo add-apt-repository -y ppa:openjdk-r/ppa
- sudo add-apt-repository -y ppa:masterminds/glide
- sudo apt-get update -qq
- sudo apt-get -y install python3-pip python-dev build-essential virtualenvwrapper openjdk-8-jdk maven dart glide
- pip install -U setuptools virtualenv virtualenvwrapper
- echo "source /etc/bash_completion.d/virtualenvwrapper" >> $HOME/.bashrc && source $HOME/.bashrc
- cd $TRAVIS_BUILD_DIR/lib/python
- mkvirtualenv py2 && make deps-tornado deps-gae
- mkvirtualenv py3 -p $(which python3) && make deps-asyncio
- sudo apt-get -y install python3-pip python-dev build-essential openjdk-8-jdk maven glide
# sudo apt-get -y install dart
- pip install -U virtualenv

script:
- cd $TRAVIS_BUILD_DIR && go test ./test -race
- cd $TRAVIS_BUILD_DIR/lib/go && glide install && go test -race $(glide nv)
- cd $TRAVIS_BUILD_DIR/lib/python
- workon py2 && make xunit-py2 flake8-py2
- workon py3 && make xunit-py3 flake8-py3
- cd $TRAVIS_BUILD_DIR/lib/java && mvn clean verify
- make

cache:
directories:
Expand Down
40 changes: 40 additions & 0 deletions Makefile
@@ -0,0 +1,40 @@
THIS_REPO := github.com/Workiva/frugal

all: unit

clean:
@rm -rf /tmp/frugal
@rm -rf /tmp/frugal-py3

unit: clean unit-cli unit-go unit-java unit-py2 unit-py3

unit-cli:
go test ./test -race

unit-go:
cd lib/go && glide install && go test -v -race

unit-java:
mvn -f lib/java/pom.xml checkstyle:check clean verify

unit-py2:
virtualenv -p /usr/bin/python /tmp/frugal && \
. /tmp/frugal/bin/activate && \
$(MAKE) -C $(PWD)/lib/python deps-tornado deps-gae xunit-py2 flake8-py2 &&\
deactivate

unit-py3:
virtualenv -p python3 /tmp/frugal-py3 && \
. /tmp/frugal-py3/bin/activate && \
$(MAKE) -C $(PWD)/lib/python deps-asyncio xunit-py3 flake8-py3 && \
deactivate

.PHONY: \
all \
clean \
unit \
unit-cli \
unit-go \
unit-java \
unit-py2 \
unit-py3
2 changes: 1 addition & 1 deletion scripts/travis/deploy-java.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then
if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ] && [ "$TRAVIS_REPO_SLUG" == 'Workiva/frugal' ]; then
cd $TRAVIS_BUILD_DIR/lib/java && mvn clean deploy -P sign,build-extras \
--settings $TRAVIS_BUILD_DIR/lib/java/.travis.settings.xml \
-Dmaven.test.skip=true
Expand Down
2 changes: 1 addition & 1 deletion scripts/travis/deploy-python.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then
if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ] && [ "$TRAVIS_REPO_SLUG" == 'Workiva/frugal' ]; then
pip install twine
cd $TRAVIS_BUILD_DIR/lib/python
make install
Expand Down

0 comments on commit 9af2396

Please sign in to comment.