Skip to content

Commit

Permalink
feat(ci): add portable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed May 21, 2024
1 parent f2e90ad commit e64388f
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Build
run: nix build -L .#bundled
run: nix build -L .#all
- name: Upload
uses: actions/upload-artifact@v4
with:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/Portable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Portable

on:
- push

jobs:
Build:
strategy:
fail-fast: false
matrix:
target:
- triple: x86_64-unknown-linux-gnu
runner: ubuntu-latest
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
- name: Bundle
run: nix bundle --bundler github:DavHau/nix-portable -o bundle .#all
- name: Upload
uses: actions/upload-artifact@v4
with:
name: d4-${{ matrix.target.triple }}-portable
path: bundle
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## Installation

### Prebuilt

There are prebuilt binaries available for each commit and release.
These binaries are bundled with their dependencies.
For details, see the README inside the release folder.

On (Linux) systems with an older glibc, the normal variant might not work.
In this case, there is also the portable variant which is a self-extracting archive with everything bundled in one binary.

### Nix

This project can be used and developed via a [Nix][nix] [flake][flake].
Expand Down
30 changes: 30 additions & 0 deletions doc/x86_64-linux-portable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# d4

This is a portable version of d4.
The project is licensed under the LGPL-2.1 and the source can be found at https://github.com/SoftVarE-Group/d4v2

## Dependencies

In this version, all dependencies and the Nix package manager are bundled with d4 in a self-extracting archive.
Other than Git, there are no dependencies.
When Git is not found, the bundled Nix will fetch it automatically.

The self-extracting archive is generated using https://github.com/DavHau/nix-portable and will create the directory `$HOME/.nix-portable`.
This can be overwritten by the `NP_LOCATION` environment variable which defaults to `$HOME`.

## Usage

The binary `d4` is inside `bin`.
To show the help message, use:

```
d4 --help
```

### d-DNNF compilation

```
d4 --input /path/to/input.cnf --method ddnnf-compiler --dump-ddnnf /path/to/output.ddnnf
```

... will take a CNF from `/path/to/input.cnf`, compile it into a d-DNNF and write it to `/path/to/output.ddnnf`.
17 changes: 9 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
};
};

bundled-deps = pkgs.buildEnv {
name = "bundled-deps";
dependencies = pkgs.buildEnv {
name = "dependencies";
paths = [
self.packages.${system}.mt-kahypar
pkgs.hwloc.lib
Expand All @@ -117,21 +117,22 @@
];
};

bundled-doc = pkgs.stdenv.mkDerivation {
name = "bundled-doc";
documentation = pkgs.stdenv.mkDerivation {
name = "documentation";
src = ./doc;
installPhase = ''
mkdir $out
cp ${system}.md $out/README.md
'';
};

bundled = pkgs.buildEnv {
name = "bundled";
all = pkgs.buildEnv {
name = "d4";
meta.mainProgram = "d4";
paths = [
self.packages.${system}.d4
self.packages.${system}.bundled-deps
self.packages.${system}.bundled-doc
self.packages.${system}.dependencies
self.packages.${system}.documentation
];
};
};
Expand Down

0 comments on commit e64388f

Please sign in to comment.