tooling: Add make ghcid-test-x commands

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5274
GitOrigin-RevId: e9096812b1cd97f45fd89bf7deeca4d45fd9d422
This commit is contained in:
Daniel Harvey 2022-08-03 12:05:59 +01:00 committed by hasura-bot
parent 34ec4d0278
commit 0c9a97040e
2 changed files with 49 additions and 0 deletions

View File

@ -1,7 +1,24 @@
# ghcid gets its own cache
GHCID_FLAGS = --builddir ./dist-newstyle/repl --repl-option -O0 --repl-option -fobject-code
GHCID_TESTS_FLAGS = --builddir ./dist-newstyle/repl-tests --repl-option -O0
PANE_WIDTH = $(shell tmux display -p "\#{pane_width}" || echo 80)
PANE_HEIGHT = $(shell tmux display -p "\#{pane_height}" || echo 30 )
# once ghcid's window errors are fixed we can remove this explicit width/height
# nonsense
# this needs to make it into ghcid: https://github.com/biegunka/terminal-size/pull/16
define run_ghcid_hspec_tests
@if [[ $$(uname -p) == 'arm' ]]; then \
HSPEC_MATCH="$(2)" ghcid -c "cabal repl $(1) $(GHCID_TESTS_FLAGS)" \
--test "main" \
--width=$(PANE_WIDTH) \
--height=$(PANE_HEIGHT); \
else \
HSPEC_MATCH="$(2)" ghcid -c "cabal repl $(1) $(GHCID_TESTS_FLAGS)" \
--test "main"; \
fi
endef
define run_ghcid
@if [[ $$(uname -p) == 'arm' ]]; then \
@ -21,3 +38,29 @@ ghcid-library:
ghcid-hspec:
$(call run_ghcid,graphql-engine:tests-hspec)
.PHONY: ghcid-test-backends
## ghcid-test-backends: run all hspec tests in ghcid
ghcid-test-backends: remove-tix-file
$(call run_ghcid_hspec_tests,graphql-engine:tests-hspec)
.PHONY: ghcid-test-bigquery
## ghcid-test-bigquery: run tests for BigQuery backend in ghcid
# will require some setup detailed here: https://github.com/hasura/graphql-engine-mono/tree/main/server/tests-hspec#required-setup-for-bigquery-tests
ghcid-test-bigquery: start-postgres remove-tix-file
$(call run_ghcid_hspec_tests,graphql-engine:tests-hspec,BigQuery)
.PHONY: ghcid-test-sqlserver
## ghcid-test-sqlserver: run tests for SQL Server backend in ghcid
ghcid-test-sqlserver: start-postgres start-sqlserver remove-tix-file
$(call run_ghcid_hspec_tests,graphql-engine:tests-hspec,SQLServer)
.PHONY: ghcid-test-mysql
## ghcid-test-mysql: run tests for MySQL backend in ghcid
ghcid-test-mysql: start-postgres start-mysql remove-tix-file
$(call run_ghcid_hspec_tests,graphql-engine:tests-hspec,MySQL)
.PHONY: ghcid-test-citus
## ghcid-test-citus: run tests for Citus backend in ghcid
ghcid-test-citus: start-postgres start-citus remove-tix-file
$(call run_ghcid_hspec_tests,graphql-engine:tests-hspec,Citus)

View File

@ -17,6 +17,12 @@ test-mysql: spawn-postgres spawn-mysql wait-for-postgres wait-for-mysql remove-t
$(call stop_after, \
cabal run tests-hspec -- -m 'MySQL')
.PHONY: test-citus
## test-citus: run tests for Citus backend
test-citus: spawn-postgres spawn-citus wait-for-postgres wait-for-citus remove-tix-file
$(call stop_after, \
cabal run tests-hspec -- -m 'Citus')
.PHONY: test-backends
## test-backends: run tests for all backends
# BigQuery tests will require some setup detailed here: https://github.com/hasura/graphql-engine-mono/tree/main/server/tests-hspec#required-setup-for-bigquery-tests