From 287a7f0f714c86197c064d62f3e645839fe3e7de Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Sat, 13 Aug 2022 07:36:50 -0400 Subject: [PATCH] CI: Use Ubuntu 22.04, drop 18.04 GitHub Actions has deprecated its Ubuntu 18.04 runners, and they will be removed by December 1, 2022. Moreover, GitHub Actions now offers Ubuntu 22.04 runners. It seems like a good time to upgrade our CI accordingly. Somewhat annoyingly, the `haskell` Docker images that we use in our Dockerfiles use such an old version of Debian that their version of `glibc` is incompatible with any of the `what4-solvers` built for Ubuntu 20.04 or 22.04. As a result, I switched them from the `haskell` Docker image to the `ubuntu` one. This required some minor tweaks to how dependencies are installed, but nothing too serious. --- .github/workflows/ci.yml | 14 +++++++------- Dockerfile | 27 +++++++++++++++++++++------ README.md | 4 ++-- cryptol-remote-api/Dockerfile | 21 ++++++++++++++------- 4 files changed, 44 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c99f63cf..2e1726cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: env: - SOLVER_PKG_VERSION: "snapshot-20220721" + SOLVER_PKG_VERSION: "snapshot-20220812" # The CACHE_VERSION can be updated to force the use of a new cache if # the current cache contents become corrupted/invalid. This can # sometimes happen when (for example) the OS version is changed but @@ -20,7 +20,7 @@ env: jobs: config: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: name: ${{ steps.config.outputs.name }} version: ${{ steps.config.outputs.version }} @@ -58,7 +58,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, macos-12, windows-2019] + os: [ubuntu-22.04, macos-12, windows-2019] ghc-version: ["8.8.4", "8.10.7", "9.0.2", "9.2.2"] exclude: # https://gitlab.haskell.org/ghc/ghc/-/issues/18550 @@ -71,7 +71,7 @@ jobs: include: # We include one job from an older Ubuntu LTS release to increase our # coverage of possible Linux configurations. - - os: ubuntu-18.04 + - os: ubuntu-22.04 ghc-version: 8.8.4 outputs: test-lib-json: ${{ steps.test-lib.outputs.targets-json }} @@ -231,12 +231,12 @@ jobs: matrix: suite: [test-lib] target: ${{ fromJson(needs.build.outputs.test-lib-json) }} - os: [ubuntu-20.04, macos-12, windows-2019] + os: [ubuntu-22.04, macos-12, windows-2019] continue-on-error: [false] include: - suite: rpc target: '' - os: ubuntu-20.04 + os: ubuntu-22.04 continue-on-error: false #- suite: rpc # target: '' @@ -311,7 +311,7 @@ jobs: cryptol-remote-api/run_rpc_tests.sh build-push-image: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [config] if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || needs.config.outputs.release == 'true' strategy: diff --git a/Dockerfile b/Dockerfile index 29a88679..5e0f67ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,36 @@ -FROM haskell:8.8.4 AS build +FROM ubuntu:22.04 AS build -RUN apt-get update && apt-get install -y libncurses-dev unzip +RUN apt-get update && \ + apt-get install -y \ + # ghcup requirements + build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses6 libtinfo6 \ + # Cryptol dependencies + zlib1g-dev \ + # Miscellaneous + unzip RUN useradd -m cryptol COPY --chown=cryptol:cryptol . /cryptol USER cryptol WORKDIR /cryptol RUN mkdir -p rootfs/usr/local/bin WORKDIR /cryptol/rootfs/usr/local/bin -RUN curl -o solvers.zip -sL "https://github.com/GaloisInc/what4-solvers/releases/download/snapshot-20220114/ubuntu-18.04-bin.zip" +RUN curl -o solvers.zip -sL "https://github.com/GaloisInc/what4-solvers/releases/download/snapshot-20220812/ubuntu-22.04-bin.zip" RUN unzip solvers.zip && rm solvers.zip && chmod +x * WORKDIR /cryptol -ENV PATH=/cryptol/rootfs/usr/local/bin:$PATH +ENV PATH=/cryptol/rootfs/usr/local/bin:/home/cryptol/.local/bin:/home/cryptol/.ghcup/bin:$PATH RUN z3 --version ARG CRYPTOLPATH="/cryptol/.cryptol" ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 COPY cabal.GHC-8.8.4.config cabal.project.freeze +RUN mkdir -p /home/cryptol/.local/bin && \ + curl -L https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -o /home/cryptol/.local/bin/ghcup && \ + chmod +x /home/cryptol/.local/bin/ghcup +RUN mkdir -p /home/cryptol/.ghcup && \ + ghcup --version && \ + ghcup install cabal 3.6.2.0 && \ + ghcup install ghc 8.8.4 && \ + ghcup set ghc 8.8.4 RUN cabal v2-update && \ cabal v2-build -j cryptol:exe:cryptol && \ cp $(cabal v2-exec which cryptol) rootfs/usr/local/bin && \ @@ -33,9 +48,9 @@ RUN mkdir -p rootfs/"${CRYPTOLPATH}" \ USER root RUN chown -R root:root /cryptol/rootfs -FROM debian:buster-20210511-slim +FROM ubuntu:22.04 RUN apt-get update \ - && apt-get install -y libgmp10 libgomp1 libffi6 libncurses6 libtinfo6 libreadline7 \ + && apt-get install -y libgmp10 libgomp1 libffi8 libncurses6 libtinfo6 libreadline8 \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN useradd -m cryptol && chown -R cryptol:cryptol /home/cryptol COPY --from=build /cryptol/rootfs / diff --git a/README.md b/README.md index 88f183c6..5d5647d6 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Cryptol currently uses Microsoft Research's [Z3 SMT solver](https://github.com/Z3Prover/z3) by default to solve constraints during type checking, and as the default solver for the `:sat` and `:prove` commands. Cryptol generally requires the most recent version -of Z3, but you can see the specific version tested in CI by looking [here](https://github.com/GaloisInc/what4-solvers/releases/tag/snapshot-20220721). +of Z3, but you can see the specific version tested in CI by looking [here](https://github.com/GaloisInc/what4-solvers/releases/tag/snapshot-20220812). You can download Z3 binaries for a variety of platforms from their [releases page](https://github.com/Z3Prover/z3/releases). If you @@ -75,8 +75,8 @@ Cryptol builds and runs on various flavors of Linux, Mac OS X, and Windows. We regularly build and test it in the following environments: - macOS 12, 64-bit -- Ubuntu 18.04, 64-bit - Ubuntu 20.04, 64-bit +- Ubuntu 22.04, 64-bit - Windows Server 2019, 64-bit ## Prerequisites diff --git a/cryptol-remote-api/Dockerfile b/cryptol-remote-api/Dockerfile index 225f64dd..0cb6c870 100644 --- a/cryptol-remote-api/Dockerfile +++ b/cryptol-remote-api/Dockerfile @@ -1,10 +1,17 @@ ARG GHCVER="8.10.7" ARG GHCVER_BOOTSTRAP="8.10.2" -FROM debian:buster-20210511 AS toolchain +FROM ubuntu:22.04 AS toolchain ARG PORTABILITY=false -RUN apt-get update && apt-get install -y libncurses-dev libz-dev unzip \ - build-essential curl libffi-dev libffi6 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 libnuma-dev \ - $(if ${PORTABILITY}; then echo git autoconf python3; fi) +RUN apt-get update && \ + apt-get install -y \ + # ghcup requirements + build-essential curl libffi-dev libffi8 libgmp-dev libgmp10 libncurses-dev libncurses6 libtinfo6 \ + # Cryptol dependencies + zlib1g-dev \ + # GHC build dependencies + $(if ${PORTABILITY}; then echo git autoconf python3 libnuma-dev; fi) \ + # Miscellaneous + unzip ENV GHCUP_INSTALL_BASE_PREFIX=/opt \ PATH=/opt/.ghcup/bin:$PATH RUN curl -o /usr/local/bin/ghcup "https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7" && \ @@ -57,14 +64,14 @@ ENV PATH=/usr/local/bin:/cryptol/rootfs/usr/local/bin:$PATH RUN mkdir -p rootfs/"${CRYPTOLPATH}" \ && cp -r lib/* rootfs/"${CRYPTOLPATH}" WORKDIR /cryptol/rootfs/usr/local/bin -RUN curl -sL -o solvers.zip "https://github.com/GaloisInc/what4-solvers/releases/download/snapshot-20220114/ubuntu-18.04-bin.zip" && \ +RUN curl -sL -o solvers.zip "https://github.com/GaloisInc/what4-solvers/releases/download/snapshot-20220812/ubuntu-22.04-bin.zip" && \ unzip solvers.zip && rm solvers.zip && chmod +x * USER root RUN chown -R root:root /cryptol/rootfs -FROM debian:buster-20210511-slim +FROM ubuntu:22.04 RUN apt-get update \ - && apt-get install -y libgmp10 libgomp1 libffi6 libncurses6 libtinfo6 libreadline7 libnuma-dev openssl \ + && apt-get install -y libgmp10 libgomp1 libffi8 libncurses6 libtinfo6 libreadline8 libnuma-dev openssl \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN useradd -m cryptol && chown -R cryptol:cryptol /home/cryptol COPY --from=build /cryptol/rootfs /