- 登錄 Travis CI 網(wǎng)站俭驮,https://travis-ci.org/回溺,以 github 賬號的方式登錄。
- 然后選擇一個自己找自動測試的代碼目錄遗遵,將 General 選項中的 Build only if .travis.yml is present 選中。
- 在 master 分支中新建一個
travis.yml
, 寫上自動測試的腳本车要。
比如,使用 Travis CI 來自動生成 Hugo 網(wǎng)頁, 可采用如下的方式
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
- 然后在 Travis CI 的項目依賴中添加 github_token 的環(huán)境變量即可翼岁。
Environment Variables
Notice that the values are not escaped when your builds are executed. Special characters (for bash) should be escaped accordingly.