From d701ee8617a15a7fc819de239ce3993d6a17d359 Mon Sep 17 00:00:00 2001 From: o200 Date: Wed, 20 Aug 2025 16:33:55 +0700 Subject: [PATCH 1/4] configure brakeman --- .github/workflows/brakeman.yml | 24 +++++++++++------------- README.md | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/brakeman.yml b/.github/workflows/brakeman.yml index 0a64ca04c0..899d3f56bc 100644 --- a/.github/workflows/brakeman.yml +++ b/.github/workflows/brakeman.yml @@ -1,23 +1,21 @@ name: Brakeman on: - pull_request: - branches: - master + push: + branches: main jobs: brakeman: - runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - # Will run Brakeman checks on dependencies - # https://github.com/marketplace/actions/brakeman-action - - name: Brakeman - uses: artplan1/brakeman-action@v1.2.1 - with: - flags: "--color" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Will run Brakeman checks on dependencies + # https://github.com/marketplace/actions/brakeman-action + - name: Brakeman + uses: artplan1/brakeman-action@v1.2.1 + with: + flags: "--color" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index e0c2c366b9..50f9ababf1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## DMP Roadmap -[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Brakeman/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) +[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Brakeman/badge.svg?branch=main)](https://github.com/DMPRoadmap/roadmap/actions/workflows/brakeman.yml) [![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Rubocop/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) [![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/ESLint/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) [![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Tests%20-%20PostgreSQL/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) From 385c73f6b239c32854cfd3b9d090ec6096722132 Mon Sep 17 00:00:00 2001 From: o200 Date: Thu, 21 Aug 2025 08:29:13 +0700 Subject: [PATCH 2/4] set 'Tests - PostgreSQL' on push, format --- .github/workflows/postgres.yml | 172 ++++++++++++++++----------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 517fd35954..0f748737c7 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -1,6 +1,6 @@ name: Tests - PostgreSQL -on: [pull_request] +on: [push, pull_request] jobs: postgresql: @@ -16,7 +16,7 @@ jobs: # variable to bypass this changes: # https://github.com/docker-library/postgres/issues/681 POSTGRES_HOST_AUTH_METHOD: trust - ports: ['5432:5432'] + ports: ["5432:5432"] options: >- --health-cmd pg_isready --health-interval 10s @@ -30,87 +30,87 @@ jobs: DISABLE_SPRING: 1 steps: - # Checkout the repo - - uses: actions/checkout@v3 - - # Install Ruby and run bundler - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - ## - run: echo 'NODE_OPTIONS="--openssl-legacy-provider"' >> $GITHUB_ENV - ## /home/runner/runners/2.301.1/externals/node12/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS - - # Install Node - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: 'yarn' - - # Install the Postgres developer packages - - name: 'Install Postgresql Packages' - run: | - sudo apt-get update - sudo apt-get install libpq-dev - - # Install ImageMagick (for `identify` command) - - name: 'Install ImageMagick' - run: | - sudo apt-get install -y imagemagick - - # Copy all of the example configs over - - name: 'Setup Default Configuration' - run: | - cp config/database.yml.sample config/database.yml - cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb - cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb - cp .env.postgresql .env - - # Stub out the Rails credentials file so that we can start the Rails app - - name: 'Setup Credentials' - run: | - # generate a default credential file and key - EDITOR="sh -c 'echo \"$(cat config/credentials.yml.postgresql)\" > \$1' --" bundle exec rails credentials:edit - - # Set the path to the wkhtmltopdf executable - - name: 'Determine wkhtmltopdf location' - run: echo "WICKED_PDF_PATH=`bundle exec which wkhtmltopdf`" >> $GITHUB_ENV - - # Run yarn install for JS dependencies - - name: 'Yarn Install' - run: | - yarn install - - # TEMPORARY WORKAROUND FOR THE FOLLOWING ISSUE: https://github.com/DMPRoadmap/roadmap/issues/3485 - # Remove this once our tests are compatible with the new version of Chrome - # Source: https://github.com/teamcapybara/capybara/issues/2800#issuecomment-2731100953 - - name: Remove image-bundled Chrome - run: sudo apt-get purge google-chrome-stable - - name: Setup stable Chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: 128 - install-chromedriver: true - install-dependencies: true - - # Initialize the DB - - name: 'Setup Test DB' - run: | - bundle exec rails db:setup - bundle exec rails db:migrate - - # Prebuild the CSS, JS and image assets - - name: 'Compile Assets' - run: bundle exec rails assets:precompile - - # Run the unit and functional tests - - name: 'Run Rspec Unit and Functional Tests' - run: | - bundle exec rspec spec/models/ spec/policies/ spec/services/ spec/helpers/ - bundle exec rspec spec/controllers/ spec/presenters/ spec/requests/ spec/views - bundle exec rspec spec/mixins/ - - # Run the time consuming integration tests (using Chrome headless browser) - - name: 'Run Integration Tests' - run: bundle exec rspec spec/features/ + # Checkout the repo + - uses: actions/checkout@v3 + + # Install Ruby and run bundler + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.0" + bundler-cache: true + + ## - run: echo 'NODE_OPTIONS="--openssl-legacy-provider"' >> $GITHUB_ENV + ## /home/runner/runners/2.301.1/externals/node12/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS + + # Install Node + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "yarn" + + # Install the Postgres developer packages + - name: "Install Postgresql Packages" + run: | + sudo apt-get update + sudo apt-get install libpq-dev + + # Install ImageMagick (for `identify` command) + - name: "Install ImageMagick" + run: | + sudo apt-get install -y imagemagick + + # Copy all of the example configs over + - name: "Setup Default Configuration" + run: | + cp config/database.yml.sample config/database.yml + cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb + cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb + cp .env.postgresql .env + + # Stub out the Rails credentials file so that we can start the Rails app + - name: "Setup Credentials" + run: | + # generate a default credential file and key + EDITOR="sh -c 'echo \"$(cat config/credentials.yml.postgresql)\" > \$1' --" bundle exec rails credentials:edit + + # Set the path to the wkhtmltopdf executable + - name: "Determine wkhtmltopdf location" + run: echo "WICKED_PDF_PATH=`bundle exec which wkhtmltopdf`" >> $GITHUB_ENV + + # Run yarn install for JS dependencies + - name: "Yarn Install" + run: | + yarn install + + # TEMPORARY WORKAROUND FOR THE FOLLOWING ISSUE: https://github.com/DMPRoadmap/roadmap/issues/3485 + # Remove this once our tests are compatible with the new version of Chrome + # Source: https://github.com/teamcapybara/capybara/issues/2800#issuecomment-2731100953 + - name: Remove image-bundled Chrome + run: sudo apt-get purge google-chrome-stable + - name: Setup stable Chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: 128 + install-chromedriver: true + install-dependencies: true + + # Initialize the DB + - name: "Setup Test DB" + run: | + bundle exec rails db:setup + bundle exec rails db:migrate + + # Prebuild the CSS, JS and image assets + - name: "Compile Assets" + run: bundle exec rails assets:precompile + + # Run the unit and functional tests + - name: "Run Rspec Unit and Functional Tests" + run: | + bundle exec rspec spec/models/ spec/policies/ spec/services/ spec/helpers/ + bundle exec rspec spec/controllers/ spec/presenters/ spec/requests/ spec/views + bundle exec rspec spec/mixins/ + + # Run the time consuming integration tests (using Chrome headless browser) + - name: "Run Integration Tests" + run: bundle exec rspec spec/features/ From 7c421cc81ef920fd13f9229ca1f92f6cbe6fb1ad Mon Sep 17 00:00:00 2001 From: o200 Date: Thu, 21 Aug 2025 08:45:12 +0700 Subject: [PATCH 3/4] configure badges links, hide disabled "Tests - MySQL" --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 50f9ababf1..adfb83e355 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ ## DMP Roadmap [![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Brakeman/badge.svg?branch=main)](https://github.com/DMPRoadmap/roadmap/actions/workflows/brakeman.yml) -[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Rubocop/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) -[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/ESLint/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) -[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Tests%20-%20PostgreSQL/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) -[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Tests%20-%20MySQL/badge.svg)](https://github.com/DMPRoadmap/roadmap/actions) +[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Rubocop/badge.svg?branch=main)](https://github.com/DMPRoadmap/roadmap/actions/workflows/rubocop.yml) +[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/ESLint/badge.svg?branch=main)](https://github.com/DMPRoadmap/roadmap/actions/workflows/eslint.yml) +[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Tests%20-%20PostgreSQL/badge.svg?branch=main)](https://github.com/DMPRoadmap/roadmap/actions/workflows/postgres.yml) +[![Actions Status](https://github.com/DMPRoadmap/roadmap/workflows/Danger/badge.svg?branch=main)](https://github.com/DMPRoadmap/roadmap/actions/workflows/danger.yml) + + DMP Roadmap is a Data Management Planning tool. Management and development of DMP Roadmap is jointly provided by the Digital Curation Centre (DCC), http://www.dcc.ac.uk/, and the University of California Curation Center (UC3), http://www.cdlib.org/services/uc3/. From 155f7f045b6392e03d8738780d0ee6420ef89730 Mon Sep 17 00:00:00 2001 From: o200 Date: Thu, 21 Aug 2025 13:56:42 +0700 Subject: [PATCH 4/4] made Brakeman to work on next-release/* brances --- .github/workflows/brakeman.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/brakeman.yml b/.github/workflows/brakeman.yml index 899d3f56bc..52ecd71cf1 100644 --- a/.github/workflows/brakeman.yml +++ b/.github/workflows/brakeman.yml @@ -2,7 +2,9 @@ name: Brakeman on: push: - branches: main + branches: + - main + - next-release/* jobs: brakeman: