Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check PR Title

on:
pull_request:
branches: [ master ]
types: [opened, edited, synchronize, reopened]

jobs:
commitlint:
name: Check PR title
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20.x'

- name: Setup
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
- name: Verify PR title is in the correct format
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
echo $TITLE | npx commitlint -V
2 changes: 1 addition & 1 deletion .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
otp: '27.0'
- pair:
elixir: '1.18'
otp: '28.0'
otp: '28.1'
lint: lint

runs-on: ubuntu-22.04
Expand Down
70 changes: 34 additions & 36 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
name: Publish New Release
on:
workflow_dispatch:
inputs:
version:
type: choice
description: What version to publish?
options:
- patch
- minor
- major
changes:
description: Specify an entry for the changelog
required: true
push:
branches:
- main

permissions:
contents: write
issues: write
pull-requests: write
repository-projects: read # this is required by release-please-action to set the auto-release tags

# Note for release-please-action:
# The action will set the auto-release tags for the release PR. If these tags do not already exist, the action will fail to create them.
# Therefore, make sure that the tags are created in the repository before running the release workflow: `autorelease: pending`, `autorelease: tagged`

jobs:
ci:
uses: ./.github/workflows/elixir.yml
secrets: inherit

publish:
release-please:
runs-on: ubuntu-latest
needs: [ci]
name: Build and publish to hex.pm
runs-on: ubuntu-22.04
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v5
- uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.GH_PUBLISH_PAT }}
fetch-depth: 0
ref: master

- name: Git Config
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
token: ${{ secrets.GITHUB_TOKEN }}
release-type: elixir

publish-hex:
name: Publish to hex.pm
runs-on: ubuntu-latest
needs: [release-please]
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: actions/checkout@v5

- name: Setup Elixir
uses: erlef/setup-elixir@v1
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: '24.3'
elixir-version: '1.15'
otp-version: '26'

- name: Restore dependencies cache
uses: actions/cache@v4
Expand All @@ -50,13 +49,12 @@ jobs:
key: ${{ runner.os }}-publish-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-publish-mix-

- name: Install deps
- name: Install dependencies
run: mix deps.get

- name: Add changelog entry
run: echo "${{ inputs.changes }}" > RELEASE.md

- name: Bump version, generate changelog, push to git, publish on hex.pm
run: mix expublish.${{ inputs.version }} --disable-test
- name: Publish to Hex.pm
run: mix hex.publish --yes
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}


1 change: 0 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ defmodule Honeybadger.Mixfile do
# Dev dependencies
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:dialyxir, "~> 1.0", only: :dev, runtime: false},
{:expublish, "~> 2.5", only: [:dev], runtime: false},

# Test dependencies
{:plug_cowboy, ">= 2.0.0 and < 3.0.0", only: :test},
Expand Down
3 changes: 1 addition & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"ecto": {:hex, :ecto, "3.12.2", "bae2094f038e9664ce5f089e5f3b6132a535d8b018bd280a485c2f33df5c0ce1", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "492e67c70f3a71c6afe80d946d3ced52ecc57c53c9829791bfff1830ff5a1f0c"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.37.1", "65ca30d242082b95aa852b3b73c9d9914279fff56db5dc7b3859be5504417980", [:mix], [{:earmark_parser, "~> 1.4.42", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "6774f75477733ea88ce861476db031f9399c110640752ca2b400dbbb50491224"},
"expublish": {:hex, :expublish, "2.7.5", "684e20f6538019b2f563f957181ec94176a0fe8de6cba552c6d8471158354701", [:mix], [], "hexpm", "25ca84eb8fe7e17e6baa250f0cca27cabdd6b7d49584ffd13bb541471857df79"},
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
"hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~>2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"},
"hpax": {:hex, :hpax, "1.0.2", "762df951b0c399ff67cc57c3995ec3cf46d696e41f0bba17da0518d94acd4aac", [:mix], [], "hexpm", "2f09b4c1074e0abd846747329eaa26d535be0eb3d189fa69d812bfb8bfefd32f"},
Expand Down Expand Up @@ -42,5 +41,5 @@
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
"websock_adapter": {:hex, :websock_adapter, "0.5.8", "3b97dc94e407e2d1fc666b2fb9acf6be81a1798a2602294aac000260a7c4a47d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "315b9a1865552212b5f35140ad194e67ce31af45bcee443d4ecb96b5fd3f3782"},
"x509": {:hex, :x509, "0.9.1", "c92026a17b7d93f19029842ca218f82ec1f1e7cc9d4aa0c48327ee778f7f482e", [:mix], [], "hexpm", "99328951a1480cfd7b1b8aa688f857f7f5bbea03077b78cad211fb3b30c2f4a8"},
"x509": {:hex, :x509, "0.9.2", "a75aa605348abd905990f3d2dc1b155fcde4e030fa2f90c4a91534405dce0f6e", [:mix], [], "hexpm", "4c5ede75697e565d4b0f5be04c3b71bb1fd3a090ea243af4bd7dae144e48cfc7"},
}
10 changes: 8 additions & 2 deletions test/honeybadger/events_sampler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@
capture_log(fn ->
EventsSampler.sample?(hash_value: "trace-1", server: sampler)
EventsSampler.sample?(hash_value: "trace-2", server: sampler)
Process.sleep(1000)
# Wait for the report timer and ensure message is processed
Process.sleep(110)
# Make a synchronous call to ensure all prior messages are processed
EventsSampler.sample?(hash_value: "sync", server: sampler)
end)

assert log =~ ~r/\[Honeybadger\] Sampled \d events \(of 2 total events\)/
end)
end

test "samples for un-hashed values" do

Check failure on line 44 in test/honeybadger/events_sampler_test.exs

View workflow job for this annotation

GitHub Actions / Build and test (1.18, 28.1, lint)

test samples for un-hashed values (Honeybadger.EventsSamplerTest)
with_config([insights_sample_rate: 50], fn ->
{:ok, sampler} = start_sampler(sampled_log_interval: 100)

Expand All @@ -47,7 +50,10 @@
EventsSampler.sample?(server: sampler)
EventsSampler.sample?(server: sampler)
EventsSampler.sample?(server: sampler)
Process.sleep(1000)
# Wait for the report timer and ensure message is processed
Process.sleep(110)
# Make a synchronous call to ensure all prior messages are processed
EventsSampler.sample?(server: sampler)
end)

assert log =~ ~r/\[Honeybadger\] Sampled \d events \(of 3 total events\)/
Expand Down
Loading