diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index d5d1b6e2b5..0c422ee2c9 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -1,6 +1,6 @@ name: Code style -on: [pull_request] +on: [ pull_request ] jobs: lint: @@ -9,10 +9,7 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 - - uses: ruby/setup-ruby@v1 - with: - version: 2.7.8 - bundler-cache: true + - name: Checkout code + uses: actions/checkout@v3 - name: rubocop - run: bundle exec rubocop --parallel + run: bin/ontoportal run bundle exec rubocop --parallel diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c489db6e7c..42b72fd830 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,61 +1,23 @@ -# 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 download a prebuilt Ruby version, install dependencies and run tests with Rake -# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby -name: "Run local API tests CI" +name: RuboCop + +on: [push, pull_request] -on: - push: - pull_request: - types: [ opened, reopened ] -env: - API_URL: http://localhost:9393 - REMOTE_API_KEY: 8b5b7825-538d-40e0-9e9e-5ab9274a9aeb - REMOTE_API_URL: https://data.bioontology.org - BIOMIXER_URL: ${{ secrets.BIOMIXER_URL }} - FAIRNESS_URL: ${{ secrets.FAIRNESS_URL }} - ANNOTATOR_URL: ${{ secrets.ANNOTATOR_URL }} - DB_HOST: 127.0.0.1 jobs: - test: + rubocop: runs-on: ubuntu-latest - services: - mysql: - image: mysql:8.0 - ports: - - "3306:3306" - env: - MYSQL_ROOT_PASSWORD: root - memcached: - image: memcached:1.6 - ports: - - 11211:11211 + steps: - - name: Checkout code - uses: actions/checkout@v3 - # Add or replace dependency steps here - - name: Install Ruby and gems + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 - bundler-cache: true + ruby-version: 2.7 # You can change this to your preferred Ruby version - - name: Run OntoPortal API - run: bin/run_api -k ${{ env.REMOTE_API_KEY }} -r agroportal -t development -s STY -u ${{ env.REMOTE_API_URL }} + - name: Install RuboCop + run: + gem install rubocop rubocop-rails - # Add or replace database setup steps here - - name: set up config file - run: cp config/database.yml.sample config/database.yml - - name: Set up database schema - run: RAILS_ENV=test bin/rails db:setup - - name: Set up yarn - run: yarn install - # Add or replace test runners here - - name: Run tests - run: COVERAGE=true RAILS_ENV=test bin/rails test -v - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + - name: Run RuboCop + run: rubocop --parallel diff --git a/.rubocop.yml b/.rubocop.yml index 749cca2173..42db2ccbea 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,5 @@ AllCops: + NewCops: disable Exclude: - db/migrate/**/* - db/schema.rb @@ -61,4 +62,14 @@ Lint/UnusedMethodArgument: AutoCorrect: false Rails/HasAndBelongsToMany: - Enabled: false \ No newline at end of file + Enabled: false + +Layout/HeredocIndentation: + Enabled: false + +Style/MissingRespondToMissing: + Enabled: false + +Lint/MissingSuper: + Enabled: true + diff --git a/Gemfile.lock b/Gemfile.lock index 4e8e6c1b5b..d4b31ebbae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,7 +102,7 @@ GEM bigdecimal (3.1.6) bindata (2.4.15) bindex (0.8.1) - bootsnap (1.17.1) + bootsnap (1.18.3) msgpack (~> 1.2) bootstrap (4.2.1) autoprefixer-rails (>= 9.1.0) @@ -144,13 +144,14 @@ GEM addressable cube-ruby (0.0.3) daemons (1.4.1) - dalli (3.2.6) + dalli (3.2.7) + base64 date (3.3.4) debug (1.9.1) irb (~> 1.10) reline (>= 0.3.8) deepl-rb (2.5.3) - diff-lcs (1.5.0) + diff-lcs (1.5.1) docile (1.4.0) domain_name (0.6.20240107) ed25519 (1.3.0) @@ -176,9 +177,8 @@ GEM flamegraph (0.9.5) globalid (1.2.1) activesupport (>= 6.1) - graphql (2.2.5) - racc (~> 1.4) - graphql-client (0.18.0) + graphql (2.2.7) + graphql-client (0.19.0) activesupport (>= 3.0) graphql haml (5.2.2) @@ -313,7 +313,7 @@ GEM net-protocol net-ssh (7.2.1) netrc (0.11.0) - newrelic_rpm (9.7.0) + newrelic_rpm (9.7.1) nio4r (2.7.0) nokogiri (1.15.5-x86_64-linux) racc (~> 1.4) @@ -330,21 +330,22 @@ GEM hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection - omniauth-github (2.0.0) + omniauth-github (2.0.1) omniauth (~> 2.0) - omniauth-oauth2 (~> 1.7.1) - omniauth-google-oauth2 (0.8.0) + omniauth-oauth2 (~> 1.8) + omniauth-google-oauth2 (1.1.1) jwt (>= 2.0) - omniauth (>= 1.1.1) - omniauth-oauth2 (>= 1.6) - omniauth-keycloak (1.5.1) + oauth2 (~> 2.0.6) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.8.0) + omniauth-keycloak (1.5.2) faraday json-jwt (> 1.13.0) omniauth (>= 2.0) - omniauth-oauth2 (~> 1.7.1) - omniauth-oauth2 (1.7.3) + omniauth-oauth2 (>= 1.7, < 1.9) + omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) - omniauth (>= 1.9, < 3) + omniauth (~> 2.0) omniauth-orcid (2.1.1) omniauth-oauth2 (~> 1.3) ruby_dig (~> 0.0.2) @@ -437,7 +438,7 @@ GEM rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.1.0) + rspec-rails (6.1.1) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1)