Skip to content

john-ring/slalomLab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slalom Lab

Prereq installs Mac Installs

  • chrome
  • sublime or other editor

Github

  • Create a new account (or use old) github.com
    • You'll need to do email confirmation for new accounts

1. Getting the Code

git —version
  • mac 10.11.1 will prompt you to install git if it’s missing
  • if you arent prompted use http://git-scm.com/download/mac
  • in terminal cd into your workspace
git clone <forked repo>
  • cd into directory
  • Create develop branch and set active branch to develop
git branch develop
git checkout develop
  • Push your new branch up to GitHub
git push origin develop

2. Running the application

Node

  • see if node and npm are installed
node -v
npm -v
  • go to https://nodejs.org/en/ to install. Download the LTS version.
  • CHECK usr/local permissions! This can be a source of lots of node pain
cd /usr
ls -l
  • if /usr/local is not owned by your user then you can’t install global node packages!
  • I changed ownership of the usr/local directory but I don't think that is the best approach.
sudo chown -R $USER /usr/local
  • You will be better off just configuring npm to install global packages in a different location.
  • Create a new directory in your user space
mkdir ~/npm
  • Configure npm to use the new directory
npm config set prefix ~/npm
  • Add the new location to your $PATH
export PATH=$PATH:$HOME/npm/bin (this only updates the path for the open shell)!!!!
  • install into default /usr/local
  • make sure that /usr/local/bin is in your $PATH
echo $PATH
  • install npm dependencies
npm install

Gulp

We use gulp to run our javascript builds and tests.

  • install global gulp. first test if installed.
gulp —version
npm install -g gulp

Bower

Bower helps us manage our client side runtime dependencies.

  • install bower globally
bower --version
npm install -g bower
  • run a bower install
cd app
bower install
cd ../
  • Now we can start the node server to run the app. You'll need to open another terminal after starting node.
node server.js
  • We can also run unit tests
gulp test-unit
  • run gulp dev watcher
gulp dev
  • save a code change and see tests run

3. Hosting in the cloud

  • Create a Pivotal Web Services account: https://console.run.pivotal.io/register

  • You'll need to confirm your email address AND phone number. You can't use the same number twice! Create a google voice number if you need a new account.

  • Create an org name

  • Create a space using the UI

  • Download and install the cli if you don't already have it installed.

  • Test if the cli installed correctly

cf --version
  • Login to your space
cf login -a https://api.run.pivotal.io
  • Enter credentials into cli

  • Update your manifest file. Each app has a manifest which describes hwo the app should run. Each app needs a unique name so open up the manifest.yml file and add your name to the app name property.

  • Push app to your space

cf push
  • Navigate to . You can find the link in your Cloud Foundry dashboard.

4. Automating Builds

  • Login to our Jenkins server. http://52.6.164.105:8080/

  • Credentials in the chat room.

  • Create a new item. Start the job name with your last name and select freestyle project.

  • Scroll down to "Source Code Management" and add your repo to the job.

  • Add the develop branch

  • Test the build and make sure you can resolve the repo.

  • Now we can add a build step. We will just use a Shell script step. We already have a build shell script in our repo. This will run the gulp ci task as well as our npm tasks.

sh -x -e build-script.sh
  • Configure test report outputs. Scroll down to post build actions and add "Publish Junit test result report". Enter "report/**/*.xml". This will pull in all test reports in the workspace. Run another build and you should have a test result link on your jobs homepage.

Test Failing

  • Open /app/product/product.controller.spec.js in your editor.
  • Change line #36 to run the broken test (remove the "x")
  • Run the unit test locally and look at the output
  • Commit the broken test and run another jenkins build and notice the FAIL.

5. Triggering the Build

Configure GitHub hooks

  • Go back to your Jenkins job config

  • Select "Trigger builds remotely"

  • Add a simple token ("1234")

  • Now go back to your GitHub repo in the browser.

  • On the right side click "Settings"

  • Then click "Webhooks and Services"

http://52.6.164.105:8080/<jobname>/build?token=<token>
  • Click save

  • Make a text change to your Readme file, commit, and push it up to test your hook. You should see the jenkins job start.

BONUS: Sauce Labs

  • install protractor globally
npm install -g protractor
webdriver-manager update

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 80.6%
  • HTML 13.8%
  • Shell 4.4%
  • CSS 1.2%