From 1c38465ca8f6c96e69c76c07d4186a501591de19 Mon Sep 17 00:00:00 2001 From: Jared Weakly Date: Thu, 14 May 2020 10:50:22 -0700 Subject: [PATCH] Implement GitHub actions (#722) * Builds nightly binary tarballs on Linux, macOS, and Windows * Runs tests on every PR and merge to master * Includes GitHub Actions status in README instead of Travis * Makes the GitRev recompile hack less fragile * Makes the Makefile Cabal v3 compatible * Builds the manual as part of the CI process --- .github/ci.sh | 147 ++++++++++++++ .github/pr-labeler.yml | 5 + .github/release-drafter.yml | 32 +++ .github/wix.ps1 | 4 + .github/workflows/build.yml | 219 +++++++++++++++++++++ .github/workflows/docker.yml | 28 +++ .github/workflows/nightly.yml | 60 ++++++ .github/workflows/pr-labeler.yml | 12 ++ .github/workflows/remove-old-artifacts.yml | 18 ++ .gitignore | 2 + Dockerfile | 7 +- README.md | 4 +- cabal.GHC-8.4.4.config | 6 - cabal.GHC-8.6.5.config | 6 - cabal.GHC-8.8.3.config | 6 - cry | 75 +++---- 16 files changed, 557 insertions(+), 74 deletions(-) create mode 100755 .github/ci.sh create mode 100644 .github/pr-labeler.yml create mode 100644 .github/release-drafter.yml create mode 100644 .github/wix.ps1 create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/pr-labeler.yml create mode 100644 .github/workflows/remove-old-artifacts.yml diff --git a/.github/ci.sh b/.github/ci.sh new file mode 100755 index 00000000..a5bb31a2 --- /dev/null +++ b/.github/ci.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +[[ "$RUNNER_OS" == 'Windows' ]] && IS_WIN=true || IS_WIN=false +BIN=bin +EXT="" +$IS_WIN && EXT=".exe" +mkdir -p "$BIN" + +is_exe() { [[ -x "$1/$2$EXT" ]] || command -v "$2" > /dev/null 2>&1; } + +extract_exe() { + exe="$(cabal v2-exec which "$1$EXT")" + name="$(basename "$exe")" + echo "Copying $name to $2" + mkdir -p "$2" + cp -f "$exe" "$2/$name" + $IS_WIN || chmod +x "$2/$name" +} + +setup_external_tools() { + is_exe "$BIN" "test-runner" && return + cabal v2-install --install-method=copy --installdir="$BIN" test-lib +} + +setup_dist_bins() { + is_exe "dist" "cryptol" && is_exe "dist" "cryptol-html" && return + extract_exe "cryptol" "dist" + extract_exe "cryptol-html" "dist" + strip dist/cryptol* +} + +install_z3() { + is_exe "$BIN" "z3" && return + + case "$RUNNER_OS" in + Linux) file="ubuntu-16.04.zip" ;; + macOS) file="osx-10.14.6.zip" ;; + Windows) file="win.zip" ;; + esac + curl -o z3.zip -sL "https://github.com/Z3Prover/z3/releases/download/z3-$Z3_VERSION/z3-$Z3_VERSION-x64-$file" + + if $IS_WIN; then 7z x -bd z3.zip; else unzip z3.zip; fi + cp z3-*/bin/z3$EXT $BIN/z3$EXT + $IS_WIN || chmod +x $BIN/z3 + rm z3.zip +} + +install_cvc4() { + is_exe "$BIN" "cvc4" && return + version="${CVC4_VERSION#4.}" # 4.y.z -> y.z + + case "$RUNNER_OS" in + Linux) file="x86_64-linux-opt" ;; + Windows) file="win64-opt.exe" ;; + # macOS) brew tap cvc4/cvc4 && brew install cvc4/cvc4/cvc4 && return ;; + macOS) return ;; # the brew tap takes 15 minutes to install + esac + curl -o cvc4$EXT -sL "https://github.com/CVC4/CVC4/releases/download/1.7/cvc4-$version-$file" + $IS_WIN || chmod +x cvc4$EXT + mv cvc4$EXT "$BIN/cvc4$EXT" +} + +install_yices() { + is_exe "$BIN" "yices" && return + ext=".tar.gz" + case "$RUNNER_OS" in + Linux) file="pc-linux-gnu-static-gmp.tar.gz" ;; + macOS) file="apple-darwin18.7.0-static-gmp.tar.gz" ;; + Windows) file="pc-mingw32-static-gmp.zip" && ext=".zip" ;; + esac + curl -o "yices$ext" -sL "https://yices.csl.sri.com/releases/$YICES_VERSION/yices-$YICES_VERSION-x86_64-$file" + + if $IS_WIN; then + 7z x -bd "yices$ext" + mv "yices-$YICES_VERSION"/bin/*.exe "$BIN" + else + tar -xzf "yices$ext" + pushd "yices-$YICES_VERSION" || exit + sudo ./install-yices + popd || exit + fi + rm -rf "yices$ext" "yices-$YICES_VERSION" +} + +install_deps() { + ghc_ver="$(ghc --numeric-version)" + cp cabal.GHC-"$ghc_ver".config cabal.project.freeze + # Limit jobs on windows due to: https://gitlab.haskell.org/ghc/ghc/issues/17926 + if [[ "$ghc_ver" == "8.8.3" && "$RUNNER_OS" == 'Windows' ]]; then JOBS=1; else JOBS=2; fi + cabal v2-configure -j$JOBS --minimize-conflict-set + cabal v2-build --only-dependencies exe:cryptol exe:cryptol-html + setup_external_tools +} + +install_system_deps() { + install_z3 & + install_cvc4 & + install_yices & + wait + export PATH=$PWD/$BIN:$PATH + echo "::add-path::$PWD/$BIN" + # is_exe "$BIN" z3 && is_exe "$BIN" cvc4 && is_exe "$BIN" yices + is_exe "$BIN" z3 && is_exe "$BIN" yices +} + +test_dist() { + setup_dist_bins + $BIN/test-runner --ext=.icry -F -b --exe=dist/cryptol tests +} + +bundle_files() { + doc=dist/share/doc/cryptol + mkdir -p $doc + cp -R examples/ $doc/examples/ + cp docs/*md docs/*pdf $doc + + # Copy the two interesting examples over + cp docs/ProgrammingCryptol/{aes/AES,enigma/Enigma}.cry $doc/examples/ + $IS_WIN || chmod +x dist/bin/* +} + +sign() { + gpg --batch --import <(echo "$SIGNING_KEY") + fingerprint="$(gpg --list-keys | grep galois -a1 | head -n1 | awk '{$1=$1};1')" + echo "$fingerprint:6" | gpg --import-ownertrust + gpg --yes --no-tty --batch --pinentry-mode loopback --default-key "$fingerprint" --detach-sign -o "$1".sig --passphrase-file <(echo "$SIGNING_PASSPHRASE") "$1" +} + +zip_dist() { + : "${VERSION?VERSION is required as an environment variable}" + name="cryptol-$VERSION-$RUNNER_OS-x86_64" + mv dist "$name" + if [[ "$RUNNER_OS" == Windows ]]; then 7z a -tzip -mx9 "$name".zip "$name"; else zip -r "$name".zip "$name"; fi + sign "$name".zip + [[ -f "$name".zip.sig ]] && [[ -f "$name".zip ]] +} + +set_outputs() { + echo "::set-output name=changed-files::$(git diff-tree --no-commit-id --name-only -r "$1" | xargs)" + echo "::set-output name=cryptol-version::$(grep Version cryptol.cabal | awk '{print $2}')" +} + +COMMAND="$1" +shift + +"$COMMAND" "$@" diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 00000000..06f7cdab --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,5 @@ +feature: ["feature/*", "feat/*"] +enhancement: ["enhancement/*"] +fix: ["fix/*", "bugfix/*", "bug/*"] +breaking: ["breaking/*"] +solver: ["solver/*", "*z3*", "*cvc4*", "*yices*"] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..bdc2fe6c --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,32 @@ +name-template: "v$NEXT_PATCH_VERSION" +tag-template: "v$NEXT_PATCH_VERSION" +categories: + - title: "New Features" + labels: + - "feature" + - "enhancement" + - title: "Breaking Changes" + labels: + - "breaking" + - title: "Bug Fixes" + labels: + - "fix" + - "bugfix" + - "bug" + - title: "Solver Versions" + labels: + - "solver" +change-template: "- $TITLE @$AUTHOR (PR #$NUMBER)" + +replacers: + - search: '/Z3 (\d+)\.(\d+)\.(\d+)/ig' + replace: "[Z3 $1.$2.$3](https://github.com/Z3Prover/z3/releases/tag/z3-$1.$2.$3)" + - search: '/yices (\d+)\.(\d+)\.(\d+)/ig' + replace: "[Yices $1.$2.$3](https://yices.csl.sri.com/release-notes.html)" + - search: '/cvc(4?) (\d+)\.(\d+)\.(\d+)/ig' + replace: "[CVC4 $3.$4](https://github.com/CVC4/CVC4/releases/tag/$3.$4)" + +template: | + ## Cryptol $NEXT_PATCH_VERSION + + $CHANGES diff --git a/.github/wix.ps1 b/.github/wix.ps1 new file mode 100644 index 00000000..9636f3e7 --- /dev/null +++ b/.github/wix.ps1 @@ -0,0 +1,4 @@ +& "$env:WIX\bin\heat.exe" dir "$pwd" -o allfiles.wxs -nologo -var var.pkg -ag -wixvar -cg ALLFILES -srd -dr INSTALLDIR -sfrag +& "$env:WIX\bin\candle.exe" -ext WixUIExtension -ext WixUtilExtension -dversion="$env:VERSION" -dpkg="$pwd" win32\cryptol.wxs +& "$env:WIX\bin\candle.exe" -ext WixUIExtension -ext WixUtilExtension -dversion="$env:VERSION" -dpkg="$pwd" allfiles.wxs +& "$env:WIX\bin\light.exe" -ext WixUIExtension -ext WixUtilExtension -sval -o cryptol.msi cryptol.wixobj allfiles.wixobj diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..92f04807 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,219 @@ +name: Cryptol +on: + push: + branches: [master] + pull_request: + +jobs: + outputs: + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.outputs.outputs.changed-files }} + cryptol-version: ${{ steps.outputs.outputs.cryptol-version }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - id: outputs + run: .github/ci.sh set_outputs ${{ github.sha }} + + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + ghc: ["8.4.4", "8.6.5", "8.8.3"] + name: Cryptol - GHC v${{ matrix.ghc }} - ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: actions/setup-haskell@v1.1 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + + - uses: actions/cache@v1 + name: Cache cabal store + with: + path: ${{ steps.setup-haskell.outputs.cabal-store }} + # https://github.com/actions/cache/issues/109 "Enable always writing cache to support hermetic build systems" + # https://github.com/actions/cache/issues/239#issuecomment-606950711 Investigate this workaround if cache starts filling up + key: store-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }} + restore-keys: | + store-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}- + store-${{ runner.os }}-${{ matrix.ghc }}- + store-${{ runner.os }}- + + - uses: actions/cache@v1 + name: Cache dist-newstyle + with: + path: dist-newstyle + key: dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}-${{ github.sha }} + restore-keys: | + dist-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('**/cabal.GHC-*') }}- + dist-${{ runner.os }}-${{ matrix.ghc }}- + + - shell: bash + run: .github/ci.sh install_system_deps + env: + Z3_VERSION: "4.8.7" + CVC4_VERSION: "4.1.7" + YICES_VERSION: "2.6.2" + + - shell: bash + run: .github/ci.sh install_deps + + - shell: bash + run: cabal v2-build exe:cryptol exe:cryptol-html + + - shell: bash + run: .github/ci.sh test_dist + + - if: "startsWith(github.ref, 'refs/tags/v') && matrix.ghc == '8.8.3'" + uses: actions/upload-artifact@v2 + with: + path: dist + name: ${{ runner.os }}-bins + + docs: + runs-on: ubuntu-latest + needs: [outputs] + if: "startsWith(github.ref, 'refs/tags/v') || contains(needs.outputs.outputs.changed, 'docs/')" + steps: + - uses: actions/checkout@v2 + - uses: docker://pandoc/latex:latest + with: + args: >- + sh -c + " + apk add make && + tlmgr install subfigure lastpage preprint adjustbox nag collectbox sectsty todonotes palatino mathpazo && + cd docs && + make + " + - uses: actions/upload-artifact@v2 + with: + path: docs + name: docs + + bundle: + runs-on: ${{ matrix.os }} + if: startsWith(github.ref, 'refs/tags/v') + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + ghc: ["8.8.3"] + needs: [outputs, docs, build] + env: + VERSION: ${{ needs.outputs.outputs.cryptol-version }} + steps: + - uses: actions/checkout@v2 + + - uses: actions/download-artifact@v2 + with: + path: dist/bin + name: ${{ runner.os }}-bins + + - uses: actions/download-artifact@v2 + with: + path: docs + name: docs + + - shell: bash + run: .github/ci.sh bundle_files + + - if: runner.os == 'Windows' + run: .github/wix.ps1 + + - if: runner.os == 'Windows' + shell: bash + env: + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + run: .github/ci.sh sign cryptol.msi + + - shell: bash + env: + SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + run: .github/ci.sh zip_dist + + - uses: actions/upload-artifact@v2 + with: + name: cryptol-${{ env.VERSION }}-${{ runner.os }}-x86_64 + path: "cryptol-${{ env.VERSION }}-${{ runner.os }}-x86_64.zip*" + + - uses: actions/upload-artifact@v2 + if: runner.os == 'Windows' + with: + name: cryptol-${{ env.VERSION }}-${{ runner.os }}-x86_64.msi + path: "cryptol.msi*" + + release: + if: "github.event_name == 'push' && github.ref == 'refs/heads/master'" + outputs: + upload_url: ${{ steps.release.outputs.upload_url }} + + runs-on: ubuntu-latest + steps: + - id: release + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + upload-artifacts-to-release: + if: "github.event_name == 'push' && github.ref == 'refs/heads/master'" + strategy: + matrix: + os: [Linux, Windows, macOS] + needs: [outputs, bundle, release] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + with: + name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64 + + - if: runner.os == 'Windows' + uses: actions/download-artifact@v2 + with: + name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi + + - uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.zip + asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.zip + asset_content_type: application/zip + + - uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.zip.sig + asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.zip.sig + asset_content_type: application/pgp-signature + + - if: runner.os == 'Windows' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi + asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi + asset_content_type: application/x-msi + + - if: runner.os == 'Windows' + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ./cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi.sig + asset_name: cryptol-${{ needs.outputs.outputs.cryptol-version }}-${{ runner.os }}-x86_64.msi.sig + asset_content_type: application/pgp-signature diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..de8b396e --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,28 @@ +name: Cryptol Dockerfile +on: + schedule: + - cron: "0 0 * * *" + +jobs: + build: + runs-on: ubuntu-latest + name: Cryptol Docker + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - id: outputs + run: | + changed_since="$(git log --since '23 hours 59 minutes')" + files="${changed_since:+"$(git diff-tree --no-commit-id --name-only -r '${{ github.sha }}' | xargs)"}" + echo "::set-output name=files::$files" + echo "::set-output name=version::$(grep Version cryptol.cabal | awk '{print $2}')" + + - name: Publish to Registry + if: ${{ steps.outputs.outputs.files }} + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: galoisinc/cryptol + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + tags: "latest,${{ steps.outputs.outputs.version }}" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..2fd65442 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,60 @@ +name: Cryptol Nightly Builds +on: + schedule: + - cron: "0 0 * * *" + +jobs: + outputs: + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.get-changed.outputs.changed-files }} + cryptol-version: ${{ steps.cryptol-version.outputs.cryptol-version }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - id: get-changed + run: | + changed_since="$(git log --since '23 hours 59 minutes')" + files="${changed_since:+"$(git diff-tree --no-commit-id --name-only -r '${{ github.sha }}' | xargs)"}" + echo "::set-output name=changed-files::$files" + - id: cryptol-version + run: echo "::set-output name=cryptol-version::$(grep Version cryptol.cabal | awk '{print $2}')" + + build: + needs: [outputs] + if: ${{ needs.outputs.outputs.changed }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - uses: actions/setup-haskell@v1.1 + with: + ghc-version: "8.8" + + - shell: bash + run: cabal v2-build exe:cryptol exe:cryptol-html + + - shell: bash + run: .github/ci.sh setup_dist_bins + + - if: runner.os == 'Windows' + env: + VERSION: ${{ needs.outputs.outputs.cryptol-version }} + run: .github/wix.ps1 + + - uses: actions/upload-artifact@v2 + with: + path: dist + name: ${{ runner.os }}-bins + + - uses: actions/upload-artifact@v2 + if: runner.os == 'Windows' + with: + path: cryptol.msi + name: cryptol.msi diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml new file mode 100644 index 00000000..71267c6f --- /dev/null +++ b/.github/workflows/pr-labeler.yml @@ -0,0 +1,12 @@ +name: PR Labeler +on: + pull_request: + types: [opened] + +jobs: + pr-labeler: + runs-on: ubuntu-latest + steps: + - uses: TimonVS/pr-labeler-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/remove-old-artifacts.yml b/.github/workflows/remove-old-artifacts.yml new file mode 100644 index 00000000..e11cf2ad --- /dev/null +++ b/.github/workflows/remove-old-artifacts.yml @@ -0,0 +1,18 @@ +# https://github.com/actions/upload-artifact/issues/5 + +name: Remove old artifacts +on: + schedule: + - cron: "0 1 * * *" + +jobs: + remove-old-artifacts: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Remove old artifacts + uses: c-hive/gha-remove-artifacts@v1 + with: + age: "1 week" + skip-tags: true diff --git a/.gitignore b/.gitignore index 88d4074a..a73fa768 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ results.xml dist-newstyle .stack-work .ghc.environment.* +cabal.project.freeze +cabal.project.local* # don't check in generated documentation #docs/CryptolPrims.pdf diff --git a/Dockerfile b/Dockerfile index de34d200..381fe858 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,9 +15,9 @@ ARG DIFF="diff" ARG IGNORE_EXPECTED="--ignore-expected" ARG CABAL_BUILD_FLAGS="-j" ARG CABAL_INSTALL_FLAGS="${CABAL_BUILD_FLAGS}" -RUN make tarball +RUN ./cry build ARG TIME="" -RUN make test +RUN ./cry test RUN mkdir -p rootfs/"${CRYPTOLPATH}" \ && cp -r lib/* rootfs/"${CRYPTOLPATH}" \ && mkdir -p rootfs/usr/local \ @@ -29,7 +29,8 @@ RUN chown -R root:root /cryptol/rootfs FROM debian:stretch-slim RUN apt-get update \ - && apt-get install -y libgmp10 libgomp1 libffi6 wget libncurses5 unzip + && apt-get install -y libgmp10 libgomp1 libffi6 wget libncurses5 unzip \ + && apt-get clean && rm -rf /var/lib/apt/lists/* COPY --from=build /cryptol/rootfs / RUN useradd -m cryptol && chown -R cryptol:cryptol /home/cryptol USER cryptol diff --git a/README.md b/README.md index b1c97bc3..306774e2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![Build -Status](https://travis-ci.org/GaloisInc/cryptol.svg?branch=master)](https://travis-ci.org/GaloisInc/cryptol) +![Build +Status](https://github.com/GaloisInc/cryptol/workflows/Cryptol/badge.svg) # Cryptol, version 2 diff --git a/cabal.GHC-8.4.4.config b/cabal.GHC-8.4.4.config index 475dfa21..606f3c4c 100644 --- a/cabal.GHC-8.4.4.config +++ b/cabal.GHC-8.4.4.config @@ -133,7 +133,6 @@ constraints: any.Cabal ==2.2.0.1, any.monadLib ==3.10, any.mtl ==2.2.2, any.mwc-random ==0.14.0.0, - any.network ==3.1.1.1, any.old-locale ==1.0.0.7, any.optparse-applicative ==0.15.1.0, any.panic ==0.4.0.1, @@ -153,7 +152,6 @@ constraints: any.Cabal ==2.2.0.1, reflection -slow +template-haskell, any.regex-base ==0.94.0.0, any.regex-posix ==0.96.0.0, - regex-posix -_regex-posix-clib, any.resourcet ==1.2.4, any.rts ==1.0, any.sbv ==8.6, @@ -182,14 +180,11 @@ constraints: any.Cabal ==2.2.0.1, any.template-haskell ==2.13.0.0, any.temporary ==1.3, any.terminal-size ==0.3.2.1, - any.terminfo ==0.4.1.1, any.test-framework ==0.8.2.0, any.test-framework-hunit ==0.3.0.2, test-framework-hunit -base3 +base4, any.test-lib ==0.2.1, any.text ==1.2.3.1, - any.text-short ==0.1.3, - text-short -asserts, any.tf-random ==0.5, any.th-abstraction ==0.3.2.0, any.time ==1.8.0.2, @@ -202,7 +197,6 @@ constraints: any.Cabal ==2.2.0.1, transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, any.type-equality ==1, any.unbounded-delays ==0.1.1.0, - any.unix ==2.7.2.2, any.unliftio-core ==0.2.0.1, any.unordered-containers ==0.2.10.0, unordered-containers -debug, diff --git a/cabal.GHC-8.6.5.config b/cabal.GHC-8.6.5.config index dbe6cbbd..1ae7275e 100644 --- a/cabal.GHC-8.6.5.config +++ b/cabal.GHC-8.6.5.config @@ -134,7 +134,6 @@ constraints: any.Cabal ==2.4.0.1, any.monadLib ==3.10, any.mtl ==2.2.2, any.mwc-random ==0.14.0.0, - any.network ==3.1.1.1, any.old-locale ==1.0.0.7, any.optparse-applicative ==0.15.1.0, any.panic ==0.4.0.1, @@ -154,7 +153,6 @@ constraints: any.Cabal ==2.4.0.1, reflection -slow +template-haskell, any.regex-base ==0.94.0.0, any.regex-posix ==0.96.0.0, - regex-posix -_regex-posix-clib, any.resourcet ==1.2.4, any.rts ==1.0, any.sbv ==8.6, @@ -183,14 +181,11 @@ constraints: any.Cabal ==2.4.0.1, any.template-haskell ==2.14.0.0, any.temporary ==1.3, any.terminal-size ==0.3.2.1, - any.terminfo ==0.4.1.2, any.test-framework ==0.8.2.0, any.test-framework-hunit ==0.3.0.2, test-framework-hunit -base3 +base4, any.test-lib ==0.2.1, any.text ==1.2.3.1, - any.text-short ==0.1.3, - text-short -asserts, any.tf-random ==0.5, any.th-abstraction ==0.3.2.0, any.time ==1.8.0.2, @@ -203,7 +198,6 @@ constraints: any.Cabal ==2.4.0.1, transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, any.type-equality ==1, any.unbounded-delays ==0.1.1.0, - any.unix ==2.7.2.2, any.unliftio-core ==0.2.0.1, any.unordered-containers ==0.2.10.0, unordered-containers -debug, diff --git a/cabal.GHC-8.8.3.config b/cabal.GHC-8.8.3.config index da2db398..9feaa40b 100644 --- a/cabal.GHC-8.8.3.config +++ b/cabal.GHC-8.8.3.config @@ -134,7 +134,6 @@ constraints: any.Cabal ==3.0.1.0, any.monadLib ==3.10, any.mtl ==2.2.2, any.mwc-random ==0.14.0.0, - any.network ==3.1.1.1, any.old-locale ==1.0.0.7, any.optparse-applicative ==0.15.1.0, any.panic ==0.4.0.1, @@ -154,7 +153,6 @@ constraints: any.Cabal ==3.0.1.0, reflection -slow +template-haskell, any.regex-base ==0.94.0.0, any.regex-posix ==0.96.0.0, - regex-posix -_regex-posix-clib, any.resourcet ==1.2.4, any.rts ==1.0, any.sbv ==8.6, @@ -183,14 +181,11 @@ constraints: any.Cabal ==3.0.1.0, any.template-haskell ==2.15.0.0, any.temporary ==1.3, any.terminal-size ==0.3.2.1, - any.terminfo ==0.4.1.4, any.test-framework ==0.8.2.0, any.test-framework-hunit ==0.3.0.2, test-framework-hunit -base3 +base4, any.test-lib ==0.2.1, any.text ==1.2.4.0, - any.text-short ==0.1.3, - text-short -asserts, any.tf-random ==0.5, any.th-abstraction ==0.3.2.0, any.time ==1.9.3, @@ -203,7 +198,6 @@ constraints: any.Cabal ==3.0.1.0, transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, any.type-equality ==1, any.unbounded-delays ==0.1.1.0, - any.unix ==2.7.2.2, any.unliftio-core ==0.2.0.1, any.unordered-containers ==0.2.10.0, unordered-containers -debug, diff --git a/cry b/cry index 6db9f532..9bad94d7 100755 --- a/cry +++ b/cry @@ -1,32 +1,25 @@ -#!/bin/bash +#!/usr/bin/env bash BIN=bin -function setup_external_tools { - if [ ! -f "$BIN/test-runner" ] - then - mkdir -p "$BIN" - cabal v2-install --installdir="$BIN" test-lib - fi +function setup_external_tools() { + [[ -x "$BIN/test-runner" || -x "$BIN/test-runner.exe" ]] && return + cabal v2-install --install-method=copy --installdir="$BIN" test-lib } -function show_usage { -cat <> src/GitRev.hs + dirty_string="-- Last build $(date)" + echo "$dirty_string" >> src/GitRev.hs cabal v2-build exe:cryptol - # WARNING!!!: this is here to undo the HACK date stamp, and will - # undo any changes to this file, so comment it out if you'd like - # to change the file - git checkout src/GitRev.hs + sed -i "/^$dirty_string/d" src/GitRev.hs ;; - haddock) - echo Building Haddock documentation - cabal v2-haddock;; - + haddock) echo Building Haddock documentation && cabal v2-haddock ;; test) echo Running tests setup_external_tools - if [ "$#" == "0" ] - then TESTS=tests - else TESTS=$* - fi + if [ "$#" == "0" ]; then TESTS=tests; else TESTS=$*; fi $BIN/test-runner --ext=.icry \ - --exe=cabal \ - -F v2-run -F -v0 -F exe:cryptol -F -- -F -b \ - $TESTS + --exe=cabal \ + -F v2-run -F -v0 -F exe:cryptol -F -- -F -b \ + $TESTS ;; - help) - show_usage - exit 0;; + help) show_usage && exit 0 ;; - exe-path) - cabal exec which cryptol - exit 0;; - - *) - echo Unrecognized command: $COMMAND - show_usage - exit 1;; + exe-path) cabal v2-exec which cryptol ;; + *) echo "Unrecognized command: $COMMAND" && show_usage && exit 1 ;; esac - - -