Skip to content

Commit ffa30f6

Browse files
committed
ci: native coverage report instead of excoveralls
excoveralls 0.18.5 fails on OTP 27 (:cover.compile_beam MatchError), so the coverage job now runs mix test --cover, uploads the HTML report as an artifact and comments the total on pull requests. mix.exs drops the excoveralls dependency and test_coverage tool.
1 parent 6092b13 commit ffa30f6

3 files changed

Lines changed: 24 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,35 @@ jobs:
7070
- name: Fetch dependencies
7171
run: mix deps.get
7272

73-
- name: Probe native coverage first
73+
- name: Generate coverage report
7474
env:
7575
MIX_ENV: test
76-
run: mix test --cover 2>&1 | tail -5
76+
run: |
77+
mix test --cover > /tmp/cover.log 2>&1
78+
tail -6 /tmp/cover.log
79+
80+
- name: Extract total coverage
81+
id: total
82+
run: |
83+
pct=$(grep '| Total' /tmp/cover.log | awk -F'|' '{gsub(/ /, "", $2); print $2}')
84+
echo "pct=$pct" >> "$GITHUB_OUTPUT"
7785
7886
- name: Upload coverage artifact
7987
uses: actions/upload-artifact@v4
8088
with:
81-
name: cobertura.xml
82-
path: cover/cobertura.xml
89+
name: coverage-report
90+
path: cover/
8391

84-
- name: Comment coverage summary on pull request
92+
- name: Comment coverage on pull request
8593
if: github.event_name == 'pull_request'
86-
uses: irongut/CodeCoverageSummary@v1.3.0
94+
env:
95+
COVERAGE_PCT: ${{ steps.total.outputs.pct }}
96+
uses: actions/github-script@v7
8797
with:
88-
filename: cover/cobertura.xml
89-
badge: true
90-
format: markdown
91-
output: both
98+
script: |
99+
await github.rest.issues.createComment({
100+
owner: context.repo.owner,
101+
repo: context.repo.repo,
102+
issue_number: context.issue.number,
103+
body: `Coverage: **${process.env.COVERAGE_PCT}** (HTML report in the coverage-report artifact)`
104+
})

mix.exs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ defmodule LovelyMermaid.MixProject do
1616
# Quality gates
1717
dialyzer: [plt_add_apps: [:mix]],
1818

19-
# Coverage
20-
test_coverage: [tool: ExCoveralls],
2119

2220
# Package
2321
description: "Render Mermaid diagrams as Unicode box-drawing art for terminals",
@@ -49,8 +47,7 @@ defmodule LovelyMermaid.MixProject do
4947
{:ex_slop, "~> 0.4", only: [:dev, :test], runtime: false},
5048
{:reach, "~> 2.8", only: [:dev, :test], runtime: false},
5149
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
52-
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
53-
{:excoveralls, "~> 0.18", only: :test, runtime: false}
50+
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
5451
]
5552
end
5653

mix.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"ex_dna": {:hex, :ex_dna, "1.5.4", "5a636109aeccca1c6df074367f53dc096f4280e90c075f5537ce8b8b4a843343", [:mix], [{:credo, "~> 1.7", [hex: :credo, repo: "hexpm", optional: true]}, {:gen_lsp, "~> 0.11", [hex: :gen_lsp, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: true]}], "hexpm", "66e6c7157127f023a219be16f2aa8e3a18c698e7a106f78bb24304b34df8034b"},
99
"ex_doc": {:hex, :ex_doc, "0.40.3", "4a972ffe64bc07dc605af487e98fc19b72a4185f55ca031b94c0552d6071c1d9", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "2756e357742fecd9749b489b85d67c9ce99c465f2e75728d9e6dc8d704b973de"},
1010
"ex_slop": {:hex, :ex_slop, "0.4.4", "8ca277b902e93193eb3545e414c309026a51204e5eb7d6ada5ff96555de6abcb", [:mix], [{:credo, "~> 1.7", [hex: :credo, repo: "hexpm", optional: false]}], "hexpm", "03ef1b2553ebad45c8ceb3e482eed5f1ccd08fc992215a9da0ef6196935107e2"},
11-
"excoveralls": {:hex, :excoveralls, "0.18.5", "e229d0a65982613332ec30f07940038fe451a2e5b29bce2a5022165f0c9b157e", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "523fe8a15603f86d64852aab2abe8ddbd78e68579c8525ae765facc5eae01562"},
1211
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
1312
"jason": {:hex, :jason, "1.4.5", "2e3a008590b0b8d7388c20293e9dcc9cf3e5d642fd2a114e4cbbb52e595d940a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b0c823996102bcd0239b3c2444eb00409b72f6a140c1950bc8b457d836b30684"},
1413
"libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"},

0 commit comments

Comments
 (0)