Skip to content

Commit

Permalink
CI: test all supported versions
Browse files Browse the repository at this point in the history
  • Loading branch information
benhaney committed Oct 28, 2023
1 parent d8e9aba commit 55d4058
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,38 @@ permissions:
contents: read

jobs:
build:
test:

name: Build and test
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- pair:
elixir: 1.12
otp: 24
- pair:
elixir: 1.14
otp: 25
- pair:
elixir: 1.15
otp: 26

steps:
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.14.3'
otp-version: '25.x'
elixir-version: ${{matrix.pair.elixir}}
otp-version: ${{matrix.pair.otp}}
- name: Restore Elixir dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
key: ${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-${{matrix.pair.elixir}}-${{matrix.pair.otp}}-
- name: Restore Cargo cache
uses: actions/cache@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions test/jsonrs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ defmodule JsonrsTest do
assert Jsonrs.encode!({:ok, :error}) == ~s(["ok","error"])
end

test "complicated term" do
assert Jsonrs.encode!(%{map: %{1 => "foo", "list" => [:ok, 42, -42, 42.0, 42.01, :error], tuple: {:ok, []}, atom: :atom}}) == ~s({"map":{"1":"foo","atom":"atom","tuple":["ok",[]],"list":["ok",42,-42,42.0,42.01,"error"]}})
end

test "struct using fallback protocol" do
assert Jsonrs.encode!(%Container{payload: ~T[12:00:00]}) == ~s({"payload":"12:00:00"})
end
Expand Down

0 comments on commit 55d4058

Please sign in to comment.