From 71de355e5660e9357d7dd1fa562c6d4e63656aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gilberto=20Saraiva?= Date: Sun, 5 May 2024 09:15:42 -0300 Subject: [PATCH] 104 Remove cp from ruby.yml workflow (#106) * Remove cp from ruby.yml workflow * change workflow of tests to production * return to rails env test in pipeline * remove database.ci and return production configs to database.yml * Reorder process in ruby.yml * Rollback setup-ruby@v1 * Update codeclimate-action to v6.0.0 * remove problematic and not useful test * change postgres:12 to alpine version in ruby.yml --- .github/workflows/ruby.yml | 20 +++++++++---------- config/database.ci.yml | 7 ------- config/database.yml | 7 +++++-- .../user_searches_for_a_job_spec.rb | 18 ----------------- 4 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 config/database.ci.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 519367c..7720666 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -19,7 +19,7 @@ jobs: services: postgres: - image: postgres:12 + image: postgres:12-alpine ports: ['5432:5432'] env: POSTGRES_PASSWORD: password @@ -31,7 +31,11 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update && sudo apt-get -yqq install libpq-dev - name: Setup Ruby uses: ruby/setup-ruby@v1 @@ -39,14 +43,11 @@ jobs: ruby-version: 3.0.5 bundler-cache: true - - name: Install dependencies - run: | - sudo apt-get update && sudo apt-get -yqq install libpq-dev - bundle install --jobs 4 --retry 3 + - name: Install Ruby dependencies + run: bundle install --jobs 4 --retry 3 - name: Analyze code - run: | - bundle exec rubocop + run: bundle exec rubocop - name: Run tests env: @@ -54,11 +55,10 @@ jobs: PGHOST: localhost DISABLE_SPRING: 1 run: | - cp config/database.ci.yml config/database.yml bundle exec rails db:schema:load bundle exec rspec --format progress - name: Publish code coverage - uses: paambaati/codeclimate-action@v3.0.0 + uses: paambaati/codeclimate-action@v6.0.0 env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} diff --git a/config/database.ci.yml b/config/database.ci.yml deleted file mode 100644 index 9c38ad7..0000000 --- a/config/database.ci.yml +++ /dev/null @@ -1,7 +0,0 @@ -test: - adapter: postgresql - encoding: unicode - pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> - database: <%= ENV["POSTGRES_DB"] %> - username: <%= ENV['POSTGRES_USER'] %> - password: <%= ENV["POSTGRES_PASSWORD"] %> \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index 5604318..7543be6 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,7 +3,7 @@ default: &default encoding: unicode pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> # url: <%= ENV["DATABASE_URL"] %> - port: 5439 + # port: 5439 development: <<: *default @@ -11,7 +11,10 @@ development: test: <<: *default - database: alljobs_test + # database: alljobs_test + database: <%= ENV["POSTGRES_DB"] %> + username: <%= ENV['POSTGRES_USER'] %> + password: <%= ENV["POSTGRES_PASSWORD"] %> production: <<: *default diff --git a/spec/system/job_opening/user_searches_for_a_job_spec.rb b/spec/system/job_opening/user_searches_for_a_job_spec.rb index 22d6cf9..47aecbb 100644 --- a/spec/system/job_opening/user_searches_for_a_job_spec.rb +++ b/spec/system/job_opening/user_searches_for_a_job_spec.rb @@ -22,24 +22,6 @@ expect(page).to have_link(job.title) end - xit 'search with sucess, only correct results' do - allow(SecureRandom).to receive(:alphanumeric).with(8).and_return('ABC12345') - job1 = create(:job) - allow(SecureRandom).to receive(:alphanumeric).with(8).and_return('ABC54321') - job2 = create(:job) - allow(SecureRandom).to receive(:alphanumeric).with(8).and_return('ZZZZZZZZ') - create(:job) - - visit root_path - fill_in I18n.t('search_job'), with: 'ABC' - click_on I18n.t('search') - - expect(page).to have_content('ABC') - expect(page).to have_content(job1.code) - expect(page).to have_content(job2.code) - expect(page).not_to have_content('ZZZZZZZZ') - end - it 'search with sucess, no one result' do visit root_path fill_in I18n.t('search_job'), with: 'ZZZZZZZ'