Skip to content

Commit

Permalink
Use cloned repository in GITHUB_WORKSPACE when available
Browse files Browse the repository at this point in the history
  • Loading branch information
xel1045 authored and two-pack committed Apr 9, 2021
1 parent 00f5f15 commit e4619d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ echo Set environment variables
set -xe
PLUGIN_REPO=https://github.com/${GITHUB_REPOSITORY}.git
WORKSPACE=/var/lib/redmine
PLUGIN_WORKSPACE=/var/lib/redmine-plugin
TRACE=--trace

echo Prepare database
Expand Down Expand Up @@ -34,8 +35,15 @@ google-chrome --version
chromedriver --version
RAILS_ENV=test bin/about

echo Install plguin
git clone -b ${PLUGIN_BRANCH} --depth 1 ${PLUGIN_REPO} ${WORKSPACE}/plugins/${PLUGIN_NAME}
echo Install plugin

# If the plugin's code is already cloned in PLUGIN_WORKSPACE, we'll use it. Otherwise, we'll clone a fresh copy.
if [ -d $PLUGIN_WORKSPACE/.git ]; then
ln -s $PLUGIN_WORKSPACE ${WORKSPACE}/plugins/${PLUGIN_NAME}
else
git clone -b ${PLUGIN_BRANCH} --depth 1 ${PLUGIN_REPO} ${WORKSPACE}/plugins/${PLUGIN_NAME}
fi

bundle install --path vendor/bundle
bundle exec rake redmine:plugins:migrate $TRACE

Expand Down
2 changes: 2 additions & 0 deletions lib/redmine-plugin-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PLUGIN_NAME=$1
REDMINE_VERSION=(${2/v/})
RUBY_VERSION=(${3/v/})
DATABASE=$4

if [ "${GITHUB_HEAD_REF}" = "" ]; then
PLUGIN_BRANCH=$(echo ${GITHUB_REF#refs/*/})
else
Expand All @@ -19,4 +20,5 @@ docker run -e "GITHUB_REPOSITORY=${GITHUB_REPOSITORY}" \
-e "PLUGIN_NAME=${PLUGIN_NAME}" \
-e "PLUGIN_BRANCH=${PLUGIN_BRANCH}" \
-e "DATABASE=${DATABASE}" \
-v "${GITHUB_WORKSPACE}:/var/lib/redmine-plugin" \
-t redmine-plugin-test

0 comments on commit e4619d8

Please sign in to comment.