Smart Contract info

Smart Contract info

  • Contracts
  • TodoList
  • Help
  • Github
  • Blog

›Recent Posts

Recent Posts

  • Fixing Build Pipeline
  • Introduction to Bchain
  • Sept Status Report
  • Travis CI Configured

Travis CI Configured

August 25, 2018

David Li

David Li

CI/CD

CircleCI

version: 2
jobs:
  build:
    working_directory: ~/smart-contracts
    # The primary container is an instance of the first image listed. The job's commands run in this container.
    docker:
      - image: circleci/node:8-browsers
    # The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost.
      - image: trufflesuite/ganache-cli
    steps:
      - checkout
      - run:
          name: Update npm
          command: 'sudo npm install -g npm@latest'
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: Install npm wee
          command: npm install
      - run:
          name: Migrate Contracts
          command: ./node_modules/truffle/build/cli.bundled.js migrate --network development
      - run:
          name: Test Contracts
          command: ./node_modules/truffle/build/cli.bundled.js test --network development
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - node_modules

Gitlab CI

image: node:8.1.1

cache:
  paths:
  - node_modules/

stages:
  - truffle-tests

smart_contracts:
  stage: truffle-tests
  services:
   - trufflesuite/ganache-cli
  script:
   - npm install truffle
   - ./node_modules/truffle/build/cli.bundled.js compile
   - ./node_modules/truffle/build/cli.bundled.js migrate --network gitlab
   - ./node_modules/truffle/build/cli.bundled.js test --network gitlab

travis.yml

sudo: required
language: node_js
node_js:
  - "8"
addons:
  apt:
    sources:
      - google-chrome
    packages:
      - google-chrome-stable
cache:
  directories:
  - node_modules
before_install:
  - export CHROME_BIN=chromium-browser
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start
install:
  - npm install -g truffle
  - npm install -g ganache-cli
  - npm install
script:
  #- npm run lint
  - stage: test
  - npm run ganache
  - sleep 5
  - truffle migrate --network development
  - npm run test/truffle 
  - npm run unit
  - npm run e2e
  - npm run stop
  - stage: solidity-docs
  - sudo add-apt-repository -y ppa:ethereum/ethereum
  - sudo apt-get update
  - sudo apt-get -y install solc
  - solidity-docgen . contracts docs
after_script:
  - npm run coverage && cat coverage/lcov.info | coveralls

Test-rpc

image: node:8.11.1

cache:
  paths:
  - node_modules/

stages:
  - test
  - deploy

truffle-tests:
  stage: test
  before_script:
   - npm i --save-dev run-with-testrpc
   - npm i truffle@4.1.4
   - npm install -g ganache-cli 
  script:
   - npm install
   -  ./node_modules/truffle/build/cli.bundled.js compile
   - ./node_modules/.bin/run-with-testrpc './node_modules/truffle/build/cli.bundled.js migrate && ./node_modules/truffle/build/cli.bundled.js test'
  allow_failure: true

frontEnd-tests:
  stage: test
  before_script:
   - npm i --save-dev run-with-testrpc 
   - npm i truffle jest
   - npm install -g ganache-cli
  script:
   - npm install
   - ./node_modules/truffle/build/cli.bundled.js compile
   #- npm run docs
   - ./node_modules/.bin/run-with-testrpc './node_modules/truffle/build/cli.bundled.js migrate && npm run test' 
Recent Posts
  • CI/CD
  • CircleCI
  • Gitlab CI
    • travis.yml
    • Test-rpc
Smart Contract info
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Copyright © 2019 David Li