Skip to content

Commit

Permalink
Feature: Introducing a nix flake for distribution
Browse files Browse the repository at this point in the history
Changes:
- Nix flake, which makes it easier to distribute the coverage scope.
  • Loading branch information
DennisJensen95 committed Sep 12, 2023
1 parent ee2e078 commit dda18ba
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
# Coverage reports
cobertura.xml
tarpaulin-report.html

# Nix
result
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "coverage_scope"
version = "0.1.0"
version = "0.5.1"
edition = "2021"

[dependencies]
chrono = "0.4.24"
clap = { version = "4.2.7", features = ["derive"] }
lcov2cobertura = "1.0.1"
mockall = "0.11.4"
serde = { version = "1.0.130", features = ["derive"]}
serde = { version = "1.0.130", features = ["derive"] }
serde-xml-rs = "0.6.0"
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!-- Badge ci build ci.yml -->
![Build Status](https://github.com/DennisJensen95/coverage-scope/actions/workflows/ci.yml/badge.svg)
![Code coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/DennisJensen95/2b7862c80c14d562c8659e1283543190/raw/coverage-scope.json)
[![Lines of Code](https://tokei.rs/b1/github/DennisJensen95/coverage-scope)](https://github.com/DennisJensen95/coverage-scope)

# coverage-scope

Expand Down
12 changes: 12 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
version = cargoToml.package.version;
in
{ pkgs ? import <nixpkgs> {} }:

pkgs.rustPlatform.buildRustPackage rec {
pname = "coverage-scope";
inherit version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
}
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
description = "Coverage scope helping in CI flows for change coverage quality gating";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./. { };
});
};
}
5 changes: 4 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
build:
cargo build --release

lint:
cargo clippy --all-targets --all-features -- -D warnings

Expand All @@ -23,4 +26,4 @@ push-docker VERSION_TAG:
docker buildx build --platform linux/amd64 -t coverage-scope-amd64 -f Dockerfile.build .
docker tag coverage-scope-amd64 dennisjensen95/coverage-scope:{{VERSION_TAG}}
docker push dennisjensen95/coverage-scope:{{VERSION_TAG}}


0 comments on commit dda18ba

Please sign in to comment.