This commit is contained in:
Robin Appelman 2024-07-25 23:00:53 +02:00
commit 169134bd53
5 changed files with 109 additions and 16 deletions

79
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,79 @@
on: [ push, pull_request ]
name: CI
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#check
check-extractor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#extractor
clippy:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#clippy
build:
runs-on: ubuntu-latest
needs: check
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-pc-windows-gnu
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: logsmash-${{ matrix.target }}
path: result/bin/*
build-nixpkgs:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#logsmash

View file

@ -65,7 +65,7 @@
];
releaseTargets = lib.lists.remove hostTarget targets;
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
src = sourceByRegex ./. ["Cargo.*" "(src|data)(/.*)?"];
extractorSrc = sourceByRegex ./logging-extractor ["Cargo.*" "(src)(/.*)?"];
nearskOpt = {
pname = "cloud-log-analyser";
@ -76,30 +76,20 @@
lib.attrsets.genAttrs targets (target:
(cross-naersk'.buildPackage target) nearskOpt)
// {
inherit (pkgs) logging-extractor extracted-logs extracted-logs-rust;
check = naersk'.buildPackage (nearskOpt
inherit (pkgs) logging-extractor extracted-logs extracted-logs-rust logsmash;
check = msrvNaersk.buildPackage (nearskOpt
// {
mode = "check";
});
extractorCheck = naersk'.buildPackage (nearskOpt
extractor = msrvNaersk.buildPackage (nearskOpt
// {
mode = "check";
root = extractorSrc;
});
clippy = naersk'.buildPackage (nearskOpt
clippy = msrvNaersk.buildPackage (nearskOpt
// {
mode = "clippy";
});
msrv = msrvNaersk.buildPackage (nearskOpt
// {
mode = "check";
});
extractorMsrv = extractorMsrvNaersk.buildPackage (nearskOpt
// {
mode = "check";
root = extractorSrc;
});
default = pkgs.shelve;
default = pkgs.logsmash;
};
apps.default = packages.default;

View file

@ -26,4 +26,5 @@ in {
name = "extracted-logs";
paths = flatten (map attrValues (attrValues final.extracted-logs-parts-rust));
};
logsmash = final.callPackage ./package.nix {};
}

23
nix/package.nix Normal file
View file

@ -0,0 +1,23 @@
{
stdenv,
makeRustPlatform,
rust-bin,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ../. ["Cargo.*" "(src|data)(/.*)?"];
rustPlatform = makeRustPlatform {
cargo = rust-bin.stable.latest.default;
rustc = rust-bin.stable.latest.default;
};
in
rustPlatform.buildRustPackage rec {
pname = "logsmash";
version = "0.1.0";
inherit src;
cargoLock = {
lockFile = ../Cargo.lock;
};
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Before After
Before After