Skip to content

Commit

Permalink
Merge #1966
Browse files Browse the repository at this point in the history
1966: Windows builds with simple cache r=newhoggy a=newhoggy



Co-authored-by: John Ky <john.ky@iohk.io>
  • Loading branch information
iohk-bors[bot] and newhoggy committed Oct 13, 2020
2 parents 3838e45 + 62fd91e commit 388ebca
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 3 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Haskell CI

on: [push]

jobs:
build:
runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash

strategy:
fail-fast: false
matrix:
ghc: ["8.6.5"]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v1

- name: Select build directory
run: echo "CABAL_BUILDDIR=dist" >> $GITHUB_ENV

- name: Install pkgconfiglite
if: matrix.os == 'windows-latest'
run: choco install -y pkgconfiglite

- name: Install libsodium
if: matrix.os == 'windows-latest'
run: |
curl -Ls https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-mingw.tar.gz -o libsodium-1.0.18-mingw.tar.gz
tar zxvf libsodium-1.0.18-mingw.tar.gz
sed -i "s|/d/a/1/s/|D:/a/cardano-node/cardano-node/|g" libsodium-win64/lib/pkgconfig/libsodium.pc
export PKG_CONFIG_PATH="$(readlink -f libsodium-win64/lib/pkgconfig)"
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
export LIBSODIUM_PATH="$(readlink -f libsodium-win64/bin | sed 's|^/d|D:|g' | tr / '\\')"
echo "LIBSODIUM_PATH=$LIBSODIUM_PATH"
echo "$LIBSODIUM_PATH" >> $GITHUB_PATH
- name: Configure to use libsodium
run: |
cat >> cabal.project <<EOF
package cardano-crypto-praos
flags: -external-libsodium-vrf
EOF
- uses: actions/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: '3.2.0.0'

- name: Install build environment
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get -y install libsodium23 libsodium-dev
sudo apt-get -y install libsystemd0 libsystemd-dev
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove
- name: Cabal update
run: cabal update

- name: Cabal Configure
run: cabal configure --builddir="$CABAL_BUILDDIR" --enable-tests --enable-benchmarks --write-ghc-environment-files=always

- uses: actions/cache@v2
name: Cache cabal store
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist
key: cache-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal-cache.cabal') }}-${{ github.sha }}
restore-keys: |
cache-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal-cache.cabal') }}-
- name: Install dependencies
run: cabal build all --builddir="$CABAL_BUILDDIR" --only-dependencies

- name: Build
run: cabal build cardano-node cardano-cli cardano-node-chairman --builddir="$CABAL_BUILDDIR"

- name: Git clone
run: git clone https://github.com/input-output-hk/cardano-mainnet-mirror

- name: Run tests
run: cabal test --builddir="$CABAL_BUILDDIR" cardano-node-chairman
6 changes: 6 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ package small-steps
package small-steps-test
tests: False

package goblins
tests: False

package io-sim-classes
tests: False

-- ---------------------------------------------------------


Expand Down
5 changes: 5 additions & 0 deletions ci-shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

env

"$*"
1 change: 1 addition & 0 deletions hedgehog-extras/hedgehog-extras.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ library
, deepseq
, directory
, exceptions
, filepath
, hedgehog
, mmorph
, mtl
Expand Down
18 changes: 15 additions & 3 deletions hedgehog-extras/src/Hedgehog/Extras/Test/Process.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,25 @@ import qualified Data.Text as T
import qualified GHC.Stack as GHC
import qualified Hedgehog as H
import qualified Hedgehog.Extras.Stock.IO.Process as IO
import qualified Hedgehog.Extras.Stock.OS as OS
import qualified Hedgehog.Extras.Test.Base as H
import qualified System.Directory as IO
import qualified System.Environment as IO
import qualified System.Exit as IO
import qualified System.IO.Unsafe as IO
import qualified System.Process as IO

planJsonFile :: String
planJsonFile = IO.unsafePerformIO $ do
maybeBuildDir <- liftIO $ IO.lookupEnv "CABAL_BUILDDIR"
case maybeBuildDir of
Just buildDir -> return $ ".." </> buildDir </> "cache/plan.json"
Nothing -> return "../dist-newstyle/cache/plan.json"
{-# NOINLINE planJsonFile #-}

exeSuffix :: String
exeSuffix = if OS.isWin32 then ".exe" else ""

-- | Create a process returning handles to stdin, stdout, and stderr as well as the process handle.
createProcess
:: (MonadTest m, MonadResource m, HasCallStack)
Expand Down Expand Up @@ -157,13 +170,12 @@ procDist
-> m CreateProcess
-- ^ Captured stdout
procDist pkg arguments = do
base <- getProjectBase
contents <- H.evalIO . LBS.readFile $ base </> "dist-newstyle/cache/plan.json"
contents <- H.evalIO . LBS.readFile $ planJsonFile

case eitherDecode contents of
Right plan -> case L.filter matching (plan & installPlan) of
(component:_) -> case component & binFile of
Just bin -> return $ IO.proc (T.unpack bin) arguments
Just bin -> return $ IO.proc (T.unpack bin <> exeSuffix) arguments
Nothing -> error $ "missing bin-file in: " <> show component
[] -> error $ "Cannot find exe:" <> pkg <> " in plan"
Left message -> error $ "Cannot decode plan: " <> message
Expand Down

0 comments on commit 388ebca

Please sign in to comment.