diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5afd34f2..3fcbdd47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,7 +88,13 @@ jobs: - name: Check formatting run: mix format --check-formatted - name: Run tests - run: source envrc.example && mix test + run: source envrc.example && mix test --cover + - name: Report test coverage + uses: mbta/github-actions-report-lcov@v1 + with: + coverage-files: cover/lcov.info + artifact-name: code-coverage-report + github-token: ${{ secrets.GITHUB_TOKEN }} - uses: mbta/actions/dialyzer@v2 - name: Check for unused dependencies run: mix deps.unlock --check-unused diff --git a/mix.exs b/mix.exs index 8d5c74d2..8ba182e1 100644 --- a/mix.exs +++ b/mix.exs @@ -9,7 +9,8 @@ defmodule MobileAppBackend.MixProject do elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), - deps: deps() + deps: deps(), + test_coverage: [tool: LcovEx] ] end @@ -68,7 +69,8 @@ defmodule MobileAppBackend.MixProject do {:con_cache, "~> 1.0.0"}, {:absinthe, "~> 1.7"}, {:absinthe_plug, "~> 1.5"}, - {:timex, "~> 3.7"} + {:timex, "~> 3.7"}, + {:lcov_ex, "~> 0.3", only: [:test], runtime: false} ] end diff --git a/mix.lock b/mix.lock index 2a4614f2..17517cac 100644 --- a/mix.lock +++ b/mix.lock @@ -27,6 +27,7 @@ "httpoison": {:hex, :httpoison, "2.2.1", "87b7ed6d95db0389f7df02779644171d7319d319178f6680438167d7b69b1f3d", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "51364e6d2f429d80e14fe4b5f8e39719cacd03eb3f9a9286e61e216feac2d2df"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, + "lcov_ex": {:hex, :lcov_ex, "0.3.3", "1745a88e46606c4f86408299f54878b7d0cd22ea3e9c54b0018b6ed631a9ce87", [:mix], [], "hexpm", "ea373ec4d2df213357c5a464be16ab08d1e58e61ea2de784a483780c22a1e74a"}, "logster": {:hex, :logster, "1.1.1", "d6fddac540dd46adde0c894024500867fe63b0043713f842c62da5815e21db10", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "d18e852c430812ad1c9756998ebe46ec814c724e6eb551a512d7e3f8dee24cef"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},