From 072a8a080b8efc1a61998b6dc976975c8360aacd Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Wed, 28 Jun 2023 14:59:47 +0200 Subject: [PATCH 1/2] alter entrypoint test directive --- action.yaml | 5 +++++ entrypoint.sh | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index 9786559..a19468b 100644 --- a/action.yaml +++ b/action.yaml @@ -1,5 +1,10 @@ name: 'Digitally Induced Test IHP App' description: 'Run tests for IHP applications' +inputs: + test: + description: 'Script that contains the actual invocation of the test' + required: true + default: 'test.sh' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index f80cb1c..157902e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,15 @@ #!/bin/sh -l +TEST_SCRIPT="$1" + # Start the project in the background. nix-shell /app/default.nix --run "devenv up &" -# Execute the tests. -nix-shell /app/default.nix --run "runghc $(make -C /app print-ghc-extensions) -i. -ibuild -iConfig Test/Main.hs" +if [ -f "$TEST_SCRIPT" ]; then + # Execute the test script. + $TEST_SCRIPT + exit 0 +else + # Execute the tests. + nix-shell /app/default.nix --run "runghc $(make -C /app print-ghc-extensions) -i. -ibuild -iConfig Test/Main.hs" +fi From 0b7a28fe64ae1a97e5591cd9833f9ac2169b159f Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Thu, 29 Jun 2023 09:00:37 +0200 Subject: [PATCH 2/2] entry alter --- action.yaml | 5 ++--- entrypoint.sh | 12 +++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/action.yaml b/action.yaml index a19468b..8bf99a1 100644 --- a/action.yaml +++ b/action.yaml @@ -2,9 +2,8 @@ name: 'Digitally Induced Test IHP App' description: 'Run tests for IHP applications' inputs: test: - description: 'Script that contains the actual invocation of the test' - required: true - default: 'test.sh' + description: 'Optional script path to be invoked before the actual test execution' + required: false runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 157902e..059885a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,15 +1,13 @@ #!/bin/sh -l -TEST_SCRIPT="$1" +INIT_SCRIPT="$1" # Start the project in the background. nix-shell /app/default.nix --run "devenv up &" -if [ -f "$TEST_SCRIPT" ]; then +if [ -f "$INIT_SCRIPT" ]; then # Execute the test script. - $TEST_SCRIPT - exit 0 -else - # Execute the tests. - nix-shell /app/default.nix --run "runghc $(make -C /app print-ghc-extensions) -i. -ibuild -iConfig Test/Main.hs" + $INIT_SCRIPT fi + +nix-shell /app/default.nix --run "runghc $(make -C /app print-ghc-extensions) -i. -ibuild -iConfig Test/Main.hs"