クイックリファレンス

Travis CI チートシート

Travis CI の .travis.yml 設定クイックリファレンス:ビルドライフサイクル、言語環境、ブランチフィルタ、マトリックスビルドを整理。

· 公開日

Travis CI における .travis.yml 設定ファイルのクイックリファレンスです。

言語環境

Node.js 設定

language: node_js
node_js:
  - '18'
  - '20'

script:
  - npm test

Ruby 設定

language: ruby
rvm:
  - 3.1
  - 3.2

script:
  - bundle exec rake test

ビルドライフサイクルのフェーズ

Travis CI のビルドライフサイクルは以下の順序で実行されます:

  1. before_install
  2. install
  3. before_script
  4. script
  5. after_success または after_failure
  6. after_script
  7. before_deploy (任意)
  8. deploy (任意)
  9. after_deploy (任意)

カスタムスクリプト手順

before_script:
  - make pretest
script:
  - make test
after_script:
  - make clean

ブランチフィルタリング

branches:
  only:
    - main
    - /^release-.*$/
  except:
    - legacy

マトリックスと環境変数

env:
  - DB=postgresql
  - DB=mysql

Apt によるシステム依存パッケージ

addons:
  apt:
    packages:
      - libcurl4-openssl-dev

リファレンス

関連テーマ