Updating version of environment dependency in circle.yml

Building my GitHub project requires Z3 (GitHub - Z3Prover/z3: The Z3 Theorem Prover) in the path. I was using z3 v. 4.8.8 until recently. Now I changed my circle.yml to install z3 v. 4.8.15. However, I can see in the logs that it still uses the old version. How do I update z3 for Circle CI builds?

This is my current circle.yml (the printed version of Z3 is 4.8.8):

version: 2.1
jobs:
  build:
    docker:
      - image: fpco/stack-build:lts
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD 
    
    steps:
      - run: sudo apt-key del 7fa2af80 && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub
      - run: apt-get update && apt-get install -y git ssh unzip
      - checkout
      - add_ssh_keys

      - restore_cache:
          key: z3-4.8.15-cache
            
      - run: 
          name: Install z3 
          command: |
            if ! z3 --version 
            then 
              wget https://github.com/Z3Prover/z3/archive/refs/tags/z3-4.8.15.tar.gz
              tar -xvzf z3-4.8.15.tar.gz
              mkdir z3-z3-4.8.15/build
              cd z3-z3-4.8.15/build && cmake -G "Unix Makefiles" ../
              cd z3-z3-4.8.15/build && make -j4
              z3 --version
            fi

      - save_cache:
          key: z3-4.8.15-cache
          paths:
            - .
      
      - run:
          name: Test Examples 
          command: stack setup && stack build && stack test

The old circle.yml:

version: 2.1
jobs:
  build:
    docker:
      - image: fpco/stack-build:lts
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD 

    steps:
      - run: sudo apt-key del 7fa2af80 && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub
      - run: apt-get update && apt-get install -y git ssh unzip

      - run: 
          name: Install z3 
          command: |
            wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.8/z3-4.8.8-x64-ubuntu-16.04.zip
            unzip z3-4.8.8-x64-ubuntu-16.04.zip
            rm -f z3-4.8.8-x64-ubuntu-16.04.zip
            cp z3-4.8.8-x64-ubuntu-16.04/bin/libz3.a /usr/local/lib
            cp z3-4.8.8-x64-ubuntu-16.04/bin/z3 /usr/local/bin
            cp z3-4.8.8-x64-ubuntu-16.04/include/* /usr/local/include
            rm -rf z3-4.8.8-x64-ubuntu-16.04
            z3 --version
      - checkout
      - add_ssh_keys
      - run:
          name: Test Examples 
          command: stack setup && stack build && stack test

Hello

I have been looking into this for you and the version being installed is the latest version from Ubuntu and I believe the if ! z3 --version is being checked and it’s already installed causing the current version to be output.

Below is the code I used to install version 4.8.15.0 which works but you will need to add a && apt-get install -y python-pip as it uses the .whl version of the file.

      - run: 
          name: Install z3 
          command: |
            wget https://github.com/Z3Prover/z3/releases/download/z3-4.8.15/z3_solver-4.8.15.0-py2.py3-none-manylinux1_x86_64.whl
            pip install ./z3_solver-4.8.15.0-py2.py3-none-manylinux1_x86_64.whl
            z3 --version

Kind Regards
Owen Oliver