From 21eafc9a4fc33aff8d80d19c1b34e0c1ec9e3e0b Mon Sep 17 00:00:00 2001 From: John Ky Date: Thu, 19 Nov 2020 22:08:00 +1100 Subject: [PATCH] Switch to use setup-haskell --- .github/workflows/windows.yml | 312 ++++++++++++++++++++------------- cabal.project.local.ci.windows | 3 - 2 files changed, 187 insertions(+), 128 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e1d54024172..35630cc6c79 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,166 +1,228 @@ -name: "Ouroboros-Network" -on: [push] +name: Haskell CI -# One cannot specify builddir in `cabal.project`: cabal issue #5271 -# -# Run commands are using PowerShell by default; the quoting rules for -# PowerShell are described in this document: -# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7 -# -# Quoting for tasty `-p` command, this works (i.e. one needs to pass `\"` to -# tasty): -# ``` -# -p '$0 != \"typed-protocols.Socket.socket send receive IPv4\"' -# ``` -# or this will do too: -# ``` -# -p "`$0 != \""typed-protocols.Socket.socket send receive IPv4\""" -# `` +on: [push] jobs: - test-windows-8_10_2: - name: "Windows GHC-8.10.2" - runs-on: windows-latest - steps: - - name: Install GHC - run: | - choco install -y ghc --version 8.10.2 --allow-downgrade - - name: Print version - run: | - cabal --version - - name: Cabal config - run: | - cabal user-config init -a "http-transport: plain-http" -a "store-dir: C:\SR" -f -v3 + build: + runs-on: ${{ matrix.os }} - # Cache cabal-store - - name: cache cabal store - uses: actions/cache@v1 - with: - path: C:\SR - key: cabal-store-8.10.2 - # Cache parts of dist-newstyle (C:\dist) - - name: cache buiddir [cache] - uses: actions/cache@v1 - with: - path: C:\dist\cache - key: dist-cache - - name: cache buiddir [src] - uses: actions/cache@v1 - with: - path: C:\dist\src - key: dist-src - - name: cache builddir [packagedb] - uses: actions/cache@v1 - with: - path: C:\dist\packagedb - key: dist-packagedb + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + ghc: ["8.6.5", "8.10.2"] + os: [ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v1 + + - name: Select build directory + run: | + if [ "$OS" == Windows_NT ]; then + CABAL_BUILDDIR="D:\\a\\_temp\\dist" + else + CABAL_BUILDDIR="dist-newstyle" + fi + + echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" + echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" >> $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: Install libsodium + if: matrix.os == 'macos-latest' + run: brew install libsodium + + - name: Configure to use libsodium + run: | + cat >> cabal.project <> $GITHUB_ENV + echo 'TMP=${{ runner.temp }}' >> $GITHUB_ENV + + # Cache cabal-store + - name: cache cabal store + uses: actions/cache@v1 + with: + path: C:\SR + key: cabal-store-8.10.2 + # Cache parts of dist-newstyle (C:\dist) + - name: cache buiddir [cache] + uses: actions/cache@v1 + with: + path: C:\dist\cache + key: dist-cache + - name: cache buiddir [src] + uses: actions/cache@v1 + with: + path: C:\dist\src + key: dist-src + - name: cache builddir [packagedb] + uses: actions/cache@v1 + with: + path: C:\dist\packagedb + key: dist-packagedb - - name: update Hackage index - run: cabal v2-update + - name: update Hackage index + run: cabal v2-update - # checkout repository - - name: checkout ouroboros-network repository - uses: actions/checkout@v2 + # checkout repository + - name: checkout ouroboros-network repository + uses: actions/checkout@v2 - - name: Use cabal.project.local.windows - run: Copy-Item "./cabal.project.local.ci.windows" -Destination "./cabal.project.local" + - name: Use cabal.project.local.windows + run: cp ./cabal.project.local.ci.windows ./cabal.project.local - # - # Build & Test network packages - # + # + # Build & Test network packages + # - # Win32-network - - name: Win32-network [dependencies] - run: cabal v2-build --builddir "C:\dist" --only-dependencies Win32-network + # Win32-network + - name: Win32-network [dependencies] + if: matrix.os == 'windows-latest' + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies Win32-network - - name: Win32-network [build] - run: cabal v2-build --builddir "C:\dist" Win32-network + - name: Win32-network [build] + if: matrix.os == 'windows-latest' + run: cabal --builddir="$CABAL_BUILDDIR" v2-build Win32-network - - name: Win32-network [test] - run: cabal v2-run --builddir "C:\dist" test-Win32-network + - name: Win32-network [test] + if: matrix.os == 'windows-latest' + run: cabal --builddir="$CABAL_BUILDDIR" v2-run test-Win32-network - # ntp-client - - name: ntp-client [dependencies] - run: cabal v2-build --builddir "C:\dist" ntp-client + # ntp-client + - name: ntp-client [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build ntp-client - - name: ntp-client [build] - run: cabal v2-build --builddir "C:\dist" ntp-client + - name: ntp-client [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build ntp-client - - name: ntp-client [test] - run: cabal v2-run test-ntp-client + - name: ntp-client [test] + run: cabal --builddir="$CABAL_BUILDDIR" v2-run test-ntp-client - # io-sim-classes - - name: io-sim-classes [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" io-sim-classes + # io-sim-classes + - name: io-sim-classes [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies io-sim-classes - - name: io-sim-classes [build] - run: cabal v2-build --builddir "C:\dist" io-sim-classes + - name: io-sim-classes [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build io-sim-classes - # io-sim - - name: io-sim [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" io-sim + # io-sim + - name: io-sim [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies io-sim - - name: io-sim [build] - run: cabal v2-build --builddir "C:\dist" io-sim + - name: io-sim [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build io-sim - - name: io-sim [test] - run: cabal v2-run --builddir "C:\dist" test-sim + - name: io-sim [test] + run: cabal --builddir="$CABAL_BUILDDIR" v2-run test-sim - # typed-protocols - - name: typed-protcols [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" typed-protocols + # typed-protocols + - name: typed-protcols [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies typed-protocols - - name: typed-protocols [build] - run: cabal v2-build --builddir "C:\dist" typed-protocols + - name: typed-protocols [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build typed-protocols - # typed-protocols-examples - - name: typed-protocols-examples [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" typed-protocols-examples + # typed-protocols-examples + - name: typed-protocols-examples [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies typed-protocols-examples - - name: typed-protocols-examples [build] - run: cabal v2-build --builddir "C:\dist" typed-protocols-examples + - name: typed-protocols-examples [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build typed-protocols-examples - - name: typed-protocols-examples [test] - run: cabal v2-run --builddir "C:\dist" typed-protocols-tests + - name: typed-protocols-examples [test] + run: cabal --builddir="$CABAL_BUILDDIR" v2-run typed-protocols-tests - # network-mux - - name: network-mux [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" network-mux + # network-mux + - name: network-mux [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies network-mux - - name: network-mux [build] - run: cabal v2-build --builddir "C:\dist" network-mux + - name: network-mux [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build network-mux - - name: network-mux [test] - run: cabal v2-run --builddir "C:\dist" test-network-mux + - name: network-mux [test] + run: cabal --builddir="$CABAL_BUILDDIR" v2-run test-network-mux - # ouroboros-network-framework - - name: ouroboros-network-framework [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" ouroboros-network-framework + # ouroboros-network-framework + - name: ouroboros-network-framework [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies ouroboros-network-framework - - name: ouroboros-network-framework [build] - run: cabal v2-build --builddir "C:\dist" ouroboros-network-framework + - name: ouroboros-network-framework [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build ouroboros-network-framework - # issue: #1818 - - name: ourobors-network-framework [test] - run: cabal v2-run --builddir "C:\dist" ouroboros-network-framework-tests -- -p '$0 != \"typed-protocols.Socket.socket send receive IPv4\"' + # issue: #1818 + - name: ourobors-network-framework [test] + run: cabal --builddir="$CABAL_BUILDDIR" v2-run ouroboros-network-framework-tests -- -p '$0 != "typed-protocols.Socket.socket send receive IPv4"' - # ouroboros-network - - name: ouroboros-network [dependencies] - run: cabal v2-build --only-dependencies --builddir "C:\dist" ouroboros-network + # ouroboros-network + - name: ouroboros-network [dependencies] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build --only-dependencies ouroboros-network - - name: ouroboros-network [build] - run: cabal v2-build --builddir "C:\dist" ouroboros-network + - name: ouroboros-network [build] + run: cabal --builddir="$CABAL_BUILDDIR" v2-build ouroboros-network - - name: ouroboros-network [test] - run: cabal v2-run --builddir "C:\dist" test-network + - name: ouroboros-network [test] + run: cabal --builddir="$CABAL_BUILDDIR" v2-run test-network - # TODO: we need to install the cddl tool - # - name: ouroboros-network [cddl] - # run: cabal v2-run --builddir "C:\dist" test-cddl + # TODO: we need to install the cddl tool + # - name: ouroboros-network [cddl] + # run: cabal --builddir="$CABAL_BUILDDIR" v2-run test-cddl diff --git a/cabal.project.local.ci.windows b/cabal.project.local.ci.windows index 81b02b394c3..e24ae8de060 100644 --- a/cabal.project.local.ci.windows +++ b/cabal.project.local.ci.windows @@ -1,6 +1,3 @@ -with-compiler: C:\\ProgramData\\chocolatey\\lib\\ghc\\tools\\ghc-8.10.2\\bin\\ghc -tests: True - max-backjumps: 5000 reorder-goals: True