Skip to content

Commit ca7d2bd

Browse files
authored
Add CI workflow (#3)
1 parent 10928ec commit ca7d2bd

5 files changed

Lines changed: 63 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Elixir CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- dev
8+
9+
jobs:
10+
test:
11+
name: Test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- elixir: '1.18.4'
18+
otp: '28.0'
19+
version-type: 'strict'
20+
- elixir: '1.12.0'
21+
otp: '24.x'
22+
version-type: 'loose'
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Elixir
28+
uses: erlef/setup-beam@v1
29+
with:
30+
elixir-version: ${{ matrix.elixir }}
31+
otp-version: ${{ matrix.otp }}
32+
version-type: ${{ matrix.version-type }}
33+
34+
- name: Install Dependencies
35+
run: mix deps.get
36+
37+
- name: Run Tests
38+
run: mix test

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Added CI workflow to run tests against supported Elixir versions
13+
14+
### Changed
15+
16+
- Updated minimum supported Elixir version to v1.12
17+
- While the library may work with older versions, StreamData supports a
18+
minimum of v1.12, so it would be missing the property tests
19+
20+
### Fixed
21+
22+
- Updated timestamp decoding to be backwards-compatible with Elixir v1.12
23+
824
## [v1.0.2] - 2025-08-06
925

1026
### Fixed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ This section explains how to setup the project locally for development.
6262

6363
### Dependencies
6464

65-
- Elixir `~> 1.7` (OTP 21+)
65+
- Elixir `~> 1.12` (OTP 24+)
66+
- See [Compatibility and
67+
deprecations](https://hexdocs.pm/elixir/1.18.4/compatibility-and-deprecations.html)
68+
for more information
6669

6770
### Get the Source
6871

lib/msgpack/decoder.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ defmodule Msgpack.Decoder do
233233
base_datetime = NaiveDateTime.from_erl!(erlang_datetime)
234234

235235
if nanoseconds > 0 do
236-
NaiveDateTime.add(base_datetime, nanoseconds, :nanosecond)
236+
microseconds = div(nanoseconds, 1000)
237+
%{base_datetime | microsecond: {microseconds, 6}}
237238
else
238239
base_datetime
239240
end
@@ -250,7 +251,8 @@ defmodule Msgpack.Decoder do
250251
base_datetime = NaiveDateTime.from_erl!(erlang_datetime)
251252

252253
if nanoseconds > 0 do
253-
NaiveDateTime.add(base_datetime, nanoseconds, :nanosecond)
254+
microseconds = div(nanoseconds, 1000)
255+
%{base_datetime | microsecond: {microseconds, 6}}
254256
else
255257
base_datetime
256258
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule MsgpackElixir.MixProject do
88
[
99
app: :msgpack_elixir,
1010
version: @version,
11-
elixir: "~> 1.7",
11+
elixir: "~> 1.12",
1212
start_permanent: Mix.env() == :prod,
1313
deps: deps(),
1414
aliases: aliases(),

0 commit comments

Comments
 (0)