lef237 / quotelist

引用箱 クオートリスト QuoteList
MIT License
6 stars 0 forks source link

[CI]GitHub ActionsでLintが走るようにした #27

Closed lef237 closed 1 year ago

lef237 commented 1 year ago

https://github.com/lef237/quotelist/actions/new

ここからテンプレートを選んで、それを元に改変していくと簡単にCIを構築できる。

今回はRuby on Railsを選択して、そこに改変を加えた。

lef237 commented 1 year ago

RSpecのCI設定については、別のファイルに分ける。

Run bin/rails db:schema:load
/home/runner/work/quotelist/quotelist/db/schema.rb doesn't exist yet. Run `bin/rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /home/runner/work/quotelist/quotelist/config/application.rb to limit the frameworks that will be loaded.

というエラーが出たため、schema.rbを作成してから設定してみる。

また、テストのCIに関しては、

# JSのビルド
yarn build
# CSSのビルド
yarn build:css 

をGitHub Actionsのファイルでおこなう必要がありそう。

bin/devyarn buildyarn build:cssを随時行ってくれる機能

lef237 commented 1 year ago

Specifying the Ruby version | Building and testing Ruby - GitHub Docs

- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108
  with:
    ruby-version: '3.1' # Not needed with a .ruby-version file

つまり、.ruby-versionのファイルがあるときは、Rubyのバージョンを指定してあげなくても大丈夫。