From e2878b2a2cbac50120a87a1aa542e292dfae0e1f Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 13:33:39 +1300 Subject: [PATCH 1/7] Create tests.yml setting up github action to run tests --- .github/workflows/tests.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b9413f4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,28 @@ +name: Tests + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['3.4', '3.3', '3.2', '2.7'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake From fd74e319e7a91722b36ab92180e57ed33b42ab0b Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 13:49:26 +1300 Subject: [PATCH 2/7] stop using base64 --- spec/support/js_helpers.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/support/js_helpers.rb b/spec/support/js_helpers.rb index 6753b00..cf1c0e5 100644 --- a/spec/support/js_helpers.rb +++ b/spec/support/js_helpers.rb @@ -3,7 +3,6 @@ require "mini_racer" require "json" require "digest" -require "base64" module JsHelpers def js_ctx @@ -38,7 +37,7 @@ def js_estimate_guesses(match, password) end def cached_eval(js_str) - tmp_hash = Base64.urlsafe_encode64 Digest::MD5.digest(js_str.to_s), padding: false + tmp_hash = Digest::MD5.hexdigest(js_str.to_s) cache_name = Pathname(File.expand_path("../../../tmp/#{tmp_hash}.json", __FILE__)) if File.exist?(cache_name) JSON.parse(File.read(cache_name)) From 95ba7f954f54964f27c962ee619f11886e0093fd Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 13:51:31 +1300 Subject: [PATCH 3/7] disable fail-fast --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b9413f4..a300bbd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: ruby-version: ['3.4', '3.3', '3.2', '2.7'] From 75102824d6e1ffe185eb63baa833e1ee9c13e850 Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 14:02:43 +1300 Subject: [PATCH 4/7] adjust dev dependencies to run across all ruby versions in the test matrix --- Gemfile | 2 +- Gemfile.lock | 40 +++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index 47fd32b..1a06608 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ source "https://rubygems.org" gemspec group :development do - gem "mini_racer", "~> 0.16" + gem "mini_racer", "~> 0.6" gem "rake", "~> 13.2" gem "rspec", "~> 3.13" gem "rubocop", "~> 1.68" diff --git a/Gemfile.lock b/Gemfile.lock index 66d1b6f..56d7057 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,25 +9,25 @@ GEM ast (2.4.2) diff-lcs (1.5.1) docile (1.4.1) - json (2.7.6) + json (2.9.1) language_server-protocol (3.17.0.3) - libv8-node (18.19.0.0) - libv8-node (18.19.0.0-aarch64-linux) - libv8-node (18.19.0.0-aarch64-linux-musl) - libv8-node (18.19.0.0-arm64-darwin) - libv8-node (18.19.0.0-x86_64-darwin) - libv8-node (18.19.0.0-x86_64-linux) - libv8-node (18.19.0.0-x86_64-linux-musl) - mini_racer (0.16.0) - libv8-node (~> 18.19.0.0) + libv8-node (16.19.0.1) + libv8-node (16.19.0.1-aarch64-linux) + libv8-node (16.19.0.1-aarch64-linux-musl) + libv8-node (16.19.0.1-arm64-darwin) + libv8-node (16.19.0.1-x86_64-darwin) + libv8-node (16.19.0.1-x86_64-linux) + libv8-node (16.19.0.1-x86_64-linux-musl) + mini_racer (0.6.4) + libv8-node (~> 16.19.0.0) parallel (1.26.3) - parser (3.3.5.1) + parser (3.3.6.0) ast (~> 2.4.1) racc racc (1.8.1) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.2) + regexp_parser (2.10.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -41,17 +41,17 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) - rubocop (1.68.0) + rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.34.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) simplecov (0.22.0) @@ -60,7 +60,9 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - unicode-display_width (2.6.0) + unicode-display_width (3.1.3) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) PLATFORMS aarch64-linux @@ -72,7 +74,7 @@ PLATFORMS x86_64-linux-musl DEPENDENCIES - mini_racer (~> 0.16) + mini_racer (~> 0.6) rake (~> 13.2) rspec (~> 3.13) rubocop (~> 1.68) From 06d4c400e93a7034dccacf3e31579eb6f312fc83 Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 14:10:19 +1300 Subject: [PATCH 5/7] pick bundler that works across all ruby version in the test matrix --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 56d7057..9f84ea0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,4 +82,4 @@ DEPENDENCIES zxcvbn! BUNDLED WITH - 2.5.22 + 2.3.27 From 215ed65aa6ea0816bd35fe60947f05a12387f46f Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 14:18:07 +1300 Subject: [PATCH 6/7] remove settings for travis ci --- .travis.yml | 10 ---------- README.md | 1 - 2 files changed, 11 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d4af187..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -language: ruby -cache: bundler -rvm: - - 2.6.10 - - 2.7.7 - - 3.0.5 - - 3.1.3 - - 3.2.0 -before_install: gem install bundler -v 2.4.5 diff --git a/README.md b/README.md index 16a7833..b55e5b7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Zxcvbn [![Gem Version](https://badge.fury.io/rb/zxcvbn.svg)](https://badge.fury.io/rb/zxcvbn) -[![Build Status](https://travis-ci.com/formigarafa/zxcvbn-rb.svg?branch=master)](https://travis-ci.com/formigarafa/zxcvbn-rb) Ruby port of Dropbox's [zxcvbn.js](https://github.com/dropbox/zxcvbn) JavaScript library running completely in Ruby (no need to load execjs or libv8). From a8006b83f7f94256f3972707266028cc3fd29ae7 Mon Sep 17 00:00:00 2001 From: Rafael Santos Date: Sat, 4 Jan 2025 14:18:25 +1300 Subject: [PATCH 7/7] github action badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b55e5b7..7c173e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Zxcvbn [![Gem Version](https://badge.fury.io/rb/zxcvbn.svg)](https://badge.fury.io/rb/zxcvbn) +[![Build Status](https://github.com/formigarafa/zxcvbn-rb/actions/workflows/tests.yml/badge.svg)](https://github.com/formigarafa/zxcvbn-rb) Ruby port of Dropbox's [zxcvbn.js](https://github.com/dropbox/zxcvbn) JavaScript library running completely in Ruby (no need to load execjs or libv8).