Skip to content

Commit 32e770f

Browse files
committed
Initial release of Checkend Elixir SDK
Features: - Error notification with async/sync sending - Plug middleware integration for Phoenix/Plug apps - Oban integration for background job error tracking - Exponential backoff with throttling (1.05^n, max 100s) - Sensitive data filtering with configurable filter keys - Exception ignoring (module, string, regex patterns) - Default Phoenix/Ecto exception ignoring - HTTP proxy support - SSL/TLS configuration (ssl_verify, ssl_ca_path) - App metadata (app_name, revision, root_path) - Data sending toggles (request, session, environment, user) - Custom logger support - Configurable timeouts (connect_timeout, timeout, shutdown_timeout) - Testing utilities for capturing notices in tests - before_notify callbacks for notice modification - GitHub Actions CI/CD workflows - Pre-commit hooks for secret scanning
0 parents  commit 32e770f

28 files changed

Lines changed: 3196 additions & 0 deletions

.formatter.exs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
3+
]

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- elixir: '1.14'
17+
otp: '25'
18+
- elixir: '1.15'
19+
otp: '26'
20+
- elixir: '1.16'
21+
otp: '26'
22+
- elixir: '1.17'
23+
otp: '27'
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Elixir
29+
uses: erlef/setup-beam@v1
30+
with:
31+
elixir-version: ${{ matrix.elixir }}
32+
otp-version: ${{ matrix.otp }}
33+
34+
- name: Restore dependencies cache
35+
uses: actions/cache@v4
36+
with:
37+
path: deps
38+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
39+
restore-keys: ${{ runner.os }}-mix-
40+
41+
- name: Install dependencies
42+
run: mix deps.get
43+
44+
- name: Run tests
45+
run: mix test
46+
47+
lint:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
52+
- name: Set up Elixir
53+
uses: erlef/setup-beam@v1
54+
with:
55+
elixir-version: '1.17'
56+
otp-version: '27'
57+
58+
- name: Restore dependencies cache
59+
uses: actions/cache@v4
60+
with:
61+
path: deps
62+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
63+
restore-keys: ${{ runner.os }}-mix-
64+
65+
- name: Install dependencies
66+
run: mix deps.get
67+
68+
- name: Check formatting
69+
run: mix format --check-formatted
70+
71+
- name: Compile without warnings
72+
run: mix compile --warnings-as-errors

.github/workflows/publish.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Publish to Hex.pm
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish (e.g., 0.2.0)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
fetch-depth: 0
22+
23+
- name: Set up Elixir
24+
uses: erlef/setup-beam@v1
25+
with:
26+
elixir-version: '1.17'
27+
otp-version: '27'
28+
29+
- name: Restore dependencies cache
30+
uses: actions/cache@v4
31+
with:
32+
path: deps
33+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
34+
restore-keys: ${{ runner.os }}-mix-
35+
36+
- name: Install dependencies
37+
run: mix deps.get
38+
39+
- name: Update version
40+
if: github.event_name == 'workflow_dispatch'
41+
run: |
42+
sed -i "s/@version \".*\"/@version \"${{ inputs.version }}\"/" mix.exs
43+
44+
- name: Run tests
45+
run: mix test
46+
47+
- name: Check formatting
48+
run: mix format --check-formatted
49+
50+
- name: Configure git
51+
if: github.event_name == 'workflow_dispatch'
52+
run: |
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
56+
- name: Install git-cliff
57+
if: github.event_name == 'workflow_dispatch'
58+
uses: kenji-miyake/setup-git-cliff@v2
59+
60+
- name: Generate changelog
61+
if: github.event_name == 'workflow_dispatch'
62+
run: |
63+
git-cliff --tag "v${{ inputs.version }}" -o CHANGELOG.md
64+
65+
- name: Commit version and changelog
66+
if: github.event_name == 'workflow_dispatch'
67+
run: |
68+
git pull --rebase origin main
69+
git add mix.exs CHANGELOG.md
70+
if git diff --staged --quiet; then
71+
echo "No changes to commit"
72+
else
73+
git commit -m "Release v${{ inputs.version }}"
74+
git push
75+
fi
76+
77+
- name: Create tag and release
78+
if: github.event_name == 'workflow_dispatch'
79+
env:
80+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
run: |
82+
if git rev-parse "v${{ inputs.version }}" >/dev/null 2>&1; then
83+
echo "Tag v${{ inputs.version }} already exists"
84+
else
85+
git tag "v${{ inputs.version }}"
86+
git push origin "v${{ inputs.version }}"
87+
fi
88+
if gh release view "v${{ inputs.version }}" >/dev/null 2>&1; then
89+
echo "Release v${{ inputs.version }} already exists"
90+
else
91+
gh release create "v${{ inputs.version }}" \
92+
--title "v${{ inputs.version }}" \
93+
--generate-notes
94+
fi
95+
96+
- name: Publish to Hex.pm
97+
env:
98+
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
99+
run: |
100+
mix hex.publish --yes

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
checkend-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/
27+
28+
# IDE
29+
.idea/
30+
.vscode/
31+
*.swp
32+
*.swo
33+
*~
34+
35+
# OS
36+
.DS_Store
37+
Thumbs.db

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## [0.1.0] - 2025-01-14
2+
3+
### Added
4+
5+
- Initial release of Checkend Elixir SDK
6+
- Error notification with async/sync sending
7+
- Plug middleware integration for Phoenix/Plug apps
8+
- Oban integration for background job error tracking
9+
- Exponential backoff with throttling (1.05^n, max 100s)
10+
- Sensitive data filtering with configurable filter keys
11+
- Exception ignoring (module, string, regex patterns)
12+
- Default Phoenix/Ecto exception ignoring
13+
- HTTP proxy support
14+
- SSL/TLS configuration (ssl_verify, ssl_ca_path)
15+
- App metadata (app_name, revision, root_path)
16+
- Data sending toggles (request, session, environment, user)
17+
- Custom logger support
18+
- Configurable timeouts (connect_timeout, timeout, shutdown_timeout)
19+
- Testing utilities for capturing notices in tests
20+
- before_notify callbacks for notice modification

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Furvur
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)