Skip to content

Commit f35f031

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/sqlite-image-graph-backend
# Conflicts: # mix.lock
2 parents 58675d4 + f2ce56a commit f35f031

9 files changed

Lines changed: 94 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,22 @@ jobs:
8787
mix ecto.create -r Hyper.Img.Db.Repo.Postgres
8888
mix ecto.migrate -r Hyper.Img.Db.Repo.Postgres
8989
90-
- name: Test (warnings as errors)
90+
- name: Test + coverage (warnings as errors)
9191
env:
9292
MIX_ENV: test
93-
# --no-start: the app's supervision tree boots Hyper.Node, which provisions
94-
# a real Firecracker host under /srv/hyper -- unavailable (and unprivileged)
95-
# on a CI runner. This matches how the suite is run in development; tests
96-
# that need the Repo start it themselves against the DB created above.
97-
run: mix test --no-start --warnings-as-errors
93+
# coveralls.json wraps `mix test` (so --no-start / --warnings-as-errors
94+
# still apply) and writes cover/excoveralls.json for the Codecov upload.
95+
# --no-start: the supervision tree provisions a real Firecracker host
96+
# under /srv/hyper, unavailable on a CI runner.
97+
run: mix coveralls.json --no-start --warnings-as-errors
98+
99+
- name: Upload coverage to Codecov
100+
uses: codecov/codecov-action@v5
101+
with:
102+
token: ${{ secrets.CODECOV_TOKEN }}
103+
files: cover/excoveralls.json
104+
flags: elixir
105+
fail_ci_if_error: true
98106

99107
- name: Dialyzer
100108
run: mix dialyzer
@@ -123,5 +131,19 @@ jobs:
123131
- name: clippy
124132
run: cargo clippy --all-targets --all-features -- -D warnings
125133

126-
- name: test
127-
run: cargo test --all-features
134+
- name: Install cargo-llvm-cov
135+
uses: taiki-e/install-action@v2
136+
with:
137+
tool: cargo-llvm-cov
138+
139+
- name: test + coverage
140+
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
141+
142+
- name: Upload coverage to Codecov
143+
uses: codecov/codecov-action@v5
144+
with:
145+
token: ${{ secrets.CODECOV_TOKEN }}
146+
# working-directory only applies to `run:` steps, not actions.
147+
files: native/suidhelper/lcov.info
148+
flags: rust
149+
fail_ci_if_error: true

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<a href="https://hexdocs.pm/hypervm/"><img src="https://img.shields.io/badge/docs-hexdocs-purple.svg" alt="Hexdocs" /></a>
88
<a href="LICENSE"><img src="https://img.shields.io/hexpm/l/hypervm.svg" alt="License: AGPL-3.0" /></a>
99
<a href="https://github.com/harmont-dev/hyper/commits/main"><img src="https://img.shields.io/github/last-commit/harmont-dev/hyper.svg" alt="Last commit" /></a>
10+
<a href="https://codecov.io/gh/harmont-dev/hyper"><img src="https://codecov.io/gh/harmont-dev/hyper/branch/main/graph/badge.svg" alt="Coverage" /></a>
1011
<a href="https://discord.gg/hm-dev"><img src="https://img.shields.io/discord/1503184719578136576?logo=discord&label=discord" alt="Discord" /></a>
1112
<img src="https://img.shields.io/badge/elixir-~%3E%201.20-4B275F.svg" alt="Elixir ~> 1.20" />
1213
</p>
@@ -50,7 +51,7 @@ deploying and integrating Hyper.
5051
[BEAM](https://en.wikipedia.org/wiki/BEAM_(Erlang_virtual_machine)). This
5152
means that fault-tolerance is built into the virtual machine, and allows you
5253
to interactively debug any issues you run into.
53-
- gRPC Interface -- although the author exclusively uses Hyper through the
54+
- **gRPC Interface** -- although the author exclusively uses Hyper through the
5455
BEAM-native interfaces, we recognize this may not be ideal for all languages
5556
and existing stacks. For that reason, Hyper has a GRPC interface, so you can
5657
call it from any language you already use.

codecov.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Codecov configuration for the hyper monorepo. Two components upload under
2+
# distinct flags from separate CI jobs (see .github/workflows/ci.yml):
3+
# elixir -> cover/excoveralls.json (ExCoveralls / mix coveralls.json)
4+
# rust -> native/suidhelper/lcov.info (cargo llvm-cov)
5+
coverage:
6+
status:
7+
project:
8+
default:
9+
target: auto
10+
# Don't fail PRs on coverage deltas yet (early-stage project).
11+
informational: true
12+
patch:
13+
default:
14+
informational: true
15+
16+
flags:
17+
elixir:
18+
paths:
19+
- lib/
20+
carryforward: true
21+
rust:
22+
paths:
23+
- native/suidhelper/src/
24+
carryforward: true
25+
26+
# Generated bindings, deps, and test code never count toward coverage.
27+
ignore:
28+
- "lib/hyper/firecracker/api/operations"
29+
- "lib/hyper/firecracker/api/schemas"
30+
- "test"
31+
- "deps"
32+
- "native/suidhelper/target"
33+
34+
comment:
35+
layout: "reach, flags, files"
36+
require_changes: false

coveralls.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"skip_files": [
3+
"lib/hyper/firecracker/api/operations/",
4+
"lib/hyper/firecracker/api/schemas/"
5+
]
6+
}

mix.exs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ defmodule Hyper.MixProject do
1515
# the only hook that also fires when hyper is compiled AS A DEPENDENCY.
1616
compilers: [:firecracker_gen | Mix.compilers()],
1717
deps: deps(),
18+
test_coverage: [tool: ExCoveralls],
1819
docs: docs(),
1920
package: package(),
2021
aliases: aliases(),
@@ -28,6 +29,18 @@ defmodule Hyper.MixProject do
2829
]
2930
end
3031

32+
# Run the coverage tasks in :test so test-only deps (excoveralls) load and the
33+
# Repo-backed tests see the test database. Mirrors how `mix test` selects :test.
34+
def cli do
35+
[
36+
preferred_envs: [
37+
coveralls: :test,
38+
"coveralls.json": :test,
39+
"coveralls.html": :test
40+
]
41+
]
42+
end
43+
3144
# Run "mix help compile.app" to learn about applications.
3245
def application do
3346
[
@@ -43,6 +56,7 @@ defmodule Hyper.MixProject do
4356
defp deps do
4457
[
4558
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
59+
{:excoveralls, "~> 0.18", only: :test, runtime: false},
4660
{:dialyxir, "~> 1.4", only: [:dev], runtime: false},
4761
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
4862
{:ecto_sql, "~> 3.13"},

mix.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"elixir_make": {:hex, :elixir_make, "0.10.0", "16577e2583a79bb79237bbff349619ef5d80afffc07eac6e4faf0d00e2ddaf7d", [:mix], [], "hexpm", "dc1f09fb7fa68866b886abd5f0f3c83553b1a19a52359a899e92af1bb3b31982"},
1818
"erlex": {:hex, :erlex, "0.2.9", "7debbbaa9f4f368b8cd648983e0f1d7963028508e9c59e9d4ed504e94ef52a55", [:mix], [], "hexpm", "8cfffc0ec7159e6d73de2ab28a588064de80f88b2798d5cbe4482cbbc200178b"},
1919
"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"},
20+
"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"},
2021
"exqlite": {:hex, :exqlite, "0.37.0", "701e7e02679e8c1bb6da331ea93d83b481c714b0831e82e2f8a73375b3d93a9e", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.8", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "a44816dd0d234fba68c47a3609af61d306d24ef517a89bfaee4d6a811792d913"},
2122
"file_system": {:hex, :file_system, "1.1.1", "31864f4685b0148f25bd3fbef2b1228457c0c89024ad67f7a81a3ffbc0bbad3a", [:mix], [], "hexpm", "7a15ff97dfe526aeefb090a7a9d3d03aa907e100e262a0f8f7746b78f8f87a5d"},
2223
"finch": {:hex, :finch, "0.23.0", "e3f9287ac25a8832f848b144c2b57346aac65b205e2e0629a52adfe6507fd837", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.8", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "80e58d3f936f57e3fdf404f83a3642897ae6d9fb642934e46da4d8fe761b99d5"},

native/suidhelper/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
/lcov.info

native/suidhelper/rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ channel = "nightly"
88
targets = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"]
99
# Pin the lint/format tooling so `cargo fmt`/`cargo clippy` auto-install it
1010
# (rustup honors this file in CI and locally).
11-
components = ["clippy", "rustfmt"]
11+
components = ["clippy", "rustfmt", "llvm-tools-preview"]

native/suidhelper/src/util/safe_path.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ pub enum ValidationError {
2020
}
2121

2222
/// Absoluteness axis: require an absolute path.
23+
#[derive(Debug)]
2324
pub struct IsAbsolute;
2425
/// Components axis: reject `.`, `..`, and empty components.
26+
#[derive(Debug)]
2527
pub struct StrictComponents;
2628

2729
/// Absoluteness axis.
@@ -59,6 +61,7 @@ impl Components for StrictComponents {
5961
}
6062

6163
/// A `PathBuf` proven to satisfy the lexical axes named by its type parameters.
64+
#[derive(Debug)]
6265
pub struct SafePath<A, S>(PathBuf, PhantomData<(A, S)>);
6366

6467
impl<A> SafePath<A, StrictComponents> {

0 commit comments

Comments
 (0)