美文网首页
使用 Travis CI 来自动测试代码

使用 Travis CI 来自动测试代码

作者: xyzxyznone | 来源:发表于2018-05-27 10:07 被阅读0次
    1. 登录 Travis CI 网站,https://travis-ci.org/,以 github 账号的方式登录。
    2. 然后选择一个自己找自动测试的代码目录,将 General 选项中的 Build only if .travis.yml is present 选中。
    3. 在 master 分支中新建一个 travis.yml, 写上自动测试的脚本。
      比如,使用 Travis CI 来自动生成 Hugo 网页, 可采用如下的方式
    language: python
    python: 2.7
    
    branches:
      only:
      - master
    
    install:
      - curl -L https://raw.githubusercontent.com/seisman/install/master/install-hugo.sh | bash
      - pip install pygments
    
    script:
      - ./hugo
    
    deploy:
      provider: pages
      skip_cleanup: true
      github_token: ${GH_TOKEN}
      local_dir: public
    
    1. 然后在 Travis CI 的项目依赖中添加 github_token 的环境变量即可。

    Environment Variables
    Notice that the values are not escaped when your builds are executed. Special characters (for bash) should be escaped accordingly.

    相关文章

      网友评论

          本文标题:使用 Travis CI 来自动测试代码

          本文链接:https://www.haomeiwen.com/subject/gnqbjftx.html