Test script now requires jq

This commit is contained in:
Vaibhav Sagar 2021-04-25 17:55:49 +10:00
parent cd9688f036
commit b64a65d344
3 changed files with 14 additions and 6 deletions

View File

@ -53,7 +53,7 @@ jobs:
sudo apt update
- name: Install system dependencies
run: |
sudo apt install libmagic-dev libgmp-dev libblas-dev liblapack-dev libcairo2-dev libpango1.0-dev libzmq3-dev
sudo apt install libmagic-dev libgmp-dev libblas-dev liblapack-dev libcairo2-dev libpango1.0-dev libzmq3-dev jq
- name: Set up Python
uses: actions/setup-python@v1
with:

View File

@ -35,7 +35,7 @@ jobs:
matrix:
versions:
- compiler: 'ghc884'
- compiler: 'ghc8102'
- compiler: 'ghc8104'
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
@ -48,5 +48,8 @@ jobs:
-I nixpkgs=https://github.com/NixOS/nixpkgs/tarball/nixos-20.09 \
release.nix \
--argstr compiler ${{ matrix.versions.compiler }}
test/acceptance.nbconvert.sh result/bin/ihaskell-nbconvert
nix-shell \
-I nixpkgs=https://github.com/NixOS/nixpkgs/tarball/nixos-20.09 \
-p jq --run \
'test/acceptance.nbconvert.sh result/bin/ihaskell-nbconvert'

View File

@ -3,7 +3,8 @@
# Run nbconvert acceptance tests
# ------------------------------
#
# This script must be called from the root directory of IHaskell.
# This script must be called from the root directory of IHaskell. It requires
# `jq` to be available in the $PATH.
#
# Positional arguments to this script are the invocation for `nbconvert`.
# For example:
@ -27,7 +28,11 @@
set -euo pipefail
$* --to=notebook --execute --allow-errors --stdout test/acceptance.nbconvert.in.ipynb > test/acceptance.nbconvert.out.ipynb
$* --to=notebook --execute --allow-errors --stdout --nbformat=4 test/acceptance.nbconvert.in.ipynb > test/acceptance.nbconvert.out.ipynb
diff <(grep -v -e 'version' -e 'Line ' -e 'Integral' test/acceptance.nbconvert.in.ipynb) <(grep -v -e 'version' -e 'Line ' -e 'Integral' test/acceptance.nbconvert.out.ipynb)
diff \
<(grep -v -e 'version' -e 'Line ' -e 'Integral' -e 'Num' \
<(cat test/acceptance.nbconvert.in.ipynb | jq '{"cells": .cells | map(del(.metadata.execution)), "metadata": .metadata}')) \
<(grep -v -e 'version' -e 'Line ' -e 'Integral' -e 'Num' \
<(cat test/acceptance.nbconvert.out.ipynb | jq '{"cells": .cells | map(del(.metadata.execution)), "metadata": .metadata}'))