Skip to content
Snippets Groups Projects
Verified Commit 42cefe9d authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: wip new pipeline

parent 1a3e6378
No related branches found
No related tags found
No related merge requests found
......@@ -20,14 +20,29 @@
pkgs' = import nixpkgs {
inherit system;
};
in {
packages = rec {
monster = let
commonPck = devFlakes.packages.${system}.common;
commonScript = commonPck + "/bin/common";
in
pkgs'.callPackage ./nix/packages/monster.nix {inherit commonScript;};
default = monster;
};
devShells = {
default = let
ciJobToken = builtins.getEnv "CI_JOB_TOKEN";
commonPck = devFlakes.packages.${system}.common;
commonScript = commonPck + "/bin/common";
versionPath = version.packages.${system}.version;
versionBin = versionPath + "/bin/version";
script-task = pkgs'.callPackage ./nix/scripts/go-task.nix {inherit commonScript versionBin;};
script-run-ci-tests = pkgs'.callPackage ./nix/scripts/run-ci-tests.nix {inherit commonScript;};
script-clean-up = pkgs'.callPackage ./nix/scripts/clean-up.nix {inherit commonScript;};
script-deploy = pkgs'.callPackage ./nix/scripts/deploy.nix {inherit commonScript versionBin updateChangelogScript;};
script-update-changelog = pkgs'.callPackage ./nix/scripts/update-changelog.nix {inherit commonScript versionBin;};
......@@ -35,9 +50,6 @@
rootPath = ./.;
# commonPck = devFlakes.packages.${system}.common;
commonScript = "/bin/common";
commonPackages = import ./nix/config/common-packages.nix {inherit pkgs';};
extendedPackages = [
......@@ -48,27 +60,12 @@
versionPath
];
gitlabPackages =
[
script-run-ci-tests
];
shellPackages = let
lib = pkgs'.lib;
in
commonPackages
++ extendedPackages
++ scriptPackages;
in {
packages = rec {
monster = pkgs'.callPackage ./nix/packages/monster.nix {inherit commonScript;};
default = monster;
};
devShells = {
default = let
ciJobToken = builtins.getEnv "CI_JOB_TOKEN";
in
pkgs'.mkShell {
nativeBuildInputs = shellPackages;
......@@ -107,9 +104,13 @@
gitlab = let
ciJobToken = builtins.getEnv "CI_JOB_TOKEN";
script-run-ci-tests = pkgs'.callPackage ./nix/scripts/run-ci-tests.nix {};
gitlabPackages = [
script-run-ci-tests
];
in
pkgs'.mkShell {
nativeBuildInputs = gitlabPackages;
shellHook = ''
......
{
pkgs,
lib,
commonScript,
...
}: let
gitlabToken = builtins.getEnv "GITLAB_TOKEN";
ciJobToken = builtins.getEnv "CI_JOB_TOKEN";
ciProjectDir = builtins.getEnv "CI_PROJECT_DIR";
in
pkgs.writeShellScriptBin "run-ci-tests" ''
source ${commonScript}
echo "run ci tests"
echo_section "run ci tests"
if [ -z "${gitlabToken}" ]; then
echo_fail "Error: CI_JOB_TOKEN variable is not set."
echo_hint "This script is intended to be run in GitLab CI."
if [ -n "${ciJobToken}" ]; then
echo "You are in a CI environment, this shell is not intended for CI, but for local development"
exit 1
fi
echo_hint "This script will run tests in the current working directory."
echo_hint "The command is executed in the current working directory and not in a nix derivation."
cd_working_dir
cd ${ciProjectDir} || exit 1
echo "This script will run tests in the project working directory: ${ciProjectDir}"
echo "The command is executed in the current working directory and not in a nix derivation."
TEST_PATH="./test"
TEST_CASES_PATH="''${TEST_PATH}/cases/"
TEST_CASES_PATH="${ciProjectDir}/test/cases/"
if ! ${pkgs.nodePackages.mocha}/bin/mocha --colors --jobs 1 --bail --recursive $TEST_CASES_PATH
then
echo_fail "Tests failed, check your JS!"
echo "Tests failed, check your JS!"
exit 1
fi
echo_ok "Tests passed!"
echo "Tests passed!"
''
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment