From 878551a392b69bfee507c105028d7abfd2727c42 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 14:45:20 -0500 Subject: [PATCH 1/9] Remove spec warnings in decoder.ex --- lib/logfmt/decoder.ex | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lib/logfmt/decoder.ex b/lib/logfmt/decoder.ex index b8330a7..11bf158 100644 --- a/lib/logfmt/decoder.ex +++ b/lib/logfmt/decoder.ex @@ -27,7 +27,6 @@ defmodule Logfmt.Decoder do parse_char(next_grapheme(rest), :key, char, map) end - @spec parse_char({String.t(), String.t()}, :garbage, map) :: map defp parse_char({_char, rest}, :garbage, map) do parse_char(next_grapheme(rest), :garbage, map) end @@ -43,12 +42,10 @@ defmodule Logfmt.Decoder do parse_char(next_grapheme(rest), :key, key <> char, map) end - @spec parse_char({String.t(), String.t()}, :key, String.t(), map) :: map defp parse_char({"=", rest}, :key, key, map) do parse_char(next_grapheme(rest), :equals, key, map) end - @spec parse_char({String.t(), String.t()}, :key, String.t(), map) :: map defp parse_char({_char, rest}, :key, key, map) do parse_char(next_grapheme(rest), :garbage, map |> put_value(key, true)) end @@ -64,12 +61,10 @@ defmodule Logfmt.Decoder do parse_char(next_grapheme(rest), :ivalue, key, char, map) end - @spec parse_char({String.t(), String.t()}, :equals, String.t(), map) :: map defp parse_char({"\"", rest}, :equals, key, map) do parse_char(next_grapheme(rest), :qvalue, false, key, "", map) end - @spec parse_char({String.t(), String.t()}, :equals, String.t(), map) :: map defp parse_char({_char, rest}, :equals, key, map) do parse_char(next_grapheme(rest), :garbage, map |> put_value(key, true)) end @@ -85,7 +80,6 @@ defmodule Logfmt.Decoder do parse_char(next_grapheme(rest), :garbage, map |> put_value(key, value)) end - @spec parse_char({String.t(), String.t()}, :ivalue, String.t(), String.t(), map) :: map defp parse_char({char, rest}, :ivalue, key, value, map) do parse_char(next_grapheme(rest), :ivalue, key, value <> char, map) end @@ -105,12 +99,10 @@ defmodule Logfmt.Decoder do parse_char(next_grapheme(rest), :qvalue, false, key, value <> char, map) end - @spec parse_char({String.t(), String.t()}, :qvalue, false, String.t(), String.t(), map) :: map defp parse_char({"\"", rest}, :qvalue, false, key, value, map) do parse_char(next_grapheme(rest), :garbage, map |> put_value(key, value)) end - @spec parse_char({String.t(), String.t()}, :qvalue, false, String.t(), String.t(), map) :: map defp parse_char({char, rest}, :qvalue, false, key, value, map) do parse_char(next_grapheme(rest), :qvalue, false, key, value <> char, map) end @@ -130,16 +122,11 @@ defmodule Logfmt.Decoder do map |> Map.put(key, value |> coerce_value) end - @spec coerce_value(String.t()) :: true + @spec coerce_value(String.t()) :: boolean | number | String.t() | nil defp coerce_value("true"), do: true - - @spec coerce_value(String.t()) :: false defp coerce_value("false"), do: false - - @spec coerce_value(String.t()) :: nil defp coerce_value("nil"), do: nil - @spec coerce_value(String.t()) :: number | String.t() defp coerce_value(value) do integer = case Integer.parse(value) do From c7eb7a61f1b7cce3bf22a8d779a7bde8400912f7 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 14:48:40 -0500 Subject: [PATCH 2/9] v3.3.3 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index d85b4b6..695dd4c 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Logfmt.MixProject do use Mix.Project @source_url "https://github.com/jclem/logfmt-elixir" - @version "3.3.2" + @version "3.3.3" def project do [ From 5684c8814f457eba8b40e24ef0d4a792b2bdf04d Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 14:49:47 -0500 Subject: [PATCH 3/9] Change CI to use main branch --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 037dd37..9d3ff91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,8 @@ name: CI on: - push: {branches: master} - pull_request: {branches: master} + push: {branches: main} + pull_request: {branches: main} jobs: test: From d0917a29db14be6bdd3daf511eb6223d288b312b Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 14:55:12 -0500 Subject: [PATCH 4/9] Set up caching and matrix CI --- .github/workflows/ci.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d3ff91..cbcc4fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,23 @@ jobs: test: name: Run tests runs-on: ubuntu-20.04 + strategy: + matrix: + elixir: ['1.8.x', '1.9.x', '1.10.x', '1.11.x', '1.12.x', '1.13.x'] steps: - - uses: actions/checkout@1.0.0 - - uses: erlef/setup-elixir@v1.7.0 + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 + - uses: erlef/setup-elixir@988e02bfe678367a02564f65ca2e37726dc0268f # v1.9.0 with: otp-version: 21.x - elixir-version: 1.8.x + elixir-version: ${{ matrix.elixir }} + - uses: actions/cache@67b6d52d50609f6166e3ea1d8872aca3a4763bd2 # v2.1.7 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: | + ${{ runner.os }}-mix- - run: mix deps.get - run: mix test --trace - run: mix format --check-formatted From 68b13abea21bb4b6ea6e5fb0bab28ed91d2a2e50 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 14:56:13 -0500 Subject: [PATCH 5/9] Add Elixir version to cache key --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbcc4fc..9e4dc83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,9 +22,9 @@ jobs: path: | deps _build - key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} restore-keys: | - ${{ runner.os }}-mix- + ${{ runner.os }}-mix-${{ matrix.elixir }} - run: mix deps.get - run: mix test --trace - run: mix format --check-formatted From bcd5ae2ee190aaac82979237ea214dad7b9cf973 Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 14:58:19 -0500 Subject: [PATCH 6/9] Upload crash logs if present --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e4dc83..0c230cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,11 @@ jobs: key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} restore-keys: | ${{ runner.os }}-mix-${{ matrix.elixir }} + - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 + with: + name: crash-logs + path: erl_crash.dump + if-no-files-found: ignore - run: mix deps.get - run: mix test --trace - run: mix format --check-formatted From 19c3b5228616f32ce43d3d039a2b08ee765fbccb Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 15:01:24 -0500 Subject: [PATCH 7/9] Use include-only matrix --- .github/workflows/ci.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c230cd..6cfbe4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,19 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - elixir: ['1.8.x', '1.9.x', '1.10.x', '1.11.x', '1.12.x', '1.13.x'] + include: + - otp: 21.x + elixir: 1.8.x + - otp: 21.x + elixir: 1.9.x + - otp: 21.x + elixir: 1.10.x + - otp: 21.x + elixir: 1.11.x + - otp: 22.x + elixir: 1.12.x + - otp: 22.x + elixir: 1.13.x steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 - uses: erlef/setup-elixir@988e02bfe678367a02564f65ca2e37726dc0268f # v1.9.0 From fa4140208dbeb02dbb5bfd86ba579d90081fb84f Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 15:01:57 -0500 Subject: [PATCH 8/9] Move artifact upload to before setup-elixir --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cfbe4f..ea31b61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,11 @@ jobs: elixir: 1.13.x steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 + - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 + with: + name: crash-logs + path: erl_crash.dump + if-no-files-found: ignore - uses: erlef/setup-elixir@988e02bfe678367a02564f65ca2e37726dc0268f # v1.9.0 with: otp-version: 21.x @@ -37,11 +42,6 @@ jobs: key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} restore-keys: | ${{ runner.os }}-mix-${{ matrix.elixir }} - - uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1 - with: - name: crash-logs - path: erl_crash.dump - if-no-files-found: ignore - run: mix deps.get - run: mix test --trace - run: mix format --check-formatted From 076faf9a9d25af83eb182d0b864a8c2b2afdfccb Mon Sep 17 00:00:00 2001 From: Jonathan Clem Date: Mon, 10 Jan 2022 15:02:51 -0500 Subject: [PATCH 9/9] Use OTP matrix value in CI --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea31b61..3325568 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,16 +32,16 @@ jobs: if-no-files-found: ignore - uses: erlef/setup-elixir@988e02bfe678367a02564f65ca2e37726dc0268f # v1.9.0 with: - otp-version: 21.x + otp-version: ${{ matrix.otp }} elixir-version: ${{ matrix.elixir }} - uses: actions/cache@67b6d52d50609f6166e3ea1d8872aca3a4763bd2 # v2.1.7 with: path: | deps _build - key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} restore-keys: | - ${{ runner.os }}-mix-${{ matrix.elixir }} + ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}- - run: mix deps.get - run: mix test --trace - run: mix format --check-formatted