fixup! WIP: Add unit tests
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
Simon Bruder 2024-07-25 23:19:04 +02:00
parent df6fb22079
commit 9b2adaa5d6
Signed by: simon
GPG key ID: 347FF8699CDA0776
2 changed files with 58 additions and 30 deletions

View file

@ -20,8 +20,8 @@ jobs:
git config --unset "http.${GITHUB_SERVER_URL}/.extraHeader"
git lfs install --local
git lfs pull
- name: Build
run: nix build -L .#li7y .#li7y-oci
- name: Build and test
run: nix build -L .#li7y .#li7y-oci .#li7y-tarpaulin
- name: Push OCI image
if: github.ref == 'refs/heads/master'
run: |
@ -30,3 +30,8 @@ jobs:
podman tag li7y git.sbruder.de/simon/li7y:latest
podman login --username simon --password "${{ secrets.REGISTRY_PASSWORD }}" git.sbruder.de
podman push git.sbruder.de/simon/li7y:latest
- run: nix build -L .#li7y-tarpaulin
- uses: actions/upload-artifact@v4
with:
name: tarpaulin
path: result/

View file

@ -74,8 +74,10 @@
};
};
packages = rec {
li7y = naersk'.buildPackage {
packages =
let
# naersk does not easily allow overrideAttrs
commonNaerskConfigurarion = {
src = self;
checkInputs = with pkgs; [
@ -97,8 +99,29 @@
# Also, this enforces that the full query cache is included in the repository.
SQLX_OFFLINE = true;
};
in
rec {
li7y = naersk'.buildPackage commonNaerskConfigurarion;
default = li7y;
li7y-tarpaulin = naersk'.buildPackage (commonNaerskConfigurarion // {
name = "li7y-tarpaulin";
checkInputs = commonNaerskConfigurarion.checkInputs ++ (with pkgs; [
cargo-tarpaulin
]);
dontBuild = true;
singleStep = true; # tarpaulin uses different options anyway
cargoTestCommands = _: [ "cargo tarpaulin" ];
postInstall = ''
rm -r $out
cp -r target/tarpaulin $out
'';
});
li7y-oci = pkgs.dockerTools.buildLayeredImage {
name = "li7y";
tag = "latest";