From c356918d4d5f4b01e02831079ada73a8ba5d1728 Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Thu, 23 May 2024 17:10:22 +0800 Subject: [PATCH] ci --- .github/workflows/ci.yaml | 49 +++++++++++++++++++++-------------- .github/workflows/publish.yml | 2 +- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 958c1d5..a66296f 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,41 @@ 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: 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- + + # echo "BUILD_ARGS=--extra-include-dirs=/opt/homebrew/include --extra-lib-dirs=/opt/homebrew/lib" >> $GITHUB_ENV + - name: Set environment variables + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + echo "PATH=\"$(brew --prefix llvm@15)/bin:$PATH\"" >> $GITHUB_ENV + echo "C_INCLUDE_PATH=\"$C_INCLUDE_PATH:/opt/homebrew/include\"" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/opt/homebrew/lib\"" >> $GITHUB_ENV + fi + - name: sdist run: | mkdir -p $HOME/sdist @@ -82,10 +91,12 @@ jobs: find $HOME/sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE -xzvf {} --strip 1 \; - name: build - run: cabal build ${{ env.BUILD_ARGS }} --upgrade-dependencies --enable-tests --enable-benchmarks + run: | + type opt + cabal build --upgrade-dependencies --enable-tests --enable-benchmarks - name: test - run: cabal test ${{ env.BUILD_ARGS }} --test-show-details=always + run: cabal test --enable-tests --test-show-details=always - name: check run: cabal check 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