diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 958c1d5..2155a3a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,22 +17,13 @@ jobs: # TODO: # zk_server: ["3.4.14", "3.6.2"] # zk_client: ["3.4.14", "3.6.2"] - os: [ubuntu-latest, macOS-latest] + #os: [ubuntu-latest, macOS-latest] + os: [macOS-latest] name: ghc-${{ matrix.ghc }} cabal-${{matrix.cabal}} on ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - - uses: actions/cache@v2 - with: - path: | - ~/.cabal/packages - ~/.cabal/store - dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1- + - uses: actions/checkout@v4 # FIXME: use the same client version as the one in the matrix - name: Install zookeeper-dev on ubuntu @@ -54,23 +45,28 @@ jobs: if [ "$(uname -m)" == "arm64" ]; then sed -i'.bak' -e "s/^clientPort=2181$/clientPort=2182/g" /opt/homebrew/etc/zookeeper/zoo.cfg cat /opt/homebrew/etc/zookeeper/zoo.cfg - echo "BUILD_ARGS=--extra-include-dirs=/opt/homebrew/include --extra-lib-dirs=/opt/homebrew/lib" >> $GITHUB_ENV else sed -i'.bak' -e "s/^clientPort=2181$/clientPort=2182/g" /usr/local/etc/zookeeper/zoo.cfg cat /usr/local/etc/zookeeper/zoo.cfg fi zkServer start - - name: remove xcode devtools on osx - if: runner.os == 'macOS' - run: sudo rm -rf /Library/Developer/CommandLineTools/SDKs - - name: Setup Haskell - uses: haskell/actions/setup@v2 + uses: haskell-actions/setup@v2 with: ghc-version: ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} + - uses: actions/cache@v4 + with: + path: | + ~/.cabal/packages + ~/.cabal/store + dist-newstyle + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1- + - name: sdist run: | mkdir -p $HOME/sdist @@ -81,14 +77,33 @@ jobs: rm -rf $GITHUB_WORKSPACE/* find $HOME/sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE -xzvf {} --strip 1 \; + - name: setup + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + if [ "$(uname -m)" == "arm64" ]; then + echo "BUILD_ARGS=--extra-include-dirs=/opt/homebrew/include --extra-lib-dirs=/opt/homebrew/lib" >> $GITHUB_ENV + + ghc_version=$(echo "${{ matrix.ghc }}" | cut -d'.' -f1-2) + if [ "$ghc_version" == "8.10" ] || [ "$ghc_version" == "9.0" ]; then + brew install llvm@12 + echo "$(brew --prefix llvm@12)/bin" >> $GITHUB_PATH + # https://gitlab.haskell.org/ghc/ghc/-/issues/20592 + # C_INCLUDE_PATH="`xcrun --show-sdk-path`/usr/include/ffi" + echo "C_INCLUDE_PATH=$(xcrun --show-sdk-path)/usr/include/ffi" >> $GITHUB_ENV + else + echo "$(brew --prefix llvm@15)/bin" >> $GITHUB_PATH + fi + fi + fi + - name: build - run: cabal build ${{ env.BUILD_ARGS }} --upgrade-dependencies --enable-tests --enable-benchmarks + run: cabal build $BUILD_ARGS --upgrade-dependencies --enable-tests --enable-benchmarks - name: test - run: cabal test ${{ env.BUILD_ARGS }} --test-show-details=always + run: cabal test $BUILD_ARGS --enable-tests --test-show-details=always - name: check run: cabal check - name: haddock - run: cabal haddock + run: cabal $BUILD_ARGS haddock diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d4b0670..63d2401 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,7 +24,7 @@ jobs: ${{ runner.os }}- - name: Setup Haskell - uses: haskell/actions/setup@v2 + uses: haskell-actions/setup@v2 with: # can't build docs on ghc-9.2 with cabal-3.8, see # - https://github.com/haskell/cabal/issues/8104 diff --git a/test/Spec.hs b/test/Spec.hs index e8d72e2..c2320d6 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -41,10 +41,10 @@ main = withResource client $ \zh -> do opSpec :: ZHandle -> Spec opSpec zh = do describe "ZooKeeper.zooVersion" $ do - it "version should be 3.4.* - 3.8.*" $ do + it "version should be 3.4.* - 3.9.*" $ do putStrLn $ "Tested with zooVersion: " <> show zooVersion zooVersion `shouldSatisfy` (>= makeVersion [3, 4, 0]) - zooVersion `shouldSatisfy` (<= makeVersion [3, 8, 0]) + zooVersion `shouldSatisfy` (< makeVersion [3, 10, 0]) describe "zookeeper get set" $ do it "set some value to a node and get it" $ do