Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add CI benchmark script

Cyril Rohrff91def68078
diff --git a/docker/ci/benchmark.sh b/docker/ci/benchmark.sh
new file mode 100755
index 00000000000..8b27aa23bd4
--- /dev/null
+++ b/docker/ci/benchmark.sh
@@ -0,0 +1,20 @@
+#!/bin/bash -ex
+# This script can be used to quickly launch a full test run on any ubuntu-based VM
+#
+# cat benchmark.sh | ssh root@VM bash -s BRANCH -ex -
+
+BRANCH="${1:=dev}"
+
+sudo install -m 0755 -d /etc/apt/keyrings
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
+sudo chmod a+r /etc/apt/keyrings/docker.gpg
+echo \
+ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
+ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
+sudo apt-get update -qq
+sudo apt-get install -y git docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
+
+useradd -m -d /home/dev -s /bin/bash -G docker dev
+su - dev -c "git clone https://github.com/opf/openproject --depth=1 --branch=$BRANCH"
+su - dev -c 'cd openproject && time docker compose -f docker-compose.ci.yml run --build ci setup-tests run-units run-features'
\ No newline at end of file
diff --git a/docker/ci/entrypoint.sh b/docker/ci/entrypoint.sh
index ecd81a2406f..ea43547a95a 100755
--- a/docker/ci/entrypoint.sh
+++ b/docker/ci/entrypoint.sh
@@ -26,13 +26,13 @@ if [ $(id -u) -eq 0 ]; then
chown $USER:$USER /home/$USER/openproject/frontend/node_modules
chown $USER:$USER /home/$USER/openproject/frontend/.angular
chown $USER:$USER /home/$USER/openproject/tmp
- chown $USER:$USER /cache
+ chown -R $USER:$USER /cache
fi
execute() {
- echo "[execute] $@"
- local ret=0
+ BANNER=${BANNER:="[execute]"}
+ echo "$BANNER $@" >&2
if [ $(id -u) -eq 0 ]; then
su $USER -c "$@"
else
@@ -41,19 +41,19 @@ execute() {
}
execute_quiet() {
- local ret=0
- echo "[execute_quiet] $@"
- if ! execute "$@" >/tmp/op-output.log ; then
- ret=$?
+ if ! BANNER="[execute_quiet]" execute "$@" >/tmp/op-output.log ; then
cat /tmp/op-output.log
+ return 1
+ else
+ return 0
fi
- return $ret
}
cleanup() {
+ echo "CLEANUP"
rm -rf tmp/cache/parallel*
rm -f /tmp/op-output.log
- [ -d tmp/features ] && mv tmp/features spec/
+ if [ -d tmp/features ]; then mv tmp/features spec/ ; fi
}
trap cleanup INT TERM EXIT
@@ -81,22 +81,22 @@ fi
if [ "$1" == "run-units" ]; then
shift
- execute_quiet "cp -f /cache/turbo_runtime_units.log spec/support/"
+ execute_quiet "cp -f /cache/turbo_runtime_units.log spec/support/ || true"
# turbo_tests cannot yet exclude specific directories, so copying spec/features elsewhere (temporarily)
execute_quiet "mv spec/features tmp/"
execute_quiet "time bundle exec rails zeitwerk:check"
execute "time bundle exec turbo_tests -n $JOBS --runtime-log spec/support/turbo_runtime_units.log spec"
- execute_quiet "cp -f spec/support/turbo_runtime_units.log /cache/"
+ execute_quiet "cp -f spec/support/turbo_runtime_units.log /cache/ || true"
cleanup
fi
if [ "$1" == "run-features" ]; then
shift
- execute_quiet "cp -f /cache/turbo_runtime_features.log spec/support/"
+ execute_quiet "cp -f /cache/turbo_runtime_features.log spec/support/ || true"
execute_quiet "time bundle exec rails assets:precompile"
execute_quiet "cp -rp config/frontend_assets.manifest.json public/assets/frontend_assets.manifest.json"
execute "time bundle exec turbo_tests -n $JOBS --runtime-log spec/support/turbo_runtime_features.log spec/features"
- execute_quiet "cp -f spec/support/turbo_runtime_features.log /cache/"
+ execute_quiet "cp -f spec/support/turbo_runtime_features.log /cache/ || true"
cleanup
fi