From 7ed2cf3e8e17701864d7ebc5e11ce6d0001e10be Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 1 Oct 2021 10:14:35 +0200 Subject: [PATCH 1/5] Create elixir.yml --- .github/workflows/elixir.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/elixir.yml diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml new file mode 100644 index 0000000..c4e1c0f --- /dev/null +++ b/.github/workflows/elixir.yml @@ -0,0 +1,31 @@ +name: Elixir CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + name: Build and test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Elixir + uses: erlef/setup-elixir@885971a72ed1f9240973bd92ab57af8c1aa68f24 + with: + elixir-version: '1.10.3' # Define the elixir version [required] + otp-version: '22.3' # Define the OTP version [required] + - name: Restore dependencies cache + uses: actions/cache@v2 + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + - name: Install dependencies + run: mix deps.get + - name: Run tests + run: mix test From e8619ecac2e41565c05dbfcb1801cb131cea5193 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 11 Oct 2021 10:10:45 +0200 Subject: [PATCH 2/5] Update GitHub CI file for latest 2 versions of OTP and Elixir --- .github/workflows/elixir.yml | 61 +++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index c4e1c0f..66c9e0e 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -2,30 +2,53 @@ name: Elixir CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: - name: Build and test runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + otp: + - 23.3.4 + - 24.1.1 + elixir: + - 1.11.4 + - 1.12.3 + include: + - otp: 24.1.1 + elixir: 1.12.3 + lint: lint + steps: - - uses: actions/checkout@v2 - - name: Set up Elixir - uses: erlef/setup-elixir@885971a72ed1f9240973bd92ab57af8c1aa68f24 - with: - elixir-version: '1.10.3' # Define the elixir version [required] - otp-version: '22.3' # Define the OTP version [required] - - name: Restore dependencies cache - uses: actions/cache@v2 - with: - path: deps - key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix- - - name: Install dependencies - run: mix deps.get - - name: Run tests - run: mix test + - uses: actions/checkout@v2 + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Restore dependencies cache + uses: actions/cache@v2 + with: + path: deps + key: ${{ runner.os }}-mix-${{ matrix.elixir}}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }} + + - name: Install dependencies + run: mix deps.get + + - run: mix format --check-formatted + if: ${{ matrix.lint }} + + - run: mix deps.compile + + - run: mix.compile --warnings-as-errors + if: ${{ matrix.lint }} + + - name: Run tests + run: mix test From 0f52edc55522482a687f3af1905b3f01818264d7 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 11 Oct 2021 10:14:42 +0200 Subject: [PATCH 3/5] Fix file formatting --- lib/tds_encoding.ex | 2 +- mix.exs | 10 +++++----- test/tds_encoding_test.exs | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/tds_encoding.ex b/lib/tds_encoding.ex index ed0d87f..eda72bf 100644 --- a/lib/tds_encoding.ex +++ b/lib/tds_encoding.ex @@ -37,7 +37,7 @@ defmodule Tds.Encoding do use Rustler, otp_app: :tds_encoding, crate: "tds_encoding", - mode: if Mix.env() == :prod, do: :release, else: :debug + mode: if(Mix.env() == :prod, do: :release, else: :debug) @doc """ Encodes utf-8 string using given codepage. If there are any unknown codes they diff --git a/mix.exs b/mix.exs index 6c88ac6..1264538 100644 --- a/mix.exs +++ b/mix.exs @@ -9,8 +9,9 @@ defmodule Tds.Encoding.MixProject do elixir: "~> 1.9", start_permanent: Mix.env() == :prod, deps: deps(), - description: "String encoding/decoding NIF using rust [encoding](https://crates.io/crates/encoding) library", - package: package(), + description: + "String encoding/decoding NIF using rust [encoding](https://crates.io/crates/encoding) library", + package: package() ] end @@ -25,7 +26,7 @@ defmodule Tds.Encoding.MixProject do defp deps do [ {:rustler, "~> 0.22.0"}, - {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}, + {:ex_doc, ">= 0.0.0", only: :dev, runtime: false} ] end @@ -35,8 +36,7 @@ defmodule Tds.Encoding.MixProject do maintainers: ["Milan Jarić"], licenses: ["MIT"], links: %{"GitHub" => "https://github.com/mjaric/tds-encoding"}, - files: - ~w(.formatter.exs mix.exs README.md lib native) + files: ~w(.formatter.exs mix.exs README.md lib native) ] end end diff --git a/test/tds_encoding_test.exs b/test/tds_encoding_test.exs index 4a94774..96af996 100644 --- a/test/tds_encoding_test.exs +++ b/test/tds_encoding_test.exs @@ -16,6 +16,7 @@ defmodule TdsEncodingTest do test "should decode broken string and replace unkinwn with `�` code" do assert "\u{c6b0}\u{c640}\u{fffd}\u{c559}" == decode(<<0xBF, 0xEC, 0xBF, 0xCD, 0xFF, 0xBE, 0xD3>>, "windows-949") + # same encoding/decoding as above but ecoding name is different assert "\u{c6b0}\u{c640}\u{fffd}\u{c559}" == decode(<<0xBF, 0xEC, 0xBF, 0xCD, 0xFF, 0xBE, 0xD3>>, "euc-kr") From 0710105dadf8dcb1b306a992c996bce16a95cd14 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 11 Oct 2021 10:15:59 +0200 Subject: [PATCH 4/5] Bump rustler to 0.22.2 --- mix.lock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index 63353d7..7edb73b 100644 --- a/mix.lock +++ b/mix.lock @@ -2,10 +2,11 @@ "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"}, "earmark_parser": {:hex, :earmark_parser, "1.4.15", "b29e8e729f4aa4a00436580dcc2c9c5c51890613457c193cc8525c388ccb2f06", [:mix], [], "hexpm", "044523d6438ea19c1b8ec877ec221b008661d3c27e3b848f4c879f500421ca5c"}, "ex_doc": {:hex, :ex_doc, "0.25.3", "3edf6a0d70a39d2eafde030b8895501b1c93692effcbd21347296c18e47618ce", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "9ebebc2169ec732a38e9e779fd0418c9189b3ca93f4a676c961be6c1527913f5"}, + "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, "makeup_elixir": {:hex, :makeup_elixir, "0.15.1", "b5888c880d17d1cc3e598f05cdb5b5a91b7b17ac4eaf5f297cb697663a1094dd", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "db68c173234b07ab2a07f645a5acdc117b9f99d69ebf521821d89690ae6c6ec8"}, "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, - "rustler": {:hex, :rustler, "0.22.0", "e2930f9d6933e910f87526bb0a7f904e32b62a7e838a3ca4a884ee7fdfb957ed", [:mix], [{:toml, "~> 0.5.2", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "01f5989dd511ebec09be481e07d3c59773d5373c5061e09d3ebc3ef61811b49d"}, + "rustler": {:hex, :rustler, "0.22.2", "f92d6dba71bef6fe5f0d955649cb071127adc92f32a78890e8fa9939e59a1b41", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.5.2", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "56b129141e86d60a2d670af9a2b55a9071e10933ef593034565af77e84655118"}, "toml": {:hex, :toml, "0.5.2", "e471388a8726d1ce51a6b32f864b8228a1eb8edc907a0edf2bb50eab9321b526", [:mix], [], "hexpm", "f1e3dabef71fb510d015fad18c0e05e7c57281001141504c6b69d94e99750a07"}, } From cf0d1857a992b795b1ed4b6c4f9fed8c8eaacbba Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 11 Oct 2021 10:17:39 +0200 Subject: [PATCH 5/5] Fix typo in workflow file --- .github/workflows/elixir.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index 66c9e0e..b568233 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -47,7 +47,7 @@ jobs: - run: mix deps.compile - - run: mix.compile --warnings-as-errors + - run: mix compile --warnings-as-errors if: ${{ matrix.lint }} - name: Run tests