Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dialyzer and split formatter to one version only #85

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
91 changes: 87 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ jobs:
matrix:
os: [ubuntu-22.04]
elixir_version: [1.15, 1.16, 1.17]
otp_version: [25, 26, 27]
otp_version: [ 25, 26, 27]
exclude:
- otp_version: 27
elixir_version: 1.15
- otp_version: 27
elixir_version: 1.16

steps:
- uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp_version}}
elixir-version: ${{matrix.elixir_version}}
Expand All @@ -44,8 +47,6 @@ jobs:

- run: mix deps.get

- run: mix format --check-formatted

- run: mix deps.unlock --check-unused

- run: mix deps.compile
Expand All @@ -55,3 +56,85 @@ jobs:
- run: mix credo --strict --format=oneline

- run: mix test --warnings-as-errors --cover

dialyzer:
runs-on: ubuntu-22.04
env:
MIX_ENV: dev

steps:
- uses: actions/checkout@v4

- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: 1.16
otp-version: 26

- uses: actions/cache@v4
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}

- run: mix deps.get

- name: Restore PLT cache
id: plt_cache_restore
uses: actions/cache/restore@v3
with:
key: |
plts-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plts-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
path: |
priv/plts

- name: Create PLTs
if: steps.plt_cache_restore.outputs.cache-hit != 'true'
run: mix dialyzer --plt

- name: Save PLT cache
id: plt_cache_save
if: steps.plt_cache_restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
key: |
plts-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
path: |
priv/plts

- name: Run dialyzer
run: mix dialyzer --format github --format dialyxir

check_format:
runs-on: ubuntu-22.04
env:
MIX_ENV: dev

steps:
- uses: actions/checkout@v4

- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: 1.16
otp-version: 26

- uses: actions/cache@v4
with:
path: |
deps
_build
key: deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
deps-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}

- run: mix deps.get

- run: mix format --check-formatted
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## v0.15.1 (2024-12-04)

### Changed

* Fix dialyzer errors
## v0.15.0 (2024-10-01)

### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/uinta/formatter/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ defmodule Uinta.Formatter.Util do
@doc """
RFC3339 UTC "Zulu" format.
"""
@spec format_timestamp(Logger.Formatter.time()) :: String.t()
@spec format_timestamp(Types.time()) :: String.t()
def format_timestamp({date, time}) do
IO.iodata_to_binary([format_date(date), ?T, format_time(time), ?Z])
end
Expand Down
13 changes: 9 additions & 4 deletions lib/uinta/plug.ex
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ if Code.ensure_loaded?(Plug) do
@query_name_regex ~r/^\s*(?:query|mutation)\s+(\w+)|{\W+(\w+)\W+?{/m

@type format :: :json | :map | :string
@type graphql_info :: %{type: String.t(), operation: String.t(), variables: String.t() | nil}
@type graphql_info :: %{
type: String.t(),
operation: String.t(),
variables: String.t(),
query: String.t() | nil
}
@type opts :: %{
level: Logger.level() | {module(), atom(), list()},
format: format(),
Expand Down Expand Up @@ -217,7 +222,7 @@ if Code.ensure_loaded?(Plug) do
end
end

@spec format_line(map(), format()) :: iodata() | map()
@spec format_line(map(), format()) :: iodata() | map() | String.t()
defp format_line(info, :map) do
format_info(info)
end
Expand Down Expand Up @@ -269,11 +274,11 @@ if Code.ensure_loaded?(Plug) do

@spec query(graphql_info(), opts()) :: String.t() | nil
defp query(_, %{include_unnamed_queries: false}), do: nil
defp query(%{query: query}, _), do: query
defp query(%{query: query}, _) when not is_nil(query), do: query
defp query(_, _), do: nil

@spec variables(graphql_info() | nil) :: String.t() | nil
defp variables(%{variables: variables}), do: variables
defp variables(%{variables: variables}) when not is_nil(variables), do: variables
defp variables(_), do: nil

@spec graphql_info(Plug.Conn.t(), opts()) :: graphql_info() | nil
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Uinta.MixProject do
use Mix.Project

@project_url "https://github.com/podium/uinta"
@version "0.15.0"
@version "0.15.1"

def project do
[
Expand Down
Loading