diff --git a/.github/workflows/repo-ghc-8.6-cabal-2.4-ros.yml b/.github/workflows/repo-ghc-8.6-cabal-2.4-ros.yml new file mode 100644 index 0000000..be899c4 --- /dev/null +++ b/.github/workflows/repo-ghc-8.6-cabal-2.4-ros.yml @@ -0,0 +1,54 @@ +name: ros-ghc-8.6-cabal-2.4 + +# Trigger the workflow on push or pull request +on: + - pull_request + - push + +jobs: + cabal: + name: ${{ matrix.os }} / ghc ${{ matrix.ghc }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + cabal: ["2.4"] + ghc: + - "8.6" + + steps: + + - uses: haskell-actions/setup@main + id: setup-haskell-cabal + name: Setup Haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} + + - name: Prepare environment + run: | + echo "$HOME/.ghcup/bin" >> $GITHUB_PATH + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + + - uses: actions/checkout@v4 + + - name: Create sandbox + run: | + echo "$PWD/.cabal-sandbox/bin" >> $GITHUB_PATH + cabal v1-sandbox init + + - name: Install dependencies + run: | + cabal v1-install alex happy + + - name: Install ogma + run: | + cabal v1-install copilot ogma-**/ --constraint="copilot >= 3.19.1" + + - name: Generate ROS app + run: | + ogma ros --app-target-dir demo --variable-db ogma-cli/examples/ros-copilot/vars-db --variable-file ogma-cli/examples/ros-copilot/variables --handlers-file ogma-cli/examples/ros-copilot/handlers + cabal v1-exec -- runhaskell ogma-cli/examples/ros-copilot/ROS.hs + find demo/ + cd demo/ + docker build . diff --git a/ogma-cli/examples/ros-copilot/ROS.hs b/ogma-cli/examples/ros-copilot/ROS.hs new file mode 100644 index 0000000..034d429 --- /dev/null +++ b/ogma-cli/examples/ros-copilot/ROS.hs @@ -0,0 +1,20 @@ +import Copilot.Compile.C99 +import Copilot.Language +import Language.Copilot (reify) +import Prelude hiding (not, (>=)) + +inputSignal :: Stream Int64 +inputSignal = extern "input_signal" Nothing + +propTestCopilot :: Stream Bool +propTestCopilot = inputSignal >= 5 + +spec :: Spec +spec = do + trigger "handlerTestCopilot" (not propTestCopilot) [] + +main :: IO () +main = reify spec >>= compileWith settings "monitor" + where + settings = mkDefaultCSettings + { cSettingsOutputDirectory = "demo/copilot/src/" } diff --git a/ogma-cli/examples/ros-copilot/handlers b/ogma-cli/examples/ros-copilot/handlers new file mode 100644 index 0000000..b56f01b --- /dev/null +++ b/ogma-cli/examples/ros-copilot/handlers @@ -0,0 +1 @@ +handlerTestCopilot diff --git a/ogma-cli/examples/ros-copilot/variables b/ogma-cli/examples/ros-copilot/variables new file mode 100644 index 0000000..4c4c321 --- /dev/null +++ b/ogma-cli/examples/ros-copilot/variables @@ -0,0 +1 @@ +input_signal diff --git a/ogma-cli/examples/ros-copilot/vars-db b/ogma-cli/examples/ros-copilot/vars-db new file mode 100644 index 0000000..fd94daa --- /dev/null +++ b/ogma-cli/examples/ros-copilot/vars-db @@ -0,0 +1 @@ +("input_signal","int64_t","/demo/topic","int64_t")