diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7b7bf20 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + branches: ["*"] + pull_request: + branches: ["*"] + +jobs: + lint: + runs-on: ${{ matrix.os }} + env: + MIX_ENV: dev + name: Lint + strategy: + matrix: + os: ["ubuntu-20.04"] + elixir: ["1.15"] + otp: ["26"] + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + - uses: actions/cache@v3 + with: + path: deps + key: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_ + - run: mix deps.get + - run: mix deps.compile + - run: mix lint + + test: + runs-on: ${{ matrix.os }} + name: Test Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }}, OS ${{ matrix.os }} + env: + MIX_ENV: test + strategy: + fail-fast: false + matrix: + os: ["ubuntu-20.04"] + elixir: ["1.15", "1.14", "1.13"] + otp: ["26", "25", "24"] + exclude: + - elixir: "1.13" + otp: "26" + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + - uses: actions/cache@v3 + with: + path: deps + key: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ matrix.os }}-otp_${{ matrix.otp }}-elixir_${{ matrix.elixir }}-mix_ + - run: mix deps.get --only test + - run: mix deps.compile + - run: mix compile + - run: mix test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f0bee4a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -dist: trusty -language: elixir -elixir: 1.5 -otp_release: 20.0 - -env: - global: - - MIX_ENV=test - - matrix: - - HEX_VERSION=master - - HEX_VERSION=v0.14.1 - -matrix: - include: - - elixir: 1.3.4 - otp_release: 18.2 - -install: - - mix local.rebar --force # for Elixir 1.3.0 and up - - mix local.hex --force - - mix deps.get - - mix deps.compile - -script: - - mix test - - mix credo --strict - -after_success: - - mix coveralls.travis - -after_script: - - MIX_ENV=docs mix deps.get - - MIX_ENV=docs mix inch.report diff --git a/lib/ex_image_info.ex b/lib/ex_image_info.ex index 3fc9114..14afceb 100644 --- a/lib/ex_image_info.ex +++ b/lib/ex_image_info.ex @@ -1,6 +1,5 @@ defmodule ExImageInfo do - - alias ExImageInfo.Types.{PNG, GIF, JPEG, BMP, TIFF, WEBP, PSD, JP2, PNM, ICO} + alias ExImageInfo.Types.{BMP, GIF, ICO, JP2, JPEG, PNG, PNM, PSD, TIFF, WEBP} @moduledoc """ ExImageInfo is an Elixir library to parse images (binaries) and get the dimensions (size), detected mime-type and overall validity for a set of image formats. Main module to parse a binary and get if it seems to be an image (validity), the mime-type (and variant detected) and the dimensions of the image, based on a specific image format. diff --git a/mix.exs b/mix.exs index 6dd085b..3254358 100644 --- a/mix.exs +++ b/mix.exs @@ -37,7 +37,11 @@ defmodule ExImageInfo.Mixfile do defp aliases do [ test_wip: ["test --only wip"], - docs: ["docs", ©_doc_to_docs/1] + docs: ["docs", ©_doc_to_docs/1], + lint: [ + "deps.unlock --check-unused", + "credo --all --strict" + ] ] end diff --git a/test/ex_image_info_test/images/gif_test.exs b/test/ex_image_info_test/images/gif_test.exs index ca67e19..e53cb4e 100644 --- a/test/ex_image_info_test/images/gif_test.exs +++ b/test/ex_image_info_test/images/gif_test.exs @@ -12,7 +12,6 @@ defmodule ExImageInfoTest.Images.GIFTest do {:ok, images} end - test "force - gif (gif87a, gif89a) disk image - #seems? #type #info", images do assert seems?(images["gif87a"], :gif) == true assert seems?(images["gif89a"], :gif) == true diff --git a/test/ex_image_info_test/images/png_test.exs b/test/ex_image_info_test/images/png_test.exs index 8757a63..0b47c5e 100644 --- a/test/ex_image_info_test/images/png_test.exs +++ b/test/ex_image_info_test/images/png_test.exs @@ -10,7 +10,6 @@ defmodule ExImageInfoTest.Images.PNGTest do {:ok, images} end - test "force - png disk image - #seems? #type #info", images do assert seems?(images["png"], :png) == true assert type(images["png"], :png) == {"image/png", "PNG"}