This is an automated email from the ASF dual-hosted git repository. nickva pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/couchdb-jiffy.git
commit 7fdf2762e49257272188c2d6c02929db5f92fc00 Author: Nick Vatamaniuc <[email protected]> AuthorDate: Sat Mar 28 13:08:57 2026 -0400 Run prop tests in CI We got prop tests but we almost never run them as installing EQC mini is a bit of an adventure. Once I figured it out how to install it let's make it a script and run it in CI before I forget how to do it again. I didn't want to spam the download endpoint with fetching the beams on every matrix build so made a single run on Erlang 27 for it. Besides probably good idea to stick with 27 only since the beams seem to be built in OTP 25, and we only get guarantees about compatibility up to 2 version ahead only. --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++++++++- .gitignore | 3 +++ Makefile | 5 +++++ rebar.config.script | 14 ++++++++++++-- test/install_eqc_mini.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7501cea..df72868 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,43 @@ jobs: run: | make REBAR=${{matrix.rebar}} check + # Keep this no more than 2 releases away from EQC-mini beam files. Currently + # they are on OTP 25 so we can use erlang up to version 27 technically. + # + eqc-mini-25: + name: eqc-mini + runs-on: ubuntu-latest + container: + image: erlang:25 + steps: + - uses: actions/checkout@v6 + - name: rebar3 make check-with-eqc + run: | + make REBAR=rebar3 check-with-eqc + + eqc-mini-26: + name: eqc-mini + runs-on: ubuntu-latest + container: + image: erlang:26 + steps: + - uses: actions/checkout@v6 + - name: rebar3 make check-with-eqc + run: | + make REBAR=rebar3 check-with-eqc + + # This currently fails. Most likely related to 0.0 + # eqc-mini-27: + # name: eqc-mini + # runs-on: ubuntu-latest + # container: + # image: erlang:27 + # steps: + # - uses: actions/checkout@v6 + # - name: rebar3 make check-with-eqc + # run: | + # make REBAR=rebar3 check-with-eqc + gcc-14: name: gcc-14 runs-on: ubuntu-latest @@ -52,7 +89,7 @@ jobs: image: erlang:28 steps: - uses: actions/checkout@v6 - - name: install clang 20 + - name: install clang run: | apt update apt install -y --no-install-recommends --no-install-suggests clang-19 diff --git a/.gitignore b/.gitignore index bd33acc..c98ce03 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ erln8.config hexer.config rebar.lock TEST-*.xml +/eqc/ +.eqc-info +current_counterexample.eqc diff --git a/Makefile b/Makefile index 1ad82f4..5b8ef81 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ clean: rm -rf logs rm -rf .eunit rm -f test/*.beam + rm -rf eqc distclean: clean @@ -25,6 +26,10 @@ eunit: check: build eunit +check-with-eqc: install_eqc build eunit + +install_eqc: + ./test/install_eqc_mini.sh release: rebar3 hex publish diff --git a/rebar.config.script b/rebar.config.script index c2f1689..604f4de 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,10 +1,20 @@ % This file is part of Jiffy released under the MIT license. % See the LICENSE file for more information. % -% Only run the EQC checks when EQC is present. +% Only run the EQC checks when EQC is present. +% +% We have a helper tests/install_eqc_mini.sh script to install it ./eqc, so we +% look for it there first, and add that to the code path. Users may have also +% installed it directly into their OTP distribution, which should be fine, +% code:which(eqc) should find that as well. +% +LocalEQC = filename:join([filename:dirname(SCRIPT), "eqc", "ebin"]), +case filelib:is_dir(LocalEQC) of + true -> code:add_patha(LocalEQC); + false -> ok +end, HaveEQC = code:which(eqc) =/= non_existing, - ErlOpts = if not HaveEQC -> []; true -> [{d, 'HAVE_EQC'}] end, diff --git a/test/install_eqc_mini.sh b/test/install_eqc_mini.sh new file mode 100755 index 0000000..5614c75 --- /dev/null +++ b/test/install_eqc_mini.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Install EQC mini in $project_dir/eqc, where rebar config will find it. +# +# Note: mind what version it's compiled for and make sure to test it on +# Erlang version no more than two major version numbers away from it. +# So, for example, 25 should be good for 25, 26 and 27. +# + +set -eu + +EQC_VERSION="2.02.0" +EQC_URL="https://www.quviq.com/downloads/eqcR25-${EQC_VERSION}.zip" +EQC_ZIP_DIR="Quviq QuickCheck Mini version ${EQC_VERSION} for OTP 25" + +PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)" +INSTALL_DIR="${PROJECT_DIR}/eqc" + +if [ -d "${INSTALL_DIR}/ebin" ]; then + echo "Already installed at ${INSTALL_DIR}" + exit 0 +fi + +TMPDIR="${TMPDIR:-/tmp}" +ZIP_FILE="${TMPDIR}/eqc-mini-${EQC_VERSION}.zip" +EXTRACT_DIR="${TMPDIR}/eqc-mini-extract-$$" + +echo "Downloading ${EQC_URL}" +curl -sfL "${EQC_URL}" -o "${ZIP_FILE}" + +rm -rf "${EXTRACT_DIR}" +mkdir -p "${EXTRACT_DIR}" +unzip -q -o "${ZIP_FILE}" -d "${EXTRACT_DIR}" + +rm -rf "${INSTALL_DIR}" +mv "${EXTRACT_DIR}/${EQC_ZIP_DIR}/eqc-${EQC_VERSION}" "${INSTALL_DIR}" + +rm -rf "${EXTRACT_DIR}" "${ZIP_FILE}" + +echo "Installed in ${INSTALL_DIR}"
