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

Update travis.yml to run tests, build, and deploy build artifacts #49

Open
jpdillingham opened this issue May 12, 2018 · 4 comments
Open

Comments

@jpdillingham
Copy link
Member

Add the following to travis.yml:

cache:
  directories:
  - node_modules
script:
  - npm test
  - npm run build

Research heroku/travis integration to determine how to modify the pipeline to deploy the contents of the /build/ folder instead of the root.

Note that webpack errors will begin to fail travis builds following this change. Need volunteers to fix those errors before we can deploy.

@jpdillingham
Copy link
Member Author

On a second look, it appears Heroku uses a build api separate from Travis. The changes listed above should still be made, but we'll need to investigate what needs to be done to tweak the Heroku process in addition.

@mtliendo
Copy link
Contributor

clarifying: So Heroku currently watches root and we need it to watch just build?

@jpdillingham
Copy link
Member Author

https://docs.travis-ci.com/user/deployment/heroku/#Deploying-build-artifacts

Apparently once Travis is done doing it's thing (interestingly in the case of our current config -- nothing) it invokes the Heroku build api with our config and Heroku apparently builds it again, or perhaps just deploys it as is (needs investigation).

Here's the deployment output from our past deploy to staging (from here:

Installing deploy dependencies
Fetching: multipart-post-2.0.0.gem (100%)
Successfully installed multipart-post-2.0.0
Fetching: faraday-0.15.1.gem (100%)
Successfully installed faraday-0.15.1
Fetching: rendezvous-0.1.2.gem (100%)
Successfully installed rendezvous-0.1.2
Fetching: netrc-0.11.0.gem (100%)
Successfully installed netrc-0.11.0
Fetching: dpl-heroku-1.9.6.gem (100%)
Successfully installed dpl-heroku-1.9.6
5 gems installed
dpl.2
Preparing deploy
authentication succeeded
checking for app qccoders-staging
found app qccoders-staging
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup.
Saved working directory and index state WIP on (no branch): d276844 Merge pull request #45 from qccoders/develop
dpl.3
Deploying application
creating application archive
uploading application archive
triggering new deployment
-----> Node.js app detected
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true
-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)
       
       Resolving node version 8.x...
       Downloading and installing node 8.11.1...
       Using default npm version: 5.6.0
-----> Restoring cache
       Loading 2 from cacheDirectories (default):
       - node_modules
       - bower_components (not cached - skipping)
-----> Building dependencies
       Installing node modules (package.json + package-lock)
       up to date in 13.142s
-----> Caching build
       Clearing previous node cache
       Saving 2 cacheDirectories (default):
       - node_modules
       - bower_components (nothing to cache)
-----> Pruning devDependencies
       Skipping because npm 5.6.0 sometimes fails when running 'npm prune' due to a known issue
       https://github.com/npm/npm/issues/19356
       
       You can silence this warning by updating to at least npm 5.7.1 in your package.json
       https://devcenter.heroku.com/articles/nodejs-support#specifying-an-npm-version
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> web
-----> Compressing...
       Done: 56.4M
-----> Launching...
       Released v25
       https://qccoders-staging.herokuapp.com/ deployed to Heroku
Already up to date!
HEAD detached at d276844
nothing to commit, working tree clean
Dropped refs/stash@{0} (54b63354d7684fcbf2479d02ed375d6c1edd33f5)
Done. Your build exited with 0.```

@jpdillingham
Copy link
Member Author

https://docs.travis-ci.com/user/deployment/heroku/

I'm pretty sure we can achieve what we want by the following:

AFAIK the travis state is ephemeral (other than perhaps node_modules) so stepping on our public folder shouldn't harm anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants