From d3d6703232d39baaaa59b87d12ed3f4ac2e6f618 Mon Sep 17 00:00:00 2001 From: Eleazar Meza Date: Fri, 23 Aug 2024 11:47:08 +0200 Subject: [PATCH 1/3] Created rubyonrails.yml --- .github/workflows/rubyonrails.yml | 57 +++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/rubyonrails.yml diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml new file mode 100644 index 0000000..7f96353 --- /dev/null +++ b/.github/workflows/rubyonrails.yml @@ -0,0 +1,57 @@ +# This workflow uses actions that are not certified by GitHub. They are +# provided by a third-party and are governed by separate terms of service, +# privacy policy, and support documentation. +# +# This workflow will install a prebuilt Ruby version, install dependencies, and +# run tests and linters. +name: "Ruby on Rails CI" +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] +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 + # Add or replace dependency steps here + - name: Install Ruby and gems + uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1 + with: + bundler-cache: true + # Add or replace test runners here + - name: Run tests + run: bundle exec rspec + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Ruby and gems + uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1 + with: + bundler-cache: true + - name: Generate binstubs + run: bundle binstubs bundler-audit brakeman rubocop + # Add or replace any other lints here + - name: Security audit dependencies + run: bin/bundler-audit --update + - name: Security audit application code + run: bin/brakeman -q -w2 + - name: Lint Ruby files + run: bin/rubocop --parallel From 79bc46b12d11ebf447d6a7d54f2115f10b7c4591 Mon Sep 17 00:00:00 2001 From: Eleazar Meza Date: Fri, 23 Aug 2024 11:47:21 +0200 Subject: [PATCH 2/3] Created .ruby-version --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..a0891f5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.4 From ad3f0b8f9270a59b56e1da9326a3349aa3fc342f Mon Sep 17 00:00:00 2001 From: Eleazar Meza Date: Fri, 23 Aug 2024 12:02:53 +0200 Subject: [PATCH 3/3] Changed action image to ruby:3.3.4 --- .github/workflows/rubyonrails.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml index 7f96353..573b383 100644 --- a/.github/workflows/rubyonrails.yml +++ b/.github/workflows/rubyonrails.yml @@ -12,7 +12,7 @@ on: branches: [ "develop" ] jobs: test: - runs-on: ubuntu-latest + runs-on: ruby:3.3.4 services: postgres: image: postgres:11-alpine @@ -38,7 +38,7 @@ jobs: run: bundle exec rspec lint: - runs-on: ubuntu-latest + runs-on: ruby:3.3.4 steps: - name: Checkout code uses: actions/checkout@v4