diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f35a9e875..de265d627 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,7 @@ jobs: env: MIX_ENV: test POSTGRES_HOST: localhost + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} services: postgres: image: postgres:12 @@ -39,8 +40,9 @@ jobs: run: | mix ecto.create mix ecto.migrate - - name: Run Tests - run: mix test + + - name: Run Tests and Upload Coverage Report + run: mix coveralls.github # 2. Build VM image build-vm: diff --git a/README.md b/README.md index 34090ddc5..711eedaa5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![Test](https://github.com/CloudFire-LLC/fireguard/workflows/Test/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/CloudFire-LLC/fireguard/badge.svg?branch=master)](https://coveralls.io/github/CloudFire-LLC/fireguard?branch=master) # FireGuard diff --git a/apps/fg_http/mix.exs b/apps/fg_http/mix.exs index 59347a0f1..e59c47477 100644 --- a/apps/fg_http/mix.exs +++ b/apps/fg_http/mix.exs @@ -13,6 +13,13 @@ defmodule FgHttp.MixProject do elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), start_permanent: Mix.env() == :prod, + test_coverage: [tool: ExCoveralls], + preferred_cli_env: [ + coveralls: :test, + "coveralls.detail": :test, + "coveralls.post": :test, + "coveralls.html": :test + ], aliases: aliases(), deps: deps() ] diff --git a/apps/fg_vpn/mix.exs b/apps/fg_vpn/mix.exs index ee508f111..e7f9f9963 100644 --- a/apps/fg_vpn/mix.exs +++ b/apps/fg_vpn/mix.exs @@ -11,6 +11,13 @@ defmodule FgVpn.MixProject do lockfile: "../../mix.lock", elixir: "~> 1.10", start_permanent: Mix.env() == :prod, + test_coverage: [tool: ExCoveralls], + preferred_cli_env: [ + coveralls: :test, + "coveralls.detail": :test, + "coveralls.post": :test, + "coveralls.html": :test + ], deps: deps() ] end diff --git a/apps/fg_wall/mix.exs b/apps/fg_wall/mix.exs index 25060d374..2faab890f 100644 --- a/apps/fg_wall/mix.exs +++ b/apps/fg_wall/mix.exs @@ -11,6 +11,13 @@ defmodule FgWall.MixProject do lockfile: "../../mix.lock", elixir: "~> 1.9", start_permanent: Mix.env() == :prod, + test_coverage: [tool: ExCoveralls], + preferred_cli_env: [ + coveralls: :test, + "coveralls.detail": :test, + "coveralls.post": :test, + "coveralls.html": :test + ], deps: deps() ] end diff --git a/mix.exs b/mix.exs index e0f7e1c15..591eec1e5 100644 --- a/mix.exs +++ b/mix.exs @@ -10,6 +10,13 @@ defmodule FireguardUmbrella.MixProject do apps_path: "apps", version: "0.1.0", start_permanent: Mix.env() == :prod, + test_coverage: [tool: ExCoveralls], + preferred_cli_env: [ + coveralls: :test, + "coveralls.detail": :test, + "coveralls.post": :test, + "coveralls.html": :test + ], deps: deps(), releases: [ fg_http: [ @@ -32,6 +39,8 @@ defmodule FireguardUmbrella.MixProject do # # Run "mix help deps" for examples and options. defp deps do - [] + [ + {:excoveralls, "~> 0.13", only: :test} + ] end end diff --git a/mix.lock b/mix.lock index a8697d073..f8cf066b6 100644 --- a/mix.lock +++ b/mix.lock @@ -16,6 +16,7 @@ "ecto_sql": {:hex, :ecto_sql, "3.4.4", "d28bac2d420f708993baed522054870086fd45016a9d09bb2cd521b9c48d32ea", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "edb49af715dd72f213b66adfd0f668a43c17ed510b5d9ac7528569b23af57fe8"}, "elixir_make": {:hex, :elixir_make, "0.6.0", "38349f3e29aff4864352084fc736fa7fa0f2995a819a737554f7ebd28b85aaab", [:mix], [], "hexpm", "d522695b93b7f0b4c0fcb2dfe73a6b905b1c301226a5a55cb42e5b14d509e050"}, "ex_machina": {:hex, :ex_machina, "2.4.0", "09a34c5d371bfb5f78399029194a8ff67aff340ebe8ba19040181af35315eabb", [:mix], [{:ecto, "~> 2.2 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}], "hexpm", "a20bc9ddc721b33ea913b93666c5d0bdca5cbad7a67540784ae277228832d72c"}, + "excoveralls": {:hex, :excoveralls, "0.13.0", "4e1b7cc4e0351d8d16e9be21b0345a7e165798ee5319c7800b9138ce17e0b38e", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "fe2a56c8909564e2e6764765878d7d5e141f2af3bc8ff3b018a68ee2a218fced"}, "file_system": {:hex, :file_system, "0.2.8", "f632bd287927a1eed2b718f22af727c5aeaccc9a98d8c2bd7bff709e851dc986", [:mix], [], "hexpm", "97a3b6f8d63ef53bd0113070102db2ce05352ecf0d25390eb8d747c2bde98bca"}, "gettext": {:hex, :gettext, "0.18.0", "406d6b9e0e3278162c2ae1de0a60270452c553536772167e2d701f028116f870", [:mix], [], "hexpm", "c3f850be6367ebe1a08616c2158affe4a23231c70391050bf359d5f92f66a571"}, "hackney": {:hex, :hackney, "1.16.0", "5096ac8e823e3a441477b2d187e30dd3fff1a82991a806b2003845ce72ce2d84", [:rebar3], [{:certifi, "2.5.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.0", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3bf0bebbd5d3092a3543b783bf065165fa5d3ad4b899b836810e513064134e18"},