diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1dbdb45 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install QuickFIX C++ library + run: | + sudo apt-get update + sudo apt-get install -y libquickfix-dev + + - name: Setup Haskell + uses: haskell-actions/setup@v2 + with: + ghc-version: '9.4' + cabal-version: '3.10' + + - name: Cache Cabal packages + uses: actions/cache@v4 + with: + path: | + ~/.cabal/packages + ~/.cabal/store + dist-newstyle + key: ${{ runner.os }}-cabal-${{ hashFiles('**/*.cabal') }} + restore-keys: | + ${{ runner.os }}-cabal- + + - name: Update Cabal package list + run: cabal update + + - name: Build + run: cabal build diff --git a/.gitignore b/.gitignore index 94b804a..3ca6763 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ # GHC build goo dist/ +dist-newstyle/ docs/ out/ *.dump-* diff --git a/alphaheavy-quickfix.cabal b/alphaheavy-quickfix.cabal index 8e80db9..da14c92 100644 --- a/alphaheavy-quickfix.cabal +++ b/alphaheavy-quickfix.cabal @@ -34,7 +34,7 @@ Library HS-Source-Dirs: src - GHC-Options: -Wall + GHC-Options: -Wall -optcxx-std=c++11 CC-Options: -O2 -ggdb C-Sources: cbits/QuickFIXThunks.cpp diff --git a/cbits/QuickFIXThunks.cpp b/cbits/QuickFIXThunks.cpp index 48ac0b6..b1cc17d 100644 --- a/cbits/QuickFIXThunks.cpp +++ b/cbits/QuickFIXThunks.cpp @@ -277,5 +277,5 @@ char* sessionDisconnect(const FIX::SessionID& sid) extern "C" char* sessionString(const FIX::SessionID& sid) { - strdup(sid.toStringFrozen().c_str()); + return strdup(sid.toStringFrozen().c_str()); } diff --git a/src/AlphaHeavy/QuickFIX/GReceive.hs b/src/AlphaHeavy/QuickFIX/GReceive.hs index a5a1e25..39c322a 100644 --- a/src/AlphaHeavy/QuickFIX/GReceive.hs +++ b/src/AlphaHeavy/QuickFIX/GReceive.hs @@ -4,6 +4,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} module AlphaHeavy.QuickFIX.GReceive where diff --git a/src/AlphaHeavy/QuickFIX/GSend.hs b/src/AlphaHeavy/QuickFIX/GSend.hs index c6b6502..ae9b4e9 100644 --- a/src/AlphaHeavy/QuickFIX/GSend.hs +++ b/src/AlphaHeavy/QuickFIX/GSend.hs @@ -4,6 +4,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} module AlphaHeavy.QuickFIX.GSend where diff --git a/src/AlphaHeavy/QuickFIX/GetMessageField.hs b/src/AlphaHeavy/QuickFIX/GetMessageField.hs index 03936a2..3113dab 100644 --- a/src/AlphaHeavy/QuickFIX/GetMessageField.hs +++ b/src/AlphaHeavy/QuickFIX/GetMessageField.hs @@ -56,7 +56,7 @@ instance GetMessageField ByteString where instance GetMessageField Data.Time.UTCTime where getMessageField msg fid = do txt <- getMessageField msg fid - case parseTime defaultTimeLocale "%Y%m%d-%H:%M:%S" txt of + case parseTimeM True defaultTimeLocale "%Y%m%d-%H:%M:%S" txt of Just val -> return $! val Nothing -> throwIO . IncorrectTagValue fid $ txt