Skip to content

Import cardano addresses repo #1691

Import cardano addresses repo

Import cardano addresses repo #1691

Workflow file for this run

name: Haskell CI
on:
pull_request:
branches: [ "**" ]
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
whitespace:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Trailing whitespace check
if: matrix.os != 'windows-latest'
run: |
offenders="$(git grep "\s$" -- *.hs *.c *.h *.nix *.yml *.md || true)";
if [ -n "${offenders}" ]; then
echo -e "Fix trailing whitespace in:\n"
echo -n "${offenders}"
exit 1
fi
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.2.8", "9.6.4", "9.8.2", "9.10.1"]
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
# GHC versions older than ghc-9.2 are not supported on macos-latest
exclude:
- os: macos-latest
ghc: "8.10.7"
- os: macos-13
ghc: "9.2.8"
- os: macos-13
ghc: "9.6.4"
- os: macos-13
ghc: "9.8.2"
- os: macos-13
ghc: "9.10.1"
env:
# Modify this value to "invalidate" the cabal cache.
CABAL_CACHE_VERSION: "2023-04-27"
steps:
- name: Install Haskell
uses: input-output-hk/actions/haskell@latest
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 3.10.1.0
- name: "WIN: fixup cabal config"
if: runner.os == 'Windows'
run: |
# make sure cabal knows about msys64, and mingw64 tools. Not clear why C:/cabal/config is empty
# and C:/cabal doesn't even exist. The ghcup bootstrap file should have create it in the image:
# See https://github.com/haskell/ghcup-hs/blob/787edc17af4907dbc51c85e25c490edd8d68b80b/scripts/bootstrap/bootstrap-haskell#L591
# So we'll do it by hand here for now.
#
# We'll _not_ add extra-include-dirs, or extra-lib-dirs, and rely on what's shipped with GHC.
# https://github.com/msys2/MINGW-packages/issues/10837#issuecomment-1047105402
# https://gitlab.haskell.org/ghc/ghc/-/issues/21111
# if we _do_ want them, this would be the lines to add below
$ghcMingwDir = Join-Path -Path $(ghc --print-libdir) `
-ChildPath ../mingw/x86_64-*-mingw32/lib/ `
-Resolve
cabal user-config -a "extra-prog-path: C:/msys64/mingw64/bin, C:/msys64/usr/bin" `
-a "extra-include-dirs: C:/msys64/mingw64/include" `
-a ("extra-lib-dirs: {0}, C:/msys64/mingw64/lib" -f $ghcMingwDir) `
-f init
- name: Install system dependencies
uses: input-output-hk/actions/base@latest
with:
use-sodium-vrf: false # default is true
- name: "WIN: Install libs"
if: runner.os == 'Windows'
run: |
C:/msys64/usr/bin/pacman.exe --noconfirm -S mingw-w64-x86_64-pcre
- name: "LINUX: Install build environment (apt-get)"
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get -y install libsodium23 libsodium-dev
sudo apt-get -y remove --purge software-properties-common
sudo apt-get -y autoremove
- name: "MAC: Install build environment (brew)"
if: runner.os == 'macOS'
run: |
brew install libsodium
brew install pcre
sudo mkdir -p /usr/local/include
if [ ! -f /usr/local/include/pcre.h ]; then
sudo ln -s /opt/homebrew/Cellar/pcre/8.45/include/pcre.h /usr/local/include
fi
- uses: actions/checkout@v4
- name: Cabal update
run: cabal update
- name: Configure build
shell: bash
run: |
cp ".github/workflows/cabal.project.local.ci.$(uname -s)" cabal.project.local
echo "# cabal.project.local"
cat cabal.project.local
# A dry run `build all` operation does *NOT* downlaod anything, it just looks at the package
# indices to generate an install plan.
- name: Build dry run
run: cabal build all --enable-tests --dry-run --minimize-conflict-set
# From the install plan we generate a dependency list.
- name: Record dependencies
id: record-deps
run: |
# The tests call out to msys2 commands. We generally do not want to mix toolchains, so
# we are very deliberate about only adding msys64 to the path where absolutely necessary.
${{ (runner.os == 'Windows' && '$env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH)') || '' }}
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt
# From the dependency list we restore the cached dependencies.
# We use the hash of `dependencies.txt` as part of the cache key because that will be stable
# until the `index-state` values in the `cabal.project` file changes.
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
# Now we install the dependencies. If the cache was found and restored in the previous step,
# this should be a no-op, but if the cache key was not found we need to build stuff so we can
# cache it for the next step.
- name: Install dependencies
run: cabal build all --enable-tests --only-dependencies -j --ghc-option=-j4
# Always store the cabal cache.
# This may fail (benign failure) if the cache key is already populated.
- name: Cache Cabal store
uses: actions/cache/save@v4
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-newstyle
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
# Now we build.
- name: Build [testing]
run: cabal build all --enable-tests -j --ghc-option=-j4
- name: Run tests
env:
# these two are msys2 env vars, they have no effect on non-msys2 installs.
MSYS2_PATH_TYPE: inherit
MSYSTEM: MINGW64
run: cabal test all
- name: Build strict-checked-vars with invariants
run: cabal build -f+checktvarinvariants -f+checkmvarinvariants strict-checked-vars
- name: Save logs
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ matrix.ghc }} Build & test logs
path: |
dist-newstyle/**/*.log
# - name: Run benchmarks
# run: cabal bench all --enable-tests
# Uncomment the following back in for debugging. Remember to launch a `pwsh` from
# the tmux session to debug `pwsh` issues. And be reminded that the `/msys2` and
# `/msys2/mingw64` paths are not in PATH by default for the workflow, but tmate
# will put them in.
# You may also want to run
#
# $env:PATH=("C:\Program Files\PowerShell\7;{0}" -f $env:ORIGINAL_PATH)
#
# to restore the original path. Do note that some test might need msys2
# and will silently fail if msys2 is not in path. See the "Run tests" step.
#
# - name: Setup tmate session
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v4
# with:
# limit-access-to-actor: true
- name: Cache HLS artifacts (used to speed up GitHub Codespaces bootstrapping)
if: runner.os == 'Linux' && (matrix.ghc == '8.10.7' || matrix.ghc == '9.6.4')
uses: input-output-hk/actions/cache@latest
with:
ghc_version: ${{ matrix.ghc == '8.10.7' && 'ghc810' || matrix.ghc == '9.6.4' && 'ghc96' }}