Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
719e0705
Commit
719e0705
authored
8 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Refactor ci script [ci all]]
parent
6e8e3d83
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/ci
+83
-71
83 additions, 71 deletions
bin/ci
with
83 additions
and
71 deletions
bin/ci
+
83
−
71
View file @
719e0705
...
...
@@ -3,7 +3,56 @@
# this ensures any failures along the way result in a CI failure
set
-eu
export
CIRCLE_COMMIT_MESSAGE
=
"
$(
git log
--format
=
oneline
-n
1
$CIRCLE_SHA1
)
"
node-0
()
{
is_enabled
"drivers"
&&
export
ENGINES
=
"h2,mongo,mysql,bigquery"
||
export
ENGINES
=
"h2"
if
is_engine_enabled
"mongo"
;
then
run_step install-mongodb
;
fi
run_step lein test2junit
}
node-1
()
{
is_enabled
"drivers"
&&
export
ENGINES
=
"h2,sqlserver,oracle"
||
export
ENGINES
=
"h2"
if
is_engine_enabled
"mongo"
;
then
run_step install-mongodb
;
fi
MB_DB_TYPE
=
postgres
MB_DB_DBNAME
=
circle_test
MB_DB_PORT
=
5432
MB_DB_USER
=
ubuntu
MB_DB_HOST
=
localhost
\
run_step lein test2junit
}
node-2
()
{
is_enabled
"drivers"
&&
export
ENGINES
=
"h2,postgres,sqlite,crate"
||
export
ENGINES
=
"h2"
if
is_engine_enabled
"crate"
;
then
run_step install-crate
fi
MB_DB_TYPE
=
mysql
MB_DB_DBNAME
=
circle_test
MB_DB_PORT
=
3306
MB_DB_USER
=
ubuntu
MB_DB_HOST
=
localhost
\
run_step lein test2junit
}
node-3
()
{
is_enabled
"drivers"
&&
export
ENGINES
=
"h2,redshift,druid"
||
export
ENGINES
=
"h2"
run_step lein test2junit
}
node-4
()
{
run_step lein eastwood
run_step lein bikeshed
run_step lein docstring-checker
run_step ./bin/reflection-linter
}
node-5
()
{
run_step npm run lint
run_step npm run
test
run_step npm run flow
}
node-6
()
{
if
is_enabled
"jar"
||
is_enabled
"e2e"
||
is_enabled
"screenshots"
;
then
run_step ./bin/build version frontend sample-dataset uberjar
fi
if
is_enabled
"e2e"
||
is_enabled
"compare_screenshots"
;
then
USE_SAUCE
=
true
\
run_step npm run test-e2e
fi
if
is_enabled
"screenshots"
;
then
run_step node_modules/.bin/babel-node ./bin/compare-screenshots
fi
}
install-crate
()
{
sudo
add-apt-repository ppa:crate/stable
-y
...
...
@@ -23,32 +72,18 @@ install-mongodb() {
sudo
service mongod restart
}
stop-sauce-connect
()
{
if
[
$(
uname
)
==
"Darwin"
]
;
then
killall sc
else
killall
--wait
sc
fi
}
is_master
()
{
[[
"
$CIRCLE_BRANCH
"
==
"master"
]]
}
is_enabled
()
{
is_master
||
[[
"
$CIRCLE_COMMIT_MESSAGE
"
==
*
"[ci
$1
]"
*
]]
||
[[
"
$CIRCLE_COMMIT_MESSAGE
"
==
*
"[ci all]"
*
]]
[[
"
$CIRCLE_BRANCH
"
==
"master"
]]
||
[[
"
$CIRCLE_COMMIT_MESSAGE
"
==
*
"[ci
$1
]"
*
]]
||
[[
"
$CIRCLE_COMMIT_MESSAGE
"
==
*
"[ci all]"
*
]]
}
is_engine_enabled
()
{
[[
"
$ENGINES
"
==
*
"
$1
"
*
]]
}
# print a summary on exit
results
=
""
summary
()
{
echo
-e
"========================================"
echo
-en
"
$results
"
echo
-e
"========================================"
}
trap
summary EXIT
summary
=
""
# records the time and exit code of each step
run_step
()
{
...
...
@@ -56,58 +91,35 @@ run_step() {
start
=
$(
date
+%s
)
"
$@
"
||
status
=
$?
elapsed
=
$(
expr
$(
date
+%s
)
-
$start
||
true
)
results
=
"
${
results
}
status=
$status
time=
$elapsed
command=
$@
\n
"
summary
=
"
${
summary
}
status=
$status
time=
$elapsed
command=
$@
\n
"
return
$status
}
# default engines
export
ENGINES
=
"h2"
summary
()
{
echo
-e
"========================================"
echo
-en
"
$summary
"
echo
-e
"========================================"
}
trap
summary EXIT
if
[
-z
${
CIRCLE_SHA1
+x
}
]
;
then
export
CIRCLE_SHA1
=
"
$(
git rev-parse HEAD
)
"
fi
if
[
-z
${
CIRCLE_BRANCH
+x
}
]
;
then
export
CIRCLE_BRANCH
=
"
$(
git rev-parse
--abbrev-ref
HEAD
)
"
fi
export
CIRCLE_COMMIT_MESSAGE
=
"
$(
git log
--format
=
oneline
-n
1
$CIRCLE_SHA1
)
"
case
$CIRCLE_NODE_INDEX
in
0
)
if
is_enabled
"drivers"
;
then
export
ENGINES
=
"h2,mongo,mysql,bigquery"
;
fi
if
is_engine_enabled
"mongo"
;
then
run_step install-mongodb
;
fi
run_step lein
test
;;
1
)
if
is_enabled
"drivers"
;
then
export
ENGINES
=
"h2,sqlserver,oracle"
;
fi
MB_DB_TYPE
=
postgres
MB_DB_DBNAME
=
circle_test
MB_DB_PORT
=
5432
MB_DB_USER
=
ubuntu
MB_DB_HOST
=
localhost
\
run_step lein
test
;;
2
)
if
is_enabled
"drivers"
;
then
export
ENGINES
=
"h2,postgres,sqlite,crate"
;
fi
if
is_engine_enabled
"crate"
;
then
run_step install-crate
;
fi
MB_DB_TYPE
=
mysql
MB_DB_DBNAME
=
circle_test
MB_DB_PORT
=
3306
MB_DB_USER
=
ubuntu
MB_DB_HOST
=
localhost
\
run_step lein
test
;;
3
)
if
is_enabled
"drivers"
;
then
export
ENGINES
=
"h2,redshift,druid"
;
fi
run_step lein
test
;;
4
)
run_step lein eastwood
run_step lein bikeshed
run_step lein docstring-checker
run_step ./bin/reflection-linter
;;
5
)
run_step npm run lint
run_step npm run
test
run_step npm run flow
;;
6
)
run_step ./bin/build version frontend sample-dataset uberjar
if
is_enabled
"e2e"
||
is_enabled
"compare_screenshots"
;
then
USE_SAUCE
=
true
\
run_step npm run test-e2e
fi
if
is_enabled
"compare_screenshots"
;
then
run_step node_modules/.bin/babel-node ./bin/compare-screenshots
fi
;;
esac
if
[
-z
${
CIRCLE_NODE_INDEX
+x
}
]
;
then
# If CIRCLE_NODE_INDEX isn't set, read node numbers from the args
# Useful for testing locally.
for
i
in
"
$@
"
;
do
node-
$i
done
else
# Normal mode on CircleCI
node-
$CIRCLE_NODE_INDEX
fi
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