From bbf68a5b9232ed74d08c7b15467f81b903dca7e8 Mon Sep 17 00:00:00 2001 From: Kivanio Barbosa Date: Mon, 7 Aug 2023 08:19:34 -0400 Subject: [PATCH] Drop support for ended ruby versions --- .github/workflows/brakeman.yml | 63 ++++++++++++++++---------------- .github/workflows/codeql.yml | 67 +++++++++++++++++----------------- .github/workflows/linters.yml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/rubocop.yml | 66 ++++++++++++++++----------------- .rubocop.yml | 2 +- .ruby-version | 2 +- brcobranca.gemspec | 2 +- spec/brcobranca/rghost_spec.rb | 2 +- 9 files changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/brakeman.yml b/.github/workflows/brakeman.yml index b451745b1..7cef51dda 100644 --- a/.github/workflows/brakeman.yml +++ b/.github/workflows/brakeman.yml @@ -10,12 +10,12 @@ name: Brakeman Scan on: push: - branches: [ "master" ] + branches: ['master'] pull_request: # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '28 13 * * 4' + branches: ['master'] + # schedule: + # - cron: '28 13 * * 4' permissions: contents: read @@ -29,30 +29,31 @@ jobs: name: Brakeman Scan runs-on: ubuntu-latest steps: - # Checkout the repository to the GitHub Actions runner - - name: Checkout - uses: actions/checkout@v3 - - # Customize the ruby version depending on your needs - - name: Setup Ruby - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 - with: - ruby-version: '2.7' - - - name: Setup Brakeman - env: - BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+ - run: | - gem install brakeman --version $BRAKEMAN_VERSION - - # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis - - name: Scan - continue-on-error: true - run: | - brakeman -f sarif -o output.sarif.json . - - # Upload the SARIF file generated in the previous step - - name: Upload SARIF - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: output.sarif.json + # Checkout the repository to the GitHub Actions runner + - name: Checkout + uses: actions/checkout@v3 + + # Customize the ruby version depending on your needs + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Setup Brakeman + env: + BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+ + run: | + gem install brakeman --version $BRAKEMAN_VERSION + + # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis + - name: Scan + continue-on-error: true + run: | + brakeman -f sarif -o output.sarif.json . + + # Upload the SARIF file generated in the previous step + - name: Upload SARIF + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: output.sarif.json diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 02618e8ef..2e784ce76 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,16 +9,16 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "master" ] + branches: ['master'] pull_request: # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '41 19 * * 4' + branches: ['master'] + # schedule: + # - cron: '41 19 * * 4' jobs: analyze: @@ -33,45 +33,44 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'ruby' ] + language: ['ruby'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] # Use only 'java' to analyze code written in Java, Kotlin or both # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: '/language:${{matrix.language}}' diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index b868f98e9..cdc097771 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -2,7 +2,7 @@ name: linters on: push: branches: [master] - pull_request: + pull_request: ['master'] jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d730e845..1128c23a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: name: Test against Ruby ${{ matrix.ruby-version }} strategy: matrix: - ruby-version: [2.6, 2.7, 3.0, 3.1, 3.2] + ruby-version: [2.7, 3.0, 3.1, 3.2] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 818da089f..2f2c41267 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -4,16 +4,16 @@ # documentation. # pulled from repo -name: "Rubocop" +name: 'Rubocop' on: push: - branches: [ "master" ] + branches: ['master'] pull_request: # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '33 3 * * 6' + branches: ['master'] + # schedule: + # - cron: '33 3 * * 6' jobs: rubocop: @@ -22,31 +22,31 @@ jobs: fail-fast: false steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # If running on a self-hosted runner, check it meets the requirements - # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners - - name: Set up Ruby - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 - with: - ruby-version: 2.6 - - # This step is not necessary if you add the gem to your Gemfile - - name: Install Code Scanning integration - run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install - - - name: Install dependencies - run: bundle install - - - name: Rubocop run - run: | - bash -c " - bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif - [[ $? -ne 2 ]] - " - - - name: Upload Sarif output - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: rubocop.sarif + - name: Checkout repository + uses: actions/checkout@v3 + + # If running on a self-hosted runner, check it meets the requirements + # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners + - name: Set up Ruby + uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 + with: + ruby-version: 2.6 + + # This step is not necessary if you add the gem to your Gemfile + - name: Install Code Scanning integration + run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install + + - name: Install dependencies + run: bundle install + + - name: Rubocop run + run: | + bash -c " + bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif + [[ $? -ne 2 ]] + " + + - name: Upload Sarif output + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: rubocop.sarif diff --git a/.rubocop.yml b/.rubocop.yml index db35466fb..35ba32f9f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,7 +6,7 @@ require: AllCops: NewCops: enable - TargetRubyVersion: 2.6 + TargetRubyVersion: 2.7 SuggestExtensions: false Style/FrozenStringLiteralComment: diff --git a/.ruby-version b/.ruby-version index 944880fa1..be94e6f53 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.0 +3.2.2 diff --git a/brcobranca.gemspec b/brcobranca.gemspec index 4d6d3d863..205472f6f 100644 --- a/brcobranca.gemspec +++ b/brcobranca.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |gem| gem.homepage = 'http://rubygems.org/gems/brcobranca' gem.files = Dir['Rakefile', '{lib}/**/*', 'README*', 'LICENSE*', 'CHANGELOG*', 'History*'] gem.require_paths = ['lib'] - gem.required_ruby_version = '>= 2.6.0' + gem.required_ruby_version = '>= 2.7.0' gem.requirements = ['GhostScript > 9.0, para gerar PDF e código de Barras'] diff --git a/spec/brcobranca/rghost_spec.rb b/spec/brcobranca/rghost_spec.rb index 20ab3e337..2dca102e7 100644 --- a/spec/brcobranca/rghost_spec.rb +++ b/spec/brcobranca/rghost_spec.rb @@ -24,6 +24,6 @@ s = `#{RGhost::Config::GS[:path]} -v` expect(s).to match(/^GPL Ghostscript/) s = `#{RGhost::Config::GS[:path]} --version` - expect(s).to match(/[8-9]\.[0-9]/) + expect(s).to match(/[8-9]\.[0-9]|[1-9][0-9]*\.[0-9]+\.[0-9]+/) end end