junohm410 / fjord-flea-market

A closed flea market app for FjordBootCamp members to easily buy and sell items within the community, featuring automated buyer selection and Discord notifications.
0 stars 0 forks source link

CI環境構築を行う #6

Closed junohm410 closed 2 months ago

junohm410 commented 3 months ago

次のプラクティスを参考に、CI環境を整える。 サービスはGitHub Actionsを使う。

プラクティス CI | FBC

junohm410 commented 2 months ago

試しにCI設定ファイルを書いてみたところ、net-popのダウンロードでエラーが発生。

Downloading net-pop-0.1.2 revealed dependencies not in the API or the lockfile
(net-protocol (>= 0)).
Running `bundle update net-pop` should fix the problem.
Error: The process '/opt/hostedtoolcache/Ruby/3.3.3/x64/bin/bundle' failed with exit code 34
name: "test"
on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:11-alpine
        ports:
          - "5432:5432"
        env:
          POSTGRES_DB: rails_test
          POSTGRES_USER: rails
          POSTGRES_PASSWORD: password
    env:
      RAILS_ENV: test
      DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      - name: Install Ruby and gems
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: assets precompile
        run: bundle exec rake assets:precompile
      - name: Set up database schema
        run: bin/rails db:schema:load
      - name: Run tests
        run: bundle exec rspec

Rubyのバージョンの問題と思われるので、まずはそちらの対応を行う。 Ruby 3.3.3にアップグレードするとbundle installでnet-popがインストールできない|TechRacho by BPS株式会社

junohm410 commented 2 months ago

テストとLintについて、それぞれ以下のPRで設定を行った。