From f7b77f3ee218b65ebf53bae40e44f26a2a39a9e2 Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Mon, 20 May 2024 14:23:14 +0800 Subject: [PATCH 1/2] Support ghc9.4 --- Z/IO/FileSystem/FilePath.hsc | 12 +++++++----- Z/IO/UV/FFI.hsc | 15 ++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Z/IO/FileSystem/FilePath.hsc b/Z/IO/FileSystem/FilePath.hsc index a852a73..1edf6a5 100644 --- a/Z/IO/FileSystem/FilePath.hsc +++ b/Z/IO/FileSystem/FilePath.hsc @@ -38,20 +38,22 @@ module Z.IO.FileSystem.FilePath ) where import Control.Monad hiding (join) -import Data.Word import Data.Bits -import qualified Data.List as List +import qualified Data.List as List +import Data.Word +import GHC.Exts import GHC.Generics +import Prelude hiding (concat) import qualified Z.Data.CBytes as CB -import Z.Data.CBytes (CBytes(CB), allocCBytesUnsafe, withCBytesUnsafe, withCBytesListUnsafe) +import Z.Data.CBytes (CBytes (CB), allocCBytesUnsafe, + withCBytesListUnsafe, withCBytesUnsafe) import Z.Data.JSON (JSON) import qualified Z.Data.Text as T -import qualified Z.Data.Vector.Base as V import qualified Z.Data.Vector as V +import qualified Z.Data.Vector.Base as V import Z.Foreign import Z.IO.Environment (getEnv') import Z.IO.Exception -import Prelude hiding (concat) #include "hs_cwalk.h" -- \ diff --git a/Z/IO/UV/FFI.hsc b/Z/IO/UV/FFI.hsc index 3ce7fb4..e896757 100644 --- a/Z/IO/UV/FFI.hsc +++ b/Z/IO/UV/FFI.hsc @@ -15,20 +15,21 @@ module Z.IO.UV.FFI where import Data.Bits import Data.Int +import Data.Primitive.Types (Prim) import Data.Word -import Data.Primitive.Types (Prim) import Foreign.C.String import Foreign.C.Types import Foreign.Ptr import Foreign.Storable +import GHC.Exts +import GHC.Generics +import System.Posix.Types (CSsize (..)) import Z.Data.Array.Unaligned -import Z.Data.Text.Print (Print(..)) -import Z.Data.JSON (JSON) -import Z.Data.CBytes as CBytes +import Z.Data.CBytes as CBytes +import Z.Data.JSON (JSON) +import Z.Data.Text.Print (Print (..)) import Z.Foreign -import Z.IO.Network.SocketAddr (SocketAddr) -import System.Posix.Types (CSsize (..)) -import GHC.Generics +import Z.IO.Network.SocketAddr (SocketAddr) #include "hs_uv.h" #if HAVE_UNISTD_H From cf0fa3fe0bb834c99d53e4cac1bfdddb3c2a00cb Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Mon, 20 May 2024 14:25:11 +0800 Subject: [PATCH 2/2] fix ci --- .github/workflows/ci.yml | 88 ++++++++++++++++++++++++++++++++++ .github/workflows/osxCI.yml | 54 --------------------- .github/workflows/ubuntuCI.yml | 53 -------------------- .github/workflows/winCI.yml | 47 ------------------ Z-IO.cabal | 3 -- 5 files changed, 88 insertions(+), 157 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/osxCI.yml delete mode 100644 .github/workflows/ubuntuCI.yml delete mode 100644 .github/workflows/winCI.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..bab63bc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +on: [push, pull_request] +name: ci + +jobs: + build: + name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + ghc-version: ["9.2", "9.4"] + cabal: ["3.8"] + avx_flag: ["", '--constraint="Z-Data +use-avx2"'] + env: + CONFIG: "--enable-tests --enable-benchmarks" + + steps: + - name: CPU info + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt-get install cpuid + cpuid + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install cpuid + cpuid + fi + shell: bash + + - uses: actions/checkout@v4 + with: + submodules: "recursive" + + - name: Set up GHC ${{ matrix.ghc-version }} + uses: haskell-actions/setup@v2 + id: setup + with: + ghc-version: ${{ matrix.ghc-version }} + cabal-version: ${{ matrix.cabal }} + cabal-update: true + + - name: Configure the build + run: | + cabal configure ${{ matrix.avx_flag }} $CONFIG + cabal build all --dry-run + + - name: Restore cached dependencies + uses: actions/cache/restore@v3 + id: cache + env: + key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }} + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }} + restore-keys: ${{ env.key }}- + + - name: Install dependencies + # If we had an exact cache hit, the dependencies will be up to date. + if: steps.cache.outputs.cache-hit != 'true' + run: cabal build all --only-dependencies + + # Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail. + - name: Save cached dependencies + uses: actions/cache/save@v3 + # If we had an exact cache hit, trying to save the cache would error because of key clash. + if: steps.cache.outputs.cache-hit != 'true' + with: + path: ${{ steps.setup.outputs.cabal-store }} + key: ${{ steps.cache.outputs.cache-primary-key }} + + - name: Build + run: cabal build $CONFIG + + - name: Run tests + # https://github.com/haskell/cabal/issues/7883 + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + # windows need permission to open pipes + cabal test --enable-tests --test-show-details=direct --test-options='--skip=IPC --skip=Process' + else + cabal test --enable-tests --test-show-details=direct + fi + shell: bash + + - run: | + cabal haddock + cabal check + cabal sdist diff --git a/.github/workflows/osxCI.yml b/.github/workflows/osxCI.yml deleted file mode 100644 index f7a7547..0000000 --- a/.github/workflows/osxCI.yml +++ /dev/null @@ -1,54 +0,0 @@ -on: [push, pull_request] -name: osx-ci -jobs: - build: - runs-on: macOS-latest - strategy: - matrix: - ghc: ['9.2'] - cabal: ['3.6'] - name: Haskell GHC ${{ matrix.ghc }} - steps: - - name: CPU info - run: | - sysctl -n machdep.cpu.features - sysctl -n machdep.cpu.leaf7_features - - - name: remove xcode devtools - run: sudo rm -rf /Library/Developer/CommandLineTools/SDKs - - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Setup Haskell - uses: haskell/actions/setup@v1 - id: setup-haskell-cabal # <--- give it a name for later cache usage - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - - - run: | - cabal update - cabal freeze - - - uses: actions/cache@v2 - with: - path: | - ${{ steps.setup-haskell-cabal.outputs.cabal-store }} - dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.ghc }}- - - - run: | - cabal configure --enable-tests --enable-benchmarks - cabal build - - - run: | - cabal test --test-show-details=direct - - - run: | - cabal haddock - cabal check - cabal sdist diff --git a/.github/workflows/ubuntuCI.yml b/.github/workflows/ubuntuCI.yml deleted file mode 100644 index 8f9a4ac..0000000 --- a/.github/workflows/ubuntuCI.yml +++ /dev/null @@ -1,53 +0,0 @@ -on: [push, pull_request] -name: ubuntu-ci -jobs: - build: - runs-on: ubuntu-20.04 - strategy: - matrix: - ghc: ['9.2'] - cabal: ['3.6'] - avx_flag: ['', '--constraint="Z-Data +use-avx2"'] - name: Haskell GHC ${{ matrix.ghc }} - env: - CONFIG: "--enable-tests --enable-benchmarks" - steps: - - - name: CPU info - run: | - sudo apt-get install cpuid - cpuid - - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Setup Haskell - uses: haskell/actions/setup@v1 - id: setup-haskell-cabal # <--- give it a name for later cache usage - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - - - run: | - cabal update - cabal freeze ${{ matrix.avx_flag }} - - - uses: actions/cache@v2 - with: - path: | - ${{ steps.setup-haskell-cabal.outputs.cabal-store }} - dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.ghc }}- - - - run: | - cabal configure ${{ matrix.avx_flag }} $CONFIG - cabal build $CONFIG - - run: | - cabal test --test-show-details=direct - - run: | - cabal haddock - cabal check - cabal sdist diff --git a/.github/workflows/winCI.yml b/.github/workflows/winCI.yml deleted file mode 100644 index 08cd1c8..0000000 --- a/.github/workflows/winCI.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: [push, pull_request] -name: win-ci -jobs: - build: - runs-on: windows-latest - strategy: - matrix: - ghc: ['9.2'] - cabal: ['3.6'] - name: Haskell GHC ${{ matrix.ghc }} - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Setup Haskell - uses: haskell/actions/setup@v1 - id: setup-haskell-cabal # <--- give it a name for later cache usage - with: - ghc-version: ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - - - run: | - cabal update - cabal freeze - - - uses: actions/cache@v2 - with: - path: | - ${{ steps.setup-haskell-cabal.outputs.cabal-store }} - dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} - restore-keys: | - ${{ runner.os }}-${{ matrix.ghc }}- - - - run: | - cabal configure --enable-tests --enable-benchmarks - cabal build - - - run: | - # windows need permission to open pipes - cabal test --test-show-details=direct --test-options='--skip=IPC --skip=Process' - - - run: | - cabal haddock - cabal check - cabal sdist diff --git a/Z-IO.cabal b/Z-IO.cabal index d11ccfb..2dce01d 100644 --- a/Z-IO.cabal +++ b/Z-IO.cabal @@ -389,9 +389,6 @@ test-suite Z-IO-Test Z.IO.ProcessSpec Z.IO.ResourceSpec - if os(linux) - other-modules: Z.IO.Network.IPCSpec - ghc-options: -threaded default-language: Haskell2010 build-tool-depends: hspec-discover:hspec-discover ==2.*