From d0d95535d800efdd438354e95f2f27c93408d84b Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Thu, 17 Oct 2024 11:51:42 +0200 Subject: [PATCH 1/3] chore: Remove traces of stack from Makefile Looks like the stack project configuration has been removed before. GHC 8.x specific targets are removed as this out of any support windows. Targets have been translated. The `ghcid` target is now not executing the tests anymore - but it's now much quicker. --- Makefile | 55 ++++++++----------------------------------------------- 1 file changed, 8 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index e3957e25..46f509f7 100644 --- a/Makefile +++ b/Makefile @@ -3,49 +3,38 @@ .DEFAULT_GOAL = help -stack = STACK_YAML='stack.yaml' stack ghc_perf_options = --ghc-options '+RTS -A128M -RTS' build = build $(ghc_perf_options) -ghci = ghci $(ghc_perf_options) +ghci = repl $(ghc_perf_options) test = test $(ghc_perf_options) -stack-8.0 = STACK_YAML="stack-8.0.yaml" stack -stack-8.2 = STACK_YAML="stack-8.2.yaml" stack -stack-8.4 = STACK_YAML="stack-8.4.yaml" stack -stack-8.6 = STACK_YAML="stack-8.6.yaml" stack - -# stack build --ghc-options '+RTS -A128M -RTS' ## run build build: - $(stack) $(build) + cabal $(build) ## build with validation options (Wall, Werror) build-validate: - $(stack) build --fast --ghc-options '-Wall -Werror +RTS -A128M -RTS' + cabal build --disable-optimization --ghc-options '-Wall -Werror +RTS -A128M -RTS' ## run ghci ghci: - $(stack) $(ghci) + cabal $(ghci) ## run tests test: echo-warn - $(stack) $(test) + cabal $(test) ## run tests with forced re-run via "-r" test-rerun: echo-warn - $(stack) $(test) --test-arguments "-r" + cabal $(test) --test-options='-r --failure-report test-failure-report' ## run ghci with test stanza test-ghci: - $(stack) $(ghci) bloodhound:test:bloodhound-tests + cabal $(ghci) bloodhound:test:bloodhound-tests ## run ghcid ghcid: - ghcid -c "$(stack) ghci bloodhound:lib --test --ghci-options='-fobject-code -fno-warn-unused-do-bind' --main-is bloodhound:test:bloodhound-tests" - -## run ghcid with validate options (Werror, etc.) -ghcid-validate: - ghcid -c "$(stack) ghci bloodhound:lib --test --ghci-options='-Werror -fobject-code -fno-warn-unused-do-bind' --main-is bloodhound:test:bloodhound-tests" + ghcid ## run weeder weeder: @@ -65,34 +54,6 @@ hlint-watch: echo-warn: @echo "Make certain you have an elasticsearch instance on localhost:9200 !" -## Test with GHC 8.0 and ES 5.x -test-8.0: - STACK_YAML="stack-8.0.yaml" stack test --fast bloodhound:test:bloodhound-tests --test-arguments="--qc-max-success 500" - -## Test with GHC 8.2 and ES 5.x -test-8.2: - STACK_YAML="stack.yaml" stack test --fast bloodhound:test:bloodhound-tests --test-arguments="--qc-max-success 500" - -## Build with the GHC 8.0 Stack YAML -build-8.0: - $(stack-8.0) $(build) - -## Build with the GHC 8.2 Stack YAML -build-8.2: - $(stack-8.2) $(build) - -## Build with the GHC 8.4 Stack YAML -build-8.4: - $(stack-8.4) $(build) - -## Build with the GHC 8.6 Stack YAML -build-8.6: - $(stack-8.6) $(build) - -## Upload the package to Hackage -upload: - stack upload --no-signature . - # Create ES instance ## Run test environment From 048c008e9a9947e346434ad77dc30d0396b3337c Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Thu, 17 Oct 2024 11:54:38 +0200 Subject: [PATCH 2/3] chore: Document how tests are run with Nix and Cabal The old stack setup is gone. So, the docs needed some adjustment. --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cbeaaa46..eb64203d 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,16 @@ Bloodhound is stable for production use. I will strive to avoid breaking API com Testing ------- -The TravisCI tests are run using [Stack](http://docs.haskellstack.org/en/stable/README.html). You should use Stack instead of `cabal` to build and test Bloodhound to avoid compatibility problems. You will also need to have an Elasticsearch instance running at `localhost:9200` in order to execute some of the tests. See the "Version compatibility" section above for a list of Elasticsearch versions that are officially validated against in TravisCI. - -Steps to run the tests locally: - 1. Dig through the [past releases] (https://www.elastic.co/downloads/past-releases) section of the Elasticsearch download page and install the desired Elasticsearch versions. - 2. Install [Stack] (http://docs.haskellstack.org/en/stable/README.html#how-to-install) - 3. In your local Bloodhound directory, run `stack setup && stack build` - 4. Start the desired version of Elasticsearch at `localhost:9200`, which should be the default. - 5. Run `stack test` in your local Bloodhound directory. - 6. The unit tests will pass if you re-execute `stack test`. If you want to start with a clean slate, stop your Elasticsearch instance, delete the `data/` folder in the Elasticsearch installation, restart Elasticsearch, and re-run `stack test`. +The Bloodhound project uses Github workflows using Cabal to test for regressions +and compatibility. A convenient development environment is provided by Nix and a +Makefile, though the project can be built with only Cabal. + +To run the tests: +1. Get into the Nix environment by running `nix develop` (or `nix-shell` for a non-flake setup) +1. Start Elasticsearch defined by `docker-compose.yml`: `make compose` +1. Run the tests with Cabal: `cabal test` + +The second step can be left out if ElasticSearch (or OpenSearch) is started manually. Contributions ------------- From ff6eaf5a7caff3751e47ec9538c97d1f9e3e3c32 Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Fri, 18 Oct 2024 09:45:17 +0200 Subject: [PATCH 3/3] chore: Ignore the test report file `test-failure-report` is generated by the `test-rerun` Makefile target. No need to commit it (that would even be wrong.) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2d323295..6b7b4f16 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ build-docs.* .direnv .env result +test-failure-report