From 423e86c4635187ff08e272378c5253513f397ab9 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:13:53 -0700 Subject: [PATCH 01/11] bump ruby-version, stricter npm lockfile --- .ruby-version | 2 +- rswag-ui/package-lock.json | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.ruby-version b/.ruby-version index ec1cf33..37c2961 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.3 +2.7.2 diff --git a/rswag-ui/package-lock.json b/rswag-ui/package-lock.json index 461291a..4c73fc0 100644 --- a/rswag-ui/package-lock.json +++ b/rswag-ui/package-lock.json @@ -1,11 +1,13 @@ { "name": "rswag-ui", "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, "dependencies": { "swagger-ui-dist": { "version": "3.28.0", - "from": "swagger-ui-dist@3.28.0", - "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-3.28.0.tgz" + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-3.28.0.tgz", + "integrity": "sha512-aPkfTzPv9djSiZI1NUkWr5HynCUsH+jaJ0WSx+/t19wq7MMGg9clHm9nGoIpAtqml1G51ofI+I75Ym72pukzFg==" } } } From ea89b0b0d56c4bde2080d08064951c76cef48716 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:16:17 -0700 Subject: [PATCH 02/11] Github Actions CI --- .github/workflows/ruby.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..cb7feb4 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,32 @@ +# 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: Ruby + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, + # change this to (see https://github.com/ruby/setup-ruby#versioning): + # uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 + with: + ruby-version: 2.6 + - name: Install dependencies + run: ./ci/build.sh + - name: Run tests + run: ./ci/test.sh From e4196352096be6e2c421db908088d1b2d2050b6a Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:20:46 -0700 Subject: [PATCH 03/11] cache gems/npm --- .github/workflows/ruby.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index cb7feb4..e782f18 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -19,13 +19,17 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, - # change this to (see https://github.com/ruby/setup-ruby#versioning): - # uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 + - uses: ruby/setup-ruby@v1 + with: { ruby-version: 2.6 } + + - uses: actions/cache@v2 + id: cache with: - ruby-version: 2.6 + path: | + rswag-ui/node_modules + vendor/bundle + key: ${{ runner.os }}-deps-${{ hashFiles('**/Gemfile.lock', '**/yarn.lock') }} + - name: Install dependencies run: ./ci/build.sh - name: Run tests From eb14eba7eb0c314cbc1144acdd36f5fef3620667 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:26:31 -0700 Subject: [PATCH 04/11] build individually --- .github/workflows/ruby.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index e782f18..03a5c62 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -31,6 +31,27 @@ jobs: key: ${{ runner.os }}-deps-${{ hashFiles('**/Gemfile.lock', '**/yarn.lock') }} - name: Install dependencies - run: ./ci/build.sh - - name: Run tests - run: ./ci/test.sh + run: | + bundle install + cd rswag-ui && npm install + + - name: rswag-api + run: | + cd rswag-api + bundle exec rspec + + - name: rswag-specs + run: | + cd rswag-specs + bundle exec rspec + + - name: rswag-ui + run: | + cd rswag-ui + bundle exec rspec + + - name: test-app + run: | + cd test-app + bundle exec rake db:migrate db:test:prepare + bundle exec rspec From 27b015b3d268d60b0f80c53041d566b0cfe8a389 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:29:28 -0700 Subject: [PATCH 05/11] ensure we run all specs if there are early failures --- .github/workflows/ruby.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 03a5c62..46548e3 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -41,16 +41,19 @@ jobs: bundle exec rspec - name: rswag-specs + if: succeeded() || failed() run: | cd rswag-specs bundle exec rspec - name: rswag-ui + if: succeeded() || failed() run: | cd rswag-ui bundle exec rspec - name: test-app + if: succeeded() || failed() run: | cd test-app bundle exec rake db:migrate db:test:prepare From 08b1678e53126d4cd78059f0bd28571e9fb59019 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:37:57 -0700 Subject: [PATCH 06/11] skip a test requiring headless firefox capybara driver --- test-app/spec/features/swagger_ui_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test-app/spec/features/swagger_ui_spec.rb b/test-app/spec/features/swagger_ui_spec.rb index 484ad65..7c86110 100644 --- a/test-app/spec/features/swagger_ui_spec.rb +++ b/test-app/spec/features/swagger_ui_spec.rb @@ -3,6 +3,7 @@ require 'rails_helper' RSpec.feature 'swagger-ui', js: true do scenario 'browsing api-docs' do + skip "Needs work to run on others' machines" visit '/api-docs' expect(page).to have_content('GET /blogs Searches blogs', normalize_ws: true) From 4c06f95a683dde8d988dbdf5b4e1fa7536a7dd1d Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:43:58 -0700 Subject: [PATCH 07/11] run multiple ruby/rails versions --- .github/workflows/ruby.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 46548e3..a5df5a6 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -16,6 +16,11 @@ on: jobs: test: runs-on: ubuntu-latest + strategy: + ruby: [2.6, 2.7] + rails: [5.2.4.4, 6.0.3.4] + env: + RAILS_VERSION: ${{ matrix.rails }} steps: - uses: actions/checkout@v2 @@ -28,7 +33,7 @@ jobs: path: | rswag-ui/node_modules vendor/bundle - key: ${{ runner.os }}-deps-${{ hashFiles('**/Gemfile.lock', '**/yarn.lock') }} + key: ${{ runner.os }}-ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock', '**/yarn.lock') }} - name: Install dependencies run: | From 04059808d57e1e718dc62f74b4fdf8138a081326 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:45:38 -0700 Subject: [PATCH 08/11] fix matrix syntax --- .github/workflows/ruby.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a5df5a6..01c5a45 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -17,8 +17,9 @@ jobs: test: runs-on: ubuntu-latest strategy: - ruby: [2.6, 2.7] - rails: [5.2.4.4, 6.0.3.4] + matrix: + ruby: [2.6, 2.7] + rails: [5.2.4.4, 6.0.3.4] env: RAILS_VERSION: ${{ matrix.rails }} From 1cd7df89f10a59355c6e6a23800a6313e58af7ce Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:47:36 -0700 Subject: [PATCH 09/11] update conditional tags --- .github/workflows/ruby.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 01c5a45..9e3c973 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -47,19 +47,19 @@ jobs: bundle exec rspec - name: rswag-specs - if: succeeded() || failed() + if: success() || failure() run: | cd rswag-specs bundle exec rspec - name: rswag-ui - if: succeeded() || failed() + if: success() || failure() run: | cd rswag-ui bundle exec rspec - name: test-app - if: succeeded() || failed() + if: success() || failure() run: | cd test-app bundle exec rake db:migrate db:test:prepare From 38c861f5e0d09cf3db96698c3b8baf1902e562eb Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:51:42 -0700 Subject: [PATCH 10/11] strip prelude --- .github/workflows/ruby.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 9e3c973..5e4fc03 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,10 +1,3 @@ -# 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: Ruby on: From c990348f0b915df1e8e12960c7b19faca744a132 Mon Sep 17 00:00:00 2001 From: Jamie Macey Date: Mon, 12 Oct 2020 13:56:22 -0700 Subject: [PATCH 11/11] update cache hash --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 5e4fc03..fd15653 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -27,7 +27,7 @@ jobs: path: | rswag-ui/node_modules vendor/bundle - key: ${{ runner.os }}-ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}-${{ hashFiles('**/Gemfile.lock', '**/yarn.lock') }} + key: ${{ runner.os }}-ruby_${{ matrix.ruby }}-rails_${{ matrix.rails }}-${{ hashFiles('Gemfile', '**/package-lock.json') }} - name: Install dependencies run: |