Skip to content
Snippets Groups Projects
run-ci-tests.nix 682 B
{pkgs', ...}: let
  bashFktScript = import ./bash-fkt.nix {
    inherit pkgs';
  };
in
  pkgs'.writeShellScriptBin "run-ci-tests" ''

    source ${pkgs'.common}/bin/common
    ${bashFktScript}

    echo_header "Running CI tests"
    setup_go_env

    if [[ -f "assets/test.env" ]]; then
      echo_hint "Loading test environment variables"
      set -a
      source "assets/test.env"
      set +a
    fi

    echo_section "Running tests"
    cd ${./../..} || (echo_fail "Failed to cd to application source" && exit 1)
    if ! CGO_CFLAGS="-Wno-format-security" ${pkgs'.go}/bin/go test -tags "runOnTask" ./...
    then
      echo_fail "Failed to run tests"
      exit 1
    fi

  ''