Technofara

Golangエンジニア!仕事で必要になって勉強した事とか、新しい事とか色々まとめたりを緩くやります。技術系と思考系だけにしておきます、

# git private repositoryを無料で作って、CIも無料でやりたい!(Rails編)

最初は、github + travisCIがいいな!と思ってました!
でも、これってprivateなciは作成できないんです。。(無料では)
もしこの構成で、非公開リポジトリと、CIでとなると、
github有料で使って、travisを有料で使ってになります!

何を使うの?

  • bitbucket
    • コンフルエンスとかで有名な、Atlassianのgitサービス
  • wercker
    • privateでciを無料で使えるサービス

使い方

簡単、両方のアカウントを使って、werckerにbitbucketを同期 チュートリアルが表示されるので、以下略です。

準備するもの

travisCIで言う、.travis.ymlのように、構成、設定ファイル
wercker.ymlをアプリケーションディレクトリ直下に作成します。
中身は

box: wercker/rvm
# Build definition
# See the Rails section on the wercker devcenter:
# http://devcenter.wercker.com/articles/languages/ruby/settingup-rails4.html
# You will want to define your database as follows:
# services:
#   - wercker/postgresql
# See more about services on our devcenter:
# http://devcenter.wercker.com/articles/services/
build:
    steps:
        # Uncomment this to force RVM to use a specific Ruby version
        - rvm-use:
              version: 2.1.1

        # A step that executes `bundle install` command
        - bundle-install

        # A step that prepares the database.yml using the database in services
        # - rails-database-yml

        # A custom script step, name value is used in the UI
        # and the code value contains the command that get executed
        - script:
            name: echo ruby information
            code: |
                echo "ruby version $(ruby --version) running"
                echo "from location $(which ruby)"
                echo -p "gem list: $(gem list)"

        # Add more steps here:
        - script:
                name: rspec
                code: bundle exec rspec
  1. rvm-useで使うrubyのversion
  2. bundle-installを実行
  3. scriptで、version等々をechoで表示
  4. scriptで、rspecを実行

これだけでci行けます!!

まだ試してないけどherokuにも、デプロイできるみたいなので

git privateリポジトリが無料で使えて CIサービスも無料で使えて デプロイも無料 アプリケーションサーバ運用も無料

無料づくしですね!