From d10de87a58760ef6c9fe3c69268ba390c6bc87e1 Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Donado Date: Sun, 4 Oct 2026 05:02:23 +0200 Subject: [PATCH 1/3] chore: bump version to 1.7.0 --- docs/openapi.yaml | 2 +- shard.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 03f9083..b10a377 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -11,7 +11,7 @@ info: ## Authentication Multiple users are supported via `X-Api-Key` headers. Create, list and delete keys via the [CLI](https://github.com/sjdonado/bit/blob/master/SETUP.md#cli). - version: 1.6.0 + version: 1.7.0 contact: name: sjdonado url: https://sjdonado.com diff --git a/shard.yml b/shard.yml index 5906edd..5fa9886 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: bit -version: 1.6.0 +version: 1.7.0 authors: - Juan Rodriguez Donado <@sjdonado> From aa53891af7f35a576128345af082d39816a821af Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Donado Date: Sun, 4 Oct 2026 05:33:19 +0200 Subject: [PATCH 2/3] ci: test parser updates before opening the PR --- .github/workflows/update-parsers.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/update-parsers.yml b/.github/workflows/update-parsers.yml index 08f55bb..f8f4e1e 100644 --- a/.github/workflows/update-parsers.yml +++ b/.github/workflows/update-parsers.yml @@ -32,6 +32,21 @@ jobs: - name: Update parsers run: ./cli --update-parsers + - name: Build application + run: shards build bit --release --no-debug + env: + ENV: production + + - name: Run tests + run: crystal spec + env: + ENV: test + + - name: Run end-to-end tests + run: crystal spec e2e + env: + ENV: test + - name: Check for changes id: changes run: | From d07e5717926d86e2d5b1878b0e1753f962703fde Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Donado Date: Sun, 4 Oct 2026 05:33:19 +0200 Subject: [PATCH 3/3] test: check GeoLite2 and uap-core data IpLookup swallows reader errors, so an empty or corrupt mmdb passed every suite. --- spec/lib/parsers_spec.cr | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spec/lib/parsers_spec.cr diff --git a/spec/lib/parsers_spec.cr b/spec/lib/parsers_spec.cr new file mode 100644 index 0000000..9c84128 --- /dev/null +++ b/spec/lib/parsers_spec.cr @@ -0,0 +1,22 @@ +require "../spec_helper" + +# Runs against the files in data/, so the Update Parsers workflow checks each download before opening its PR. +describe "Parser data" do + it "resolves countries from the GeoLite2 database" do + App::Lib::IpLookup.country("8.8.8.8").should eq("US") + App::Lib::IpLookup.country("2001:4860:4860::8888").should eq("US") + end + + it "parses common user agents with the uap-core regexes" do + { + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36" => {"Chrome", "Windows"}, + "Mozilla/5.0 (iPhone; CPU iPhone OS 17_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1" => {"Mobile Safari", "iOS"}, + "Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Mobile Safari/537.36" => {"Chrome Mobile", "Android"}, + "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" => {"Googlebot", nil}, + }.each do |user_agent, (browser, os)| + family, _, _, parsed_os = App::Lib::UserAgent.parse(user_agent) + family.should eq(browser) + parsed_os.try(&.[0]).should eq(os) + end + end +end