From 9800993898495c127e8ae08a5baffee9cdafaa91 Mon Sep 17 00:00:00 2001 From: Matt Petro Date: Mon, 18 Sep 2023 10:35:01 -0400 Subject: [PATCH 1/5] Remove gemfile.lock --- .gitignore | 4 +- Gemfile | 32 ------ Gemfile.lock | 308 --------------------------------------------------- 3 files changed, 2 insertions(+), 342 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index d13d5da..16533d9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,5 @@ .byebug_history test/dummy/db/* /node_modules/ - -*.gem \ No newline at end of file +*.gem +Gemfile.lock diff --git a/Gemfile b/Gemfile index fbc693d..e4d4a78 100644 --- a/Gemfile +++ b/Gemfile @@ -3,35 +3,3 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Specify your gem"s dependencies in atomic_lti.gemspec. gemspec - -gem "composite_primary_keys" - -group :development do - gem "sqlite3" -end - -group :development, :test, :linter do - gem "byebug" - gem "factory_bot_rails" - gem "rubocop" - gem "rubocop-performance" - gem "rubocop-rails" - gem "rubocop-rspec" - gem "webmock" -end - -group :test do - gem "launchy" - gem "rspec" - gem "rspec-rails" - - gem "jwt", "~>2.7.0" - gem "json-jwt" - gem "httparty" -end - -group :ci do - gem "brakeman" - gem "pronto" - gem "pronto-rubocop", require: false -end diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 1090a36..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,308 +0,0 @@ -PATH - remote: . - specs: - atomic_lti (1.5.4) - pg (~> 1.3) - rails (~> 7.0) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.8) - actionpack (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activesupport (= 7.0.8) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8) - actionview (= 7.0.8) - activesupport (= 7.0.8) - rack (~> 2.0, >= 2.2.4) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8) - actionpack (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) - globalid (>= 0.6.0) - nokogiri (>= 1.8.5) - actionview (7.0.8) - activesupport (= 7.0.8) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8) - activesupport (= 7.0.8) - globalid (>= 0.3.6) - activemodel (7.0.8) - activesupport (= 7.0.8) - activerecord (7.0.8) - activemodel (= 7.0.8) - activesupport (= 7.0.8) - activestorage (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activesupport (= 7.0.8) - marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - addressable (2.8.4) - public_suffix (>= 2.0.2, < 6.0) - aes_key_wrap (1.1.0) - ast (2.4.2) - bindata (2.4.15) - brakeman (5.4.1) - builder (3.2.4) - byebug (11.1.3) - composite_primary_keys (14.0.6) - activerecord (~> 7.0.2) - concurrent-ruby (1.2.2) - crack (0.4.5) - rexml - crass (1.0.6) - date (3.3.3) - diff-lcs (1.5.0) - erubi (1.12.0) - factory_bot (6.2.1) - activesupport (>= 5.0.0) - factory_bot_rails (6.2.0) - factory_bot (~> 6.2.0) - railties (>= 5.0.0) - faraday (2.7.4) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-follow_redirects (0.3.0) - faraday (>= 1, < 3) - faraday-net_http (3.0.2) - gitlab (4.19.0) - httparty (~> 0.20) - terminal-table (>= 1.5.1) - globalid (1.2.1) - activesupport (>= 6.1) - hashdiff (1.0.1) - httparty (0.21.0) - mini_mime (>= 1.0.0) - multi_xml (>= 0.5.2) - i18n (1.14.1) - concurrent-ruby (~> 1.0) - json (2.6.3) - json-jwt (1.16.3) - activesupport (>= 4.2) - aes_key_wrap - bindata - faraday (~> 2.0) - faraday-follow_redirects - jwt (2.7.0) - launchy (2.5.2) - addressable (~> 2.8) - loofah (2.21.3) - crass (~> 1.0.2) - nokogiri (>= 1.12.0) - mail (2.8.1) - mini_mime (>= 0.1.1) - net-imap - net-pop - net-smtp - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.5) - mini_portile2 (2.8.4) - minitest (5.20.0) - multi_xml (0.6.0) - net-imap (0.3.7) - date - net-protocol - net-pop (0.1.2) - net-protocol - net-protocol (0.2.1) - timeout - net-smtp (0.3.3) - net-protocol - nio4r (2.5.9) - nokogiri (1.15.4) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) - racc (~> 1.4) - octokit (6.1.1) - faraday (>= 1, < 3) - sawyer (~> 0.9) - parallel (1.23.0) - parser (3.2.2.1) - ast (~> 2.4.1) - pg (1.5.3) - pronto (0.11.1) - gitlab (>= 4.4.0, < 5.0) - httparty (>= 0.13.7, < 1.0) - octokit (>= 4.7.0, < 7.0) - rainbow (>= 2.2, < 4.0) - rexml (>= 3.2.5, < 4.0) - rugged (>= 0.23.0, < 2.0) - thor (>= 0.20.3, < 2.0) - pronto-rubocop (0.11.5) - pronto (~> 0.11.0) - rubocop (>= 0.63.1, < 2.0) - public_suffix (5.0.1) - racc (1.7.1) - rack (2.2.8) - rack-test (2.1.0) - rack (>= 1.3) - rails (7.0.8) - actioncable (= 7.0.8) - actionmailbox (= 7.0.8) - actionmailer (= 7.0.8) - actionpack (= 7.0.8) - actiontext (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activemodel (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) - bundler (>= 1.15.0) - railties (= 7.0.8) - rails-dom-testing (2.2.0) - activesupport (>= 5.0.0) - minitest - nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) - method_source - rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) - rainbow (3.1.1) - rake (13.0.6) - regexp_parser (2.8.0) - rexml (3.2.5) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.0.2) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.12.0) - rubocop (1.50.2) - json (~> 2.3) - parallel (~> 1.10) - parser (>= 3.2.0.0) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.0, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.28.1) - parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.22.0) - rubocop (~> 1.33) - rubocop-performance (1.17.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.19.1) - activesupport (>= 4.2.0) - rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.22.0) - rubocop (~> 1.33) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - ruby-progressbar (1.13.0) - ruby2_keywords (0.0.5) - rugged (1.6.3) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) - sqlite3 (1.6.2) - mini_portile2 (~> 2.8.0) - sqlite3 (1.6.2-x86_64-linux) - terminal-table (3.0.2) - unicode-display_width (>= 1.1.1, < 3) - thor (1.2.2) - timeout (0.4.0) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) - webmock (3.18.1) - addressable (>= 2.8.0) - crack (>= 0.3.2) - hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.7.6) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - zeitwerk (2.6.11) - -PLATFORMS - ruby - x86_64-linux - -DEPENDENCIES - atomic_lti! - brakeman - byebug - composite_primary_keys - factory_bot_rails - httparty - json-jwt - jwt (~> 2.7.0) - launchy - pronto - pronto-rubocop - rspec - rspec-rails - rubocop - rubocop-performance - rubocop-rails - rubocop-rspec - sqlite3 - webmock - -BUNDLED WITH - 2.4.10 From 4c9e40d656459a1fd2dd38a3131fe5b1ae63561f Mon Sep 17 00:00:00 2001 From: Matt Petro Date: Mon, 18 Sep 2023 10:55:23 -0400 Subject: [PATCH 2/5] Add development gems --- atomic_lti.gemspec | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/atomic_lti.gemspec b/atomic_lti.gemspec index 2a98224..ae4ad9f 100644 --- a/atomic_lti.gemspec +++ b/atomic_lti.gemspec @@ -17,4 +17,23 @@ Gem::Specification.new do |spec| spec.add_dependency "pg", "~> 1.3" spec.add_dependency "rails", "~> 7.0" + spec.add_dependency "jwt" + spec.add_dependency "json-jwt" + spec.add_dependency "httparty" + + spec.add_development_dependency "byebug" + spec.add_development_dependency "factory_bot_rails" + spec.add_development_dependency "rubocop" + spec.add_development_dependency "rubocop-performance" + spec.add_development_dependency "rubocop-rails" + spec.add_development_dependency "rubocop-rspec" + spec.add_development_dependency "webmock" + + spec.add_development_dependency "launchy" + spec.add_development_dependency "rspec" + spec.add_development_dependency "rspec-rails" + + spec.add_development_dependency "brakeman" + spec.add_development_dependency "pronto" + spec.add_development_dependency "pronto-rubocop" end From 2e05fe5781b5432a5fcf275cbddfaafc951cb313 Mon Sep 17 00:00:00 2001 From: Matt Petro Date: Mon, 18 Sep 2023 11:05:44 -0400 Subject: [PATCH 3/5] Fix github CI --- .github/workflows/github-actions-ci-rspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions-ci-rspec.yml b/.github/workflows/github-actions-ci-rspec.yml index 1c32a68..d88ecd7 100644 --- a/.github/workflows/github-actions-ci-rspec.yml +++ b/.github/workflows/github-actions-ci-rspec.yml @@ -43,7 +43,7 @@ jobs: - name: Install dependencies env: RAILS_ENV: test - RAILS_GROUPS: build + RAILS_GROUPS: development run: | bundle install From 53c4e5b49876ebbce37037ebd776d9af2a111f6a Mon Sep 17 00:00:00 2001 From: Matt Petro Date: Mon, 18 Sep 2023 11:16:04 -0400 Subject: [PATCH 4/5] Fix gemspec dependencies --- atomic_lti.gemspec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/atomic_lti.gemspec b/atomic_lti.gemspec index ae4ad9f..e4a08c8 100644 --- a/atomic_lti.gemspec +++ b/atomic_lti.gemspec @@ -15,11 +15,11 @@ Gem::Specification.new do |spec| spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - spec.add_dependency "pg", "~> 1.3" - spec.add_dependency "rails", "~> 7.0" - spec.add_dependency "jwt" - spec.add_dependency "json-jwt" - spec.add_dependency "httparty" + spec.add_runtime_dependency "httparty" + spec.add_runtime_dependency "json-jwt" + spec.add_runtime_dependency "jwt" + spec.add_runtime_dependency "pg", "~> 1.3" + spec.add_runtime_dependency "rails", "~> 7.0" spec.add_development_dependency "byebug" spec.add_development_dependency "factory_bot_rails" @@ -32,7 +32,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "launchy" spec.add_development_dependency "rspec" spec.add_development_dependency "rspec-rails" - + spec.add_development_dependency "brakeman" spec.add_development_dependency "pronto" spec.add_development_dependency "pronto-rubocop" From 06b0f2e087ce00b4d2e20c580c07cf6906102d1f Mon Sep 17 00:00:00 2001 From: Matt Petro Date: Wed, 27 Sep 2023 09:52:07 -0400 Subject: [PATCH 5/5] Fix CI --- .../workflows/github-actions-ci-brakeman.yml | 8 ++- .github/workflows/github-actions-ci-jest.yml | 27 +++------ .github/workflows/github-actions-ci-lint.yml | 58 ++++++------------- .github/workflows/github-actions-ci-rspec.yml | 36 +++--------- 4 files changed, 42 insertions(+), 87 deletions(-) diff --git a/.github/workflows/github-actions-ci-brakeman.yml b/.github/workflows/github-actions-ci-brakeman.yml index 0418549..bc54994 100644 --- a/.github/workflows/github-actions-ci-brakeman.yml +++ b/.github/workflows/github-actions-ci-brakeman.yml @@ -9,13 +9,19 @@ on: jobs: brakeman: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest] + ruby: ['3.2.2'] + runs-on: ${{ matrix.os }} + steps: - name: Checkout code uses: actions/checkout@v3 - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: + ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Security audit application code run: bundle exec brakeman -q -w2 diff --git a/.github/workflows/github-actions-ci-jest.yml b/.github/workflows/github-actions-ci-jest.yml index e914fdb..6c7275f 100644 --- a/.github/workflows/github-actions-ci-jest.yml +++ b/.github/workflows/github-actions-ci-jest.yml @@ -4,31 +4,20 @@ on: pull_request jobs: jest-test: - - runs-on: ubuntu-latest - strategy: matrix: - node-version: [14.x] - + os: [ubuntu-latest] + node: [14.x] + runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} + uses: actions/checkout@v3 - - name: Cache Node.js modules - uses: actions/cache@v2 + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v3 with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node- - ${{ runner.OS }}- + node-version: ${{ matrix.node }} + cache: 'yarn' - name: Install dependencies run: yarn install --pure-lockfile diff --git a/.github/workflows/github-actions-ci-lint.yml b/.github/workflows/github-actions-ci-lint.yml index ef30fa4..39d03fe 100644 --- a/.github/workflows/github-actions-ci-lint.yml +++ b/.github/workflows/github-actions-ci-lint.yml @@ -1,58 +1,38 @@ +name: Pronto + on: [pull_request] -name: Pronto +permissions: + contents: read + pull-requests: write + statuses: write jobs: linters: name: Linters - runs-on: ubuntu-latest strategy: matrix: - ruby-version: [2.7] + os: [ubuntu-latest] + ruby: ['3.2.2'] + runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v2 - run: | - git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/* + git fetch --no-tags --prune --depth=60 origin +refs/heads/*:refs/remotes/origin/* - name: Setup Ruby uses: ruby/setup-ruby@v1 - - - name: Ruby gem cache - uses: actions/cache@v1 with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - - name: Install gems - run: | - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: 14.x - - - name: Find yarn cache location - id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: JS package cache - uses: actions/cache@v1 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install packages - run: | - yarn install --pure-lockfile + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Setup pronto + run: gem install pronto pronto-rubocop - name: Run Pronto - run: | - PRONTO_PULL_REQUEST_ID="${{ github.event.pull_request.number }}" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }} + run: bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }} + env: + PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }} + PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}" \ No newline at end of file diff --git a/.github/workflows/github-actions-ci-rspec.yml b/.github/workflows/github-actions-ci-rspec.yml index d88ecd7..4aa42c1 100644 --- a/.github/workflows/github-actions-ci-rspec.yml +++ b/.github/workflows/github-actions-ci-rspec.yml @@ -4,12 +4,11 @@ on: pull_request jobs: rspec-test: - - runs-on: ubuntu-latest - strategy: matrix: - ruby-version: [2.7] + os: [ubuntu-latest] + ruby: ["3.2.2"] + runs-on: ${{ matrix.os }} # Service containers to run with `container-job` services: @@ -34,40 +33,21 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Set up Ruby ${{ matrix.ruby-version }} + - name: Set up Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby-version }} + ruby-version: ${{ matrix.ruby }} bundler-cache: true - - - name: Install dependencies env: - RAILS_ENV: test - RAILS_GROUPS: development - run: | - bundle install + BUNDLE_WITH: development - name: Copy database config yml run: cp test/dummy/config/ci.database.yml test/dummy/config/database.yml - - name: Create db - env: - RAILS_ENV: test - run: bin/rails db:create - - name: Run migrations env: RAILS_ENV: test run: bin/rails db:migrate - - - name: Prepare assets - env: - RAILS_ENV: test - run: bundle exec rake db:test:prepare - - - name: Run tests - env: - RAILS_ENV: test - run: bundle exec rspec - + - name: Preparing assets and running tests + run: bundle exec rake