From 7b92921a8a9e14dee78b7690c9d1391cc2227da9 Mon Sep 17 00:00:00 2001 From: Aaron Tomb Date: Thu, 17 Dec 2020 08:49:55 -0800 Subject: [PATCH 1/6] Bump version to 0.7.0.99 after 0.7 release --- saw-script.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saw-script.cabal b/saw-script.cabal index 08fec52266..b892c19b47 100644 --- a/saw-script.cabal +++ b/saw-script.cabal @@ -1,5 +1,5 @@ Name: saw-script -Version: 0.6.0.99 +Version: 0.7.0.99 Author: Galois Inc. Maintainer: atomb@galois.com Build-type: Custom From 1c53ef837fc60f8c8af7c7cd7c24dcc6f7ac34ff Mon Sep 17 00:00:00 2001 From: Aaron Tomb Date: Thu, 17 Dec 2020 08:50:20 -0800 Subject: [PATCH 2/6] Make executable finding more robust in CI When changing the version of a package, builds for the old version are cached so there will likely be two versions of all the executables. We just want one of them, and the newest one. This seems to do the trick for now, but I'm eagerly awaiting the time when Cabal will do this for us. --- .github/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ci.sh b/.github/ci.sh index 4c9a15f4f2..d0ee592859 100755 --- a/.github/ci.sh +++ b/.github/ci.sh @@ -10,7 +10,7 @@ mkdir -p "$BIN" is_exe() { [[ -x "$1/$2$EXT" ]] || command -v "$2" > /dev/null 2>&1; } extract_exe() { - exe="$(find "${3:-dist-newstyle}" -type f -name "$1$EXT")" + exe="$(find "${3:-dist-newstyle}" -type f -name "$1$EXT | sort -g | tail -1")" name="$(basename "$exe")" echo "Copying $name to $2" mkdir -p "$2" From 7a9a286148d6b9e7c2a8b69717d1097de9c069a6 Mon Sep 17 00:00:00 2001 From: Aaron Tomb Date: Thu, 17 Dec 2020 08:51:47 -0800 Subject: [PATCH 3/6] Trigger Docker builds properly Allow the version tag that triggers the build to have either two components or three (rather than always three). --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cd661b553e..577d394b75 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,7 +1,7 @@ name: Docker on: push: - tags: ["v?[0-9]+.[0-9]+.[0-9]+"] + tags: ["v?[0-9]+.[0-9]+.([0-9]+)?"] jobs: saw: From cbd179cfc4b2f243d5a74119821eb3574d9fb6c0 Mon Sep 17 00:00:00 2001 From: Aaron Tomb Date: Thu, 17 Dec 2020 09:42:03 -0800 Subject: [PATCH 4/6] Fix typo --- .github/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ci.sh b/.github/ci.sh index d0ee592859..07b47c789c 100755 --- a/.github/ci.sh +++ b/.github/ci.sh @@ -10,7 +10,7 @@ mkdir -p "$BIN" is_exe() { [[ -x "$1/$2$EXT" ]] || command -v "$2" > /dev/null 2>&1; } extract_exe() { - exe="$(find "${3:-dist-newstyle}" -type f -name "$1$EXT | sort -g | tail -1")" + exe="$(find "${3:-dist-newstyle}" -type f -name "$1$EXT" | sort -g | tail -1)" name="$(basename "$exe")" echo "Copying $name to $2" mkdir -p "$2" From 2321273730dd12c288e2127d8921e6a3f4e1e990 Mon Sep 17 00:00:00 2001 From: Aaron Tomb Date: Thu, 17 Dec 2020 12:38:42 -0800 Subject: [PATCH 5/6] Fix remote-api Docker build --- .github/workflows/docker.yml | 1 + .github/workflows/nightly.yml | 1 + Dockerfile-remote-api | 72 +++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 Dockerfile-remote-api diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 577d394b75..c6b86a1f55 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -38,5 +38,6 @@ jobs: password: ${{ secrets.GITHUBSAW }} repository: galoisinc/saw-remote-api tags: "latest,${{ steps.outputs.outputs.saw-version }}" + file: Dockerfile-remote-api add_git_labels: true push: true diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 638f4bc260..6a1aab513b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -54,6 +54,7 @@ jobs: password: ${{ secrets.GITHUBSAW }} repository: galoisinc/saw-remote-api tags: "nightly" + file: Dockerfile-remote-api add_git_labels: true push: ${{ github.event_name == 'schedule' }} diff --git a/Dockerfile-remote-api b/Dockerfile-remote-api new file mode 100644 index 0000000000..3e4973db95 --- /dev/null +++ b/Dockerfile-remote-api @@ -0,0 +1,72 @@ +FROM debian:buster AS solvers + +# Install needed packages for building +RUN apt-get update \ + && apt-get install -y curl cmake gcc g++ git libreadline-dev unzip +RUN useradd -m user +RUN install -d -o user -g user /solvers +USER user +WORKDIR /solvers +RUN mkdir -p rootfs/usr/local/bin + +# Get Z3 4.8.8 from GitHub +RUN curl -L https://github.com/Z3Prover/z3/releases/download/z3-4.8.8/z3-4.8.8-x64-ubuntu-16.04.zip --output z3.zip +RUN unzip z3.zip +RUN mv z3-*/bin/z3 rootfs/usr/local/bin + +# Build abc from GitHub. (Latest version.) +RUN git clone https://github.com/berkeley-abc/abc.git +RUN cd abc && make -j$(nproc) +RUN cp abc/abc rootfs/usr/local/bin + +# Build Boolector release 3.2.1 from source +RUN curl -L https://github.com/Boolector/boolector/archive/3.2.1.tar.gz | tar xz +RUN cd boolector* && ./contrib/setup-lingeling.sh && ./contrib/setup-btor2tools.sh && ./configure.sh && cd build && make -j$(nproc) +RUN cp boolector*/build/bin/boolector rootfs/usr/local/bin + +# Install Yices 2.6.2 +RUN curl -L https://yices.csl.sri.com/releases/2.6.2/yices-2.6.2-x86_64-pc-linux-gnu-static-gmp.tar.gz | tar xz +RUN cp yices*/bin/yices-smt2 rootfs/usr/local/bin \ + && cp yices*/bin/yices rootfs/usr/local/bin + +# Install CVC4 1.8 +RUN curl -L https://github.com/CVC4/CVC4/releases/download/1.8/cvc4-1.8-x86_64-linux-opt --output rootfs/usr/local/bin/cvc4 + +# Install MathSAT 5.6.3 - Uncomment if you are in compliance with MathSAT's license. +# RUN curl -L https://mathsat.fbk.eu/download.php?file=mathsat-5.6.3-linux-x86_64.tar.gz | tar xz +# RUN cp mathsat-5.6.3-linux-x86_64/bin/mathsat rootfs/usr/local/bin + +# Set executable and run tests +RUN chmod +x rootfs/usr/local/bin/* + +FROM haskell:8.8.4 AS build +USER root +RUN apt-get update && apt-get install -y wget libncurses-dev unzip +COPY --from=solvers /solvers/rootfs / +RUN useradd -m saw +COPY --chown=saw:saw . /home/saw +USER saw +WORKDIR /home/saw +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 +COPY cabal.GHC-8.8.4.config cabal.project.freeze +RUN cabal v2-update +RUN cabal v2-build saw-remote-api +RUN mkdir -p /home/saw/rootfs/usr/local/bin +RUN cp $(cabal v2-exec which saw-remote-api) /home/saw/rootfs/usr/local/bin/saw-remote-api +WORKDIR /home/saw +USER root +RUN chown -R root:root /home/saw/rootfs + +FROM debian:buster-slim +RUN apt-get update \ + && apt-get install -y libgmp10 libgomp1 libffi6 wget libncurses5 unzip +COPY --from=build /home/saw/rootfs / +COPY --from=solvers /solvers/rootfs / +RUN useradd -m saw && chown -R saw:saw /home/saw +USER saw +ENV LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 +ENTRYPOINT ["/usr/local/bin/saw-remote-api"] +CMD ["http", "--host", "0.0.0.0", "--port", "8080", "/"] +EXPOSE 8080 From d018faef934fa85a1d7acea680e6998343f3990b Mon Sep 17 00:00:00 2001 From: Aaron Tomb Date: Thu, 17 Dec 2020 12:43:06 -0800 Subject: [PATCH 6/6] Allow manual triggers of versioned Docker builds --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c6b86a1f55..57f5cc3680 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,6 +2,7 @@ name: Docker on: push: tags: ["v?[0-9]+.[0-9]+.([0-9]+)?"] + workflow_dispatch: jobs: saw: