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

Automate npm/yarn installation test of the CLI tool #274

Closed
3 tasks done
anuveyatsu opened this issue Feb 13, 2018 · 1 comment
Closed
3 tasks done

Automate npm/yarn installation test of the CLI tool #274

anuveyatsu opened this issue Feb 13, 2018 · 1 comment
Assignees

Comments

@anuveyatsu
Copy link
Member

anuveyatsu commented Feb 13, 2018

As described in datopian/datahub-qa#91 we want to install data-cli using npm/yarn and test with basic commands after each deployment.

Acceptance criteria

  • Travis runs installation of data-cli using npm and yarn after each deployment

Tasks

  • refactor .travis.yml to run script for installation of data-cli after each deployment
  • create shell script

Analysis

We want to run the CLI installation script only when a new release is issued so this should go somewhere in the after_deploy script in the travis configs. Also, we want to test it on Linux + MacOS and using Node versions 7, 8 and 9. Still, all tests should be run as before using only Linux and node8.

language: node_js
matrix:
  include:
  - os: linux
    node_js: '8'
    env: TEST=true
    sudo: required
  - os: linux
    node_js:
      - '7'
      - '9
    env: TEST=false
    sudo: required
  - os: osx
    node_js:
      - '7'
      - '8'
      - '9'
    env: TEST=false
install: if $TEST; then npm install; else echo 'skipping this script...'; fi
script: if $TEST; then npm test; else echo 'skipping this script...'; fi
before_deploy: npm run pack
deploy:
  ...
after_deploy:
  - chmod ugo+x test-script.sh
  - ./test-script.sh

The test-script.sh should look like:

#!/bin/bash
set -ev
echo '>>> Now running shell script...'
npm i -g data-cli
data --version
data help
data info https://datahub.io/core/finance-vix

echo '>>> Install data-cli with yarn...'
npm uninstall -g data-cli
if [ $(uname) = 'Darwin' ]; then
  brew install yarn
else
  curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
  echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
  sudo apt-get update && sudo apt-get install yarn
fi

export PATH="$(yarn global bin):$PATH"
yarn global add data-cli
data --version
data info https://datahub.io/core/finance-vix
@anuveyatsu anuveyatsu added this to the Sprint - 26 Feb 2018 milestone Feb 13, 2018
@anuveyatsu anuveyatsu self-assigned this Feb 13, 2018
anuveyatsu added a commit that referenced this issue Feb 13, 2018
anuveyatsu added a commit that referenced this issue Feb 13, 2018
anuveyatsu added a commit that referenced this issue Feb 13, 2018
anuveyatsu added a commit that referenced this issue Feb 13, 2018
anuveyatsu added a commit that referenced this issue Feb 13, 2018
* [travis][m]: refactored travis config for automation of npm/yarn installables + added shell script for it - refs #274

* [travis][xs]: fixed array syntax for yaml data - refs #274

* [travis][xs]: re-wrote travis config matrix otherwise listing node_js versions weren't working - refs #274

* [travis][xs]: added after_success script to test out how shell script works (will be removed later) - refs #274

* [travis][xs]: removed temporary 'after_success' script so now we're ready to open a pull request - refs #274
@anuveyatsu
Copy link
Member Author

FIXED - you can see builds on Travis or take a look at .travis.yaml and test-script.sh files:

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

No branches or pull requests

1 participant