Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monster
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Javascript
Monster
Commits
42cefe9d
Verified
Commit
42cefe9d
authored
11 months ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: wip new pipeline
parent
1a3e6378
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flake.nix
+63
-62
63 additions, 62 deletions
flake.nix
nix/scripts/run-ci-tests.nix
+13
-16
13 additions, 16 deletions
nix/scripts/run-ci-tests.nix
with
76 additions
and
78 deletions
flake.nix
+
63
−
62
View file @
42cefe9d
...
...
@@ -20,55 +20,52 @@
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
;};
versionPath
=
version
.
packages
.
${
system
}
.
version
;
versionBin
=
versionPath
+
"/bin/version"
;
script-task
=
pkgs
'
.
callPackage
./nix/scripts/go-task.nix
{
inherit
commonScript
versionBin
;};
default
=
monster
;
};
script-run-ci-tests
=
pkgs
'
.
callPackage
./nix/scripts/run-ci-tests.nix
{
inherit
commonScript
;};
devShells
=
{
default
=
let
ciJobToken
=
builtins
.
getEnv
"CI_JOB_TOKEN"
;
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
;};
updateChangelogScript
=
script-update-changelog
+
"/bin/update-changelog"
;
commonPck
=
devFlakes
.
packages
.
${
system
}
.
common
;
commonScript
=
commonPck
+
"/bin/common"
;
rootPath
=
./.
;
versionPath
=
version
.
packages
.
${
system
}
.
version
;
versionBin
=
versionPath
+
"/bin/version"
;
# commonPck = devFlakes.packages.${system}.common;
commonScript
=
"/bin/common"
;
script-task
=
pkgs
'
.
callPackage
./nix/scripts/go-task.nix
{
inherit
commonScript
versionBin
;};
commonPackages
=
import
./nix/config/common-packages.nix
{
inherit
pkgs
'
;};
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
;};
updateChangelogScript
=
script-update-changelog
+
"/bin/update-changelog"
;
extendedPackages
=
[
script-task
];
rootPath
=
./.
;
scriptPackages
=
[
versionPath
];
commonPackages
=
import
./nix/config/common-packages.nix
{
inherit
pkgs
'
;};
gitlabPackages
=
[
script-run-ci-tests
];
extendedPackages
=
[
script-task
];
shellPackages
=
let
lib
=
pkgs
'
.
lib
;
in
commonPackages
++
extendedPackages
++
scriptPackages
;
in
{
packages
=
rec
{
monster
=
pkgs
'
.
callPackage
./nix/packages/monster.nix
{
inherit
commonScript
;};
scriptPackages
=
[
versionPath
];
default
=
monster
;
}
;
devShells
=
{
default
=
let
ciJobToken
=
builtins
.
getEnv
"CI_JOB_TOKEN"
;
shellPackages
=
let
lib
=
pkgs
'
.
lib
;
in
commonPackages
++
extendedPackages
++
scriptPackages
;
in
pkgs
'
.
mkShell
{
nativeBuildInputs
=
shellPackages
;
...
...
@@ -107,33 +104,37 @@
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
;
nativeBuildInputs
=
gitlabPackages
;
shellHook
=
''
if [ -z "
''$
{CI_JOB_TOKEN}" ]; then
exit 1
fi
cd
''$
{CI_PROJECT_DIR} || exit 1
#
${
pkgs
'
.
git
}
/bin/git config --global user.email "
''$
{GITLAB_USER_EMAIL}"
#
${
pkgs
'
.
git
}
/bin/git config --global user.name "
''$
{GITLAB_USER_NAME}"
#
${
pkgs
'
.
git
}
/bin/git config --global credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=
''$
{CI_JOB_TOKEN}"; }; f'
#
${
pkgs
'
.
git
}
/bin/git config --global pull.rebase true
#
${
pkgs
'
.
git
}
/bin/git config --global http.sslVerify "false"
#
#
${
pkgs
'
.
git
}
/bin/git remote set-url origin "
''$
{CI_REPOSITORY_URL}"
#
#
${
pkgs
'
.
git
}
/bin/git fetch --all --tags --unshallow
#
${
pkgs
'
.
git
}
/bin/git reset --hard origin/master
#
${
pkgs
'
.
git
}
/bin/git clean -fd
#
${
pkgs
'
.
git
}
/bin/git checkout $CI_COMMIT_REF_NAME
#
${
pkgs
'
.
git
}
/bin/git pull origin $CI_COMMIT_REF_NAME
if [ -z "
''$
{CI_JOB_TOKEN}" ]; then
exit 1
fi
cd
''$
{CI_PROJECT_DIR} || exit 1
#
${
pkgs
'
.
git
}
/bin/git config --global user.email "
''$
{GITLAB_USER_EMAIL}"
#
${
pkgs
'
.
git
}
/bin/git config --global user.name "
''$
{GITLAB_USER_NAME}"
#
${
pkgs
'
.
git
}
/bin/git config --global credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=
''$
{CI_JOB_TOKEN}"; }; f'
#
${
pkgs
'
.
git
}
/bin/git config --global pull.rebase true
#
${
pkgs
'
.
git
}
/bin/git config --global http.sslVerify "false"
#
#
${
pkgs
'
.
git
}
/bin/git remote set-url origin "
''$
{CI_REPOSITORY_URL}"
#
#
${
pkgs
'
.
git
}
/bin/git fetch --all --tags --unshallow
#
${
pkgs
'
.
git
}
/bin/git reset --hard origin/master
#
${
pkgs
'
.
git
}
/bin/git clean -fd
#
${
pkgs
'
.
git
}
/bin/git checkout $CI_COMMIT_REF_NAME
#
${
pkgs
'
.
git
}
/bin/git pull origin $CI_COMMIT_REF_NAME
...
...
This diff is collapsed.
Click to expand it.
nix/scripts/run-ci-tests.nix
+
13
−
16
View file @
42cefe9d
{
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."
exit 1
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!"
''
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment