Skip to content

Commit

Permalink
Add AppImage
Browse files Browse the repository at this point in the history
  • Loading branch information
niess committed Nov 8, 2021
1 parent 7d0ceed commit 10a0ad4
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 23 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: AppImage
on:
push:
tags:
- v*

jobs:
AppImage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Build
run: |
./dist/appimage/build.sh
echo "DANTON_APPIMAGE=danton-$(arch).AppImage" >> $GITHUB_ENV
echo "DANTON_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Upload
uses: AButler/upload-release-assets@v2.0
with:
files: ${{ env.DANTON_APPIMAGE }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ env.DANTON_VERSION }}
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Description
DANTON is a __C99 library__ dedicated to the sampling of decaying taus from
ultra high energy neutrinos interacting in the Earth. It can run in forward or
backward Monte-Carlo. it can also be configured to sample tau fluxes instead of
backward Monte Carlo. it can also be configured to sample tau fluxes instead of
decay densities, or to sample transmitted neutrinos fluxes.

The library is shipped with an __executable__, `danton` which takes a *data
Expand All @@ -23,9 +23,22 @@ detailed topography can be provided from world wide elevation models, e.g.
[SRTMGL1]: https://lpdaac.usgs.gov/dataset_discovery/measures/measures_products_table/srtmgl1_v003

## Installation
DANTON requires a UNIX system, eg. Linux or OSX. The provided
[Makefile](Makefile) builds `libdanton` as a shared library as well as the
`danton` executable, e.g. as:
DANTON requires a UNIX system, eg. Linux or OSX. On Linux, the latest version of
the danton executable is available as an AppImage, from the
[releases](https://github.com/niess/danton/releases) assets, e.g. as:
```bash
# Fetch the danton AppImage from GitHub
wget https://github.com/niess/danton/releases/download/v0.3/danton-x86_64.AppImage

# Make the downloaded binary executable
chmod u+x danton-x86_64.AppImage

# Run the AppImage
./danton-x86_64.AppImage path/to/card.json
```

Alternatively, the provided [Makefile](Makefile) builds `libdanton` as a shared
library as well as the `danton` executable, e.g. as:
```bash
# Fetch the source and deps from GitHub
git clone --recursive https://github.com/niess/danton.git
Expand Down Expand Up @@ -53,11 +66,11 @@ can also be found in the [examples/cards](examples/cards) folder.
### Root items
```
decay boolean If `true` the sampled taus are decayed.
events integer The number of Monte-Carlo events to run.
events integer The number of Monte Carlo events to run.
longitudinal boolean If `true` the transverse transport is disabled.
mode string The run mode, one of "backward", "forward" or "grammage".
output-file string, null The output file name or `null` for `stdout`.
requested integer The requested number of valid Monte-Carlo events
requested integer The requested number of valid Monte Carlo events
seed unsigned, null The simulation random seed. If null, then the seed is set
from the OS entropy using /dev/urandom.
```
Expand Down Expand Up @@ -123,7 +136,7 @@ weight float The weight of the primary, i.e. the integra
```
append boolean If `true`, append to the output file.
path string Path to the output file.
verbosity integer Verbosity level for recording Monte-Carlo steps.
verbosity integer Verbosity level for recording Monte Carlo steps.
```

## License
Expand Down
2 changes: 2 additions & 0 deletions dist/appimage/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#! /bin/bash
DANTON_PREFIX=$APPDIR $APPDIR/bin/danton $*
28 changes: 12 additions & 16 deletions dist/linux.sh → dist/appimage/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#! /bin/bash

# Script base directory.
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Generate the binaries
SCRIPT=$(cat <<-END
echo "building danton with \$(gcc --version | head -n 1)"
Expand All @@ -23,20 +26,13 @@ cp -rL include AppDir
./AppDir/bin/danton examples/cards/backward-tau-decays.json > /dev/null
rm -f steps.json

# Bundle AppImage meta and entry point
cat << END > AppDir/danton.desktop
[Desktop Entry]
Type=Application
Name=danton
Exec=danton
Comment=Simulate the coupled transport of ultra high energy taus and neutrinos through the Earth, by Monte-Carlo
Icon=danton
Categories=Science;
Terminal=true
END
# Bundle AppImage meta and AppRun
cp ${basedir}/danton.desktop AppDir
cp ${basedir}/danton.png AppDir
cp ${basedir}/danton.appdata.xml AppDir
cp ${basedir}/AppRun AppDir

cat << END > AppDir/AppRun
#! /bin/bash
DANTON_PREFIX=\$APPDIR \$APPDIR/bin/danton \$*
END
chmod u+x AppDir/AppRun
# Build the AppImage
appimagetool=appimagetool-$(arch).AppImage
[ -e ${appimagetool} ] || wget https://github.com/AppImage/AppImageKit/releases/download/continuous/${appimagetool} && chmod u+x ${appimagetool}
./${appimagetool} AppDir
27 changes: 27 additions & 0 deletions dist/appimage/danton.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>danton</id>
<metadata_license>MIT</metadata_license>
<project_license>LGL-3.0</project_license>
<name>Danton</name>
<summary>
Simulate the coupled transport of ultra high energy taus and neutrinos
through the Earth, by Monte-Carlo.
</summary>
<description>
<p> Danton (DecAying Taus frOm Neutrinos) is an executable dedicated to
the sampling of decaying taus from ultra high energy neutrinos
interacting in the Earth. It can run in forward or backward
Monte Carlo. it can also be configured to sample tau fluxes instead
of decay densities, or to sample transmitted neutrinos fluxes. The
danton executable takes a data card in JSON format as argument.
Data cards syntax and examples are available from
https://github.com/niess/danton.
</p>
</description>
<launchable type="desktop-id">danton.desktop</launchable>
<url type="homepage">https://github.com/niess/danton</url>
<provides>
<binary>danton</binary>
</provides>
</component>
8 changes: 8 additions & 0 deletions dist/appimage/danton.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=danton
Exec=danton
Comment=Simulate the coupled transport of ultra high energy taus and neutrinos through the Earth, by Monte-Carlo
Icon=danton
Categories=Science;
Terminal=true
Binary file added dist/appimage/danton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 10a0ad4

Please sign in to comment.