Skip to content

Commit

Permalink
Rework CI
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit d67d12d
Author: Maximilian Marx <[email protected]>
Date:   Sat Aug 7 03:45:36 2021 +0200

    Add deps

commit 59f7e0a
Author: Maximilian Marx <[email protected]>
Date:   Sat Aug 7 03:41:35 2021 +0200

    Clean

commit 9db4b51
Author: Maximilian Marx <[email protected]>
Date:   Sat Aug 7 03:11:57 2021 +0200

    Wrap maven

commit c44ea6e
Author: Maximilian Marx <[email protected]>
Date:   Sat Aug 7 02:33:36 2021 +0200

    Strip the jar for determinism

commit 14832e8
Author: Maximilian Marx <[email protected]>
Date:   Sat Aug 7 01:42:39 2021 +0200

    Debug even more

commit 3b6babe
Author: Maximilian Marx <[email protected]>
Date:   Sat Aug 7 01:13:33 2021 +0200

    Use gitignoresrc

commit ddae158
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 23:04:19 2021 +0200

    Drop bashInteractive

commit b889351
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 22:57:16 2021 +0200

    Fix version

commit 16edd26
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 22:55:38 2021 +0200

    Back to flakes

commit c37b8c9
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 22:25:50 2021 +0200

    Be pure

commit 3216342
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 22:11:20 2021 +0200

    Go back to regular nix

commit ff55b53
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 21:56:02 2021 +0200

    Be verbose

commit 4293b59
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 21:46:46 2021 +0200

    Change path

commit e2dbcd5
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 21:38:34 2021 +0200

    Simplify structure

commit 457177f
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 21:24:13 2021 +0200

    Yet more debugging

commit 259098f
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 21:03:13 2021 +0200

    Even more debugging, part II

commit fd1357a
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 21:01:42 2021 +0200

    Even more debugging

commit 5357b71
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 20:47:22 2021 +0200

    More debugging

commit 82dea5d
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 20:43:17 2021 +0200

    Debug dependencies

commit 1cc6a7d
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 20:10:51 2021 +0200

    Update install-nix-action

commit 4285f8a
Author: Maximilian Marx <[email protected]>
Date:   Fri Aug 6 19:54:04 2021 +0200

    Refactor CI infrastructure
  • Loading branch information
mmarx committed Aug 7, 2021
1 parent 8607678 commit af3426b
Show file tree
Hide file tree
Showing 21 changed files with 490 additions and 159 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use nix
eval "$(lorri direnv)"
12 changes: 8 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v8
with:
name: knowsys
name: knowsys-rulewerk
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- env:
BRANCH_NAME_OR_REF: ${{ github.head_ref || github.ref }}
run: echo "name=BRANCH_NAME::${BRANCH_NAME_OR_REF#refs/heads/}" >> $GITHUB_ENV
- run: echo "name=PR_NUMBER::$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
- run: nix-shell --run "mvn --no-transfer-progress verify"
- run: nix-shell --pure --run "maven clean verify"
12 changes: 8 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v12
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v8
with:
name: knowsys
name: knowsys-rulewerk
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- env:
BRANCH_NAME_OR_REF: ${{ github.head_ref || github.ref }}
run: echo "name=BRANCH_NAME::${BRANCH_NAME_OR_REF#refs/heads/}" >> $GITHUB_ENV
- run: echo "name=PR_NUMBER::$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")" >> $GITHUB_ENV
- run: nix-shell --run "mvn --no-transfer-progress test jacoco:report && mvn --no-transfer-progress coveralls:report -D repoToken=${{ secrets.COVERALLS_TOKEN }} -D serviceBuildUrl=https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks -D branch=$BRANCH_NAME -D pullRequest=$PR_NUMBER"
- run: nix-shell --pure --run "maven clean test jacoco:report && maven coveralls:report -D repoToken=${{ secrets.COVERALLS_TOKEN }} -D serviceBuildUrl=https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks -D branch=$BRANCH_NAME -D pullRequest=$PR_NUMBER"
77 changes: 77 additions & 0 deletions flake.lock

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

54 changes: 54 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
description = "Rulewerk, a java toolkit for reasoning with existential rules";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
gitignoresrc = {
url = "github:hercules-ci/gitignore.nix";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, flake-compat, gitignoresrc, ... }@inputs:
let getJdk = pkgs: pkgs.jdk8_headless;
in
{
overlay = import ./nix { inherit getJdk gitignoresrc; };
} // (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlay ];
};
in
rec {
packages = flake-utils.lib.flattenTree {
inherit (pkgs) kognac trident vlog rulewerk;
};
defaultPackage = pkgs.rulewerk;
apps.rulewerk = flake-utils.lib.mkApp { drv = packages.rulewerk; };
defaultApp = apps.rulewerk;
devShell =
let jdk = getJdk pkgs;
in
pkgs.mkShell {
buildInputs = [
jdk
(pkgs.maven.override { inherit jdk; })
pkgs.kognac
pkgs.trident
pkgs.sparsehash
pkgs.curl
pkgs.lz4
pkgs.zlib
pkgs.rulewerk
];
};
}
));
}
13 changes: 13 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ getJdk, gitignoresrc }: final: prev:

let
jdk = getJdk final.pkgs;
maven = prev.maven.override { inherit jdk; };
gitignoreSource = (import gitignoresrc { inherit (final.pkgs) lib; }).gitignoreSource;
in
{
kognac = final.pkgs.callPackage ./pkgs/kognac { };
trident = final.pkgs.callPackage ./pkgs/trident { };
vlog = final.pkgs.callPackage ./pkgs/vlog { inherit jdk maven; };
rulewerk = final.pkgs.callPackage ./pkgs/rulewerk { inherit jdk maven gitignoreSource; };
}
50 changes: 50 additions & 0 deletions nix/pkgs/kognac/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ pkgs
, cacert
, cmake
, git
, lib
, lz4
, sparsehash
, stdenv
, zlib
, ...
}:

stdenv.mkDerivation {
pname = "kognac";
version = "unstable-2021-07-07";
src = pkgs.fetchFromGitHub {
owner = "karmaresearch";
repo = "kognac";
rev = "9b75357f87cdbfdb4561437f0000e0a0eb5394e8";
sha256 = "+ElTpGVFz4Gqyc2lcFfjA3W0H+FaH3hInsS51tYGk7Y=";
};

buildInputs = [ zlib sparsehash lz4 ];
nativeBuildInputs = [ cmake git cacert ];

cmakeFlags = [ "-DCMAKE_CXX_FLAGS=-w" ];
patches = [ ./patches/kognac-lz4.patch ];

installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp ./kognac_exec $out/bin
mkdir -p $out/lib
cp ./libkognac-core.so $out/lib/
mkdir -p $out/share/include
cp -R $src/include/kognac/ $out/share/include
cp -R $src/include/zstr/ $out/share/include
runHook postInstall
'';

meta = with lib; {
description = "A library handling compressed storage of RDF triples";
license = licenses.asl20;
homepage = "https://github.com/karmaresearch/kognac";
};
}
File renamed without changes.
66 changes: 66 additions & 0 deletions nix/pkgs/rulewerk/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{ pkgs
, gitignoreSource
, curl
, jdk
, lib
, lz4
, makeWrapper
, maven
, sparsehash
, stdenv
}:

let
rulewerk-dependencies = pkgs.callPackage ./dependencies.nix { inherit gitignoreSource jdk maven; };
in
stdenv.mkDerivation rec {
pname = "rulewerk";
version = "0.9.0-SNAPSHOT";
src = gitignoreSource ../../..;

modules = [
"core"
"vlog"
"rdf"
"owlapi"
"graal"
"parser"
"commands"
"examples"
"client"
];

buildInputs = [ makeWrapper lz4 curl sparsehash ];
nativeBuildInputs = [ maven ];

buildPhase = ''
runHook preBuild
mvn package -Pclient --offline -Dmaven.repo.local=${rulewerk-dependencies}/.m2 -DskipTests
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/java
ln -s ${rulewerk-dependencies}/.m2 $out/lib
for module in ${toString modules}
do
cp ${pname}-$module/target/${pname}-$module-${version}.jar $out/share/java
done
cp rulewerk-client/target/standalone-rulewerk-client-${version}.jar $out/share/java
makeWrapper ${jdk}/bin/java $out/bin/${pname} --add-flags "-jar $out/share/java/standalone-rulewerk-client-${version}.jar"
makeWrapper ${maven}/bin/mvn $out/bin/maven --add-flags "--offline -Dmaven.repo.local=${rulewerk-dependencies}/.m2"
runHook postInstall
'';

meta = with lib; {
description = "A java toolkit for reasoning with existential rules";
license = licenses.asl20;
homepage = "https://github.com/knowsys/rulewerk";
};
}
40 changes: 40 additions & 0 deletions nix/pkgs/rulewerk/dependencies.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ pkgs
, gitignoreSource
, jdk
, lib
, maven
, stdenv
, vlog
}:

stdenv.mkDerivation {
name = "rulewerk-dependencies";
nativeBuildInputs = [ maven ];
src = gitignoreSource ../../..;

preBuild = ''
mkdir -p rulewerk-vlog/lib/
cp ${vlog}/share/java/jvlog.jar rulewerk-vlog/lib/jvlog-local.jar
mvn --no-transfer-progress initialize -Pdevelopment -Dmaven.repo.local=$out/.m2
'';

buildPhase = ''
runHook preBuild
mvn --no-transfer-progress go-offline:resolve-dependencies -Pclient -Dmaven.repo.local=$out/.m2
runHook postBuild
'';

installPhase = ''
runHook preInstall
find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\|maven-metadata-local\.xml\)' -delete
runHook postInstall
'';

outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "vzLyWvgAlNXvYWocB+hyKm9m9sMS+SMtzys1SdhDLso=";
}
Loading

0 comments on commit af3426b

Please sign in to comment.