Skip to content

Commit

Permalink
Merge pull request #2 from roveri-marco/singularity-build-and-release
Browse files Browse the repository at this point in the history
Singularity build and release
  • Loading branch information
roveri-marco authored Oct 6, 2021
2 parents 958bd95 + a6194b3 commit 770a60c
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: optic-singularity-deploy

on:
push:

# This branch does not exist! You should update this to be your
# "production" branch and ensure that when you work on recipes you
# only merge to this branch when it's time to release You can also
# use another GitHub trigger entirely
branches:
- "master"

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get Latest Tag
run: |
# Get the latest tag, we won't build if it's the current
git fetch --tags
latest_tag=$(git tag | tail -1)
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- name: Define Repository Name and Release Version
run: |
repo=$(echo "${GITHUB_REPOSITORY/\//-}")
release=$(cat VERSION)
echo "reponame=$repo" >> $GITHUB_ENV
echo "release_tag=$release" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
if: ${{ env.release_tag != env.latest_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.release_tag }}
release_name: Release ${{ env.release_tag }}
draft: false
prerelease: false
- uses: eWaterCycle/setup-singularity@v6
if: ${{ env.release_tag != env.latest_tag }}
with:
singularity-version: 3.7.1
- name: Build the singularity container
if: ${{ env.release_tag != env.latest_tag }}
run: |
repo=$(echo "${GITHUB_REPOSITORY/\//-}")
# For each Singularity* container, build based on the prefix (tag)
for recipe in $(ls Singularity*); do
echo "Building $recipe"
tag=$(echo "${recipe/Singularity\./}")
# If we find empty, use latest
if [ "$tag" == "Singularity" ]; then
tag=latest
fi
# Build the container and name by tag
echo "Tag is $tag."
container="$repo:$tag.sif"
singularity build --fakeroot container.sif "$recipe"
if [ "$?" == "0" ]; then
echo "Successfully built container $container."
mv container.sif "$container"
else
echo "There was an issue building $container."
fi
done
- name: Upload Release Assets
if: ${{ env.release_tag != env.latest_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
tag_name: ${{ env.release_tag }}
run: |
hub release edit $(find . -type f -name "*.sif" -printf "-a %p ") -m "" "$tag_name"
70 changes: 70 additions & 0 deletions Singularity
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Bootstrap: docker
From: ubuntu:focal

%post
## Install all necessary dependencies.
apt-get update
export DEBIAN_FRONTEND=noninteractive
export TZ="Europe/London"
apt-get install --no-install-recommends -y \
build-essential cmake g++ make python perl \
bison flex ca-certificates git \
coinor-libcbc-dev coinor-libclp-dev \
coinor-libcgl-dev libgsl-dev libfl-dev libbison-dev\
coinor-libcoinutils-dev zlib1g-dev libbz2-dev
rm -rf /var/lib/apt/lists/*

git clone https://github.com/roveri-marco/optic.git /planner

## Build your planner
cd /planner
./run-cmake-release
./build-release

# Cleanup not needed packages
apt autoremove -y --purge

%environment
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export TZ="Europe/London"

%runscript
## The runscript is called whenever the container is used to solve
## an instance.

# This is needed to avoid weird messages about profiling files
# enabled by default in the compiler with optimization, so that
# files are saved in a particular directory that then is destroyed.
export tmpdir=/tmp/optic_$$
export GCOV_PREFIX=${tmpdir}
## Call your planner.
/planner/release/optic/optic-clp $*
rm -rf ${tmpdir}

## Update the following fields with meta data about your submission.
## Please use the same field names and use only one line for each value.
%labels
Name optic

Description The optic temporal planner originally taken from\
https://sourceforge.net/projects/tsgp/files/OPTIC/ and\
adapted to compile in recent machines in\
https://github.com/roveri-marco/optic\
\
OPTIC is free software: you can redistribute it and/or\
modify it under the terms of the GNU General Public\
License as published by the Free Software Foundation,\
either version 2 of the License, or (at your option) any\
later version.\
\
OPTIC is distributed in the hope that it will be useful,\
but WITHOUT ANY WARRANTY; without even the implied\
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\
PURPOSE. See the GNU General Public License for more\
details.\
Authors J. Benton, A. J. Coles, A. I. Coles, K. Tierney,\
C. Kroer, A. Britt, R. M. Jensen, ported by Marco Roveri
SupportsDerivedPredicates no
SupportsQuantifiedPreconditions no
SupportsQuantifiedEffects no
70 changes: 70 additions & 0 deletions Singularity.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Bootstrap: docker
From: ubuntu:focal

%post
## Install all necessary dependencies.
apt-get update
export DEBIAN_FRONTEND=noninteractive
export TZ="Europe/London"
apt-get install --no-install-recommends -y \
build-essential cmake g++ make python perl \
bison flex ca-certificates git \
coinor-libcbc-dev coinor-libclp-dev \
coinor-libcgl-dev libgsl-dev libfl-dev libbison-dev\
coinor-libcoinutils-dev zlib1g-dev libbz2-dev
rm -rf /var/lib/apt/lists/*

git clone https://github.com/roveri-marco/optic.git /planner

## Build your planner
cd /planner
./run-cmake-release
./build-release

# Cleanup not needed packages
apt autoremove -y --purge

%environment
export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export TZ="Europe/London"

%runscript
## The runscript is called whenever the container is used to solve
## an instance.

# This is needed to avoid weird messages about profiling files
# enabled by default in the compiler with optimization, so that
# files are saved in a particular directory that then is destroyed.
export tmpdir=/tmp/optic_$$
export GCOV_PREFIX=${tmpdir}
## Call your planner.
/planner/release/optic/optic-clp $*
rm -rf ${tmpdir}

## Update the following fields with meta data about your submission.
## Please use the same field names and use only one line for each value.
%labels
Name optic

Description The optic temporal planner originally taken from\
https://sourceforge.net/projects/tsgp/files/OPTIC/ and\
adapted to compile in recent machines in\
https://github.com/roveri-marco/optic\
\
OPTIC is free software: you can redistribute it and/or\
modify it under the terms of the GNU General Public\
License as published by the Free Software Foundation,\
either version 2 of the License, or (at your option) any\
later version.\
\
OPTIC is distributed in the hope that it will be useful,\
but WITHOUT ANY WARRANTY; without even the implied\
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\
PURPOSE. See the GNU General Public License for more\
details.\
Authors J. Benton, A. J. Coles, A. I. Coles, K. Tierney,\
C. Kroer, A. Britt, R. M. Jensen, ported by Marco Roveri
SupportsDerivedPredicates no
SupportsQuantifiedPreconditions no
SupportsQuantifiedEffects no
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0
1 change: 1 addition & 0 deletions src/optic/RPGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3020,6 +3020,7 @@ RPGBuilder::op_type checkIfRogue(TimedPrecEffCollector & c)

for (; dItr != dEnd; ++dItr) {
if (!(*dItr)) {
if (rogueDebug) cout << "Start Precondition " << *dItr << " doesn't exist\n";
return RPGBuilder::OT_INVALID_ACTION;
}
assert((*dItr)->valid);
Expand Down

0 comments on commit 770a60c

Please sign in to comment.