Skip to content

Commit

Permalink
Merge from master (#137)
Browse files Browse the repository at this point in the history
* Update build.yml

* Reverted back to original build.sh

* Added missing file (possibly forgot to commmit/push it) (#136)
  • Loading branch information
GuilhemSempere authored Jul 2, 2024
1 parent 03759c7 commit 0062dcf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

steps:
- name: Set up Java
uses: actions/setup-java@v3.13.0
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
Expand Down
96 changes: 23 additions & 73 deletions misc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,78 +10,28 @@

set -e

# Function to print the current directory for debugging
print_current_dir() {
echo "Current directory: $(pwd)"
}

# Clone the Gigwa2 repository
echo "Cloning Gigwa2 repository"
git clone https://github.com/SouthGreenPlatform/Gigwa2.git

cd ./Gigwa2
print_current_dir

# Get the latest tag
echo "Fetching tags"
git fetch --tags

latest_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1))
echo "Latest tag: $latest_tag"

# Check if the latest tag is STAGING
if [ "$latest_tag" == "STAGING" ]; then
previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
echo "Latest tag is STAGING, using previous tag: $previous_tag"
git checkout $previous_tag
else
echo "Using latest tag: $latest_tag"
git checkout $latest_tag
fi

# Get the list of dependencies
echo "Running Maven dependency tree"
dependencies=$(mvn dependency:tree | grep -v WARNING | grep "fr\.cirad.*\-RELEASE" | awk '
{
if (match($0, /fr\.cirad:[^:]+:(jar|war):[^:]+/)) {
split(substr($0, RSTART, RLENGTH), arr, ":");
app_name = arr[2];
release_name = arr[4];
print app_name ":" release_name;
}
}')

echo "Dependencies found: $dependencies"

# Convert the list of dependencies into an array
subProjects=()
while IFS= read -r line; do
subProjects+=("$line")
done <<< "$dependencies"

cd ..
print_current_dir

# Clone the sub-projects
echo "Cloning sub-projects"
for subProject in "${subProjects[@]}"; do
app_name=$(echo "$subProject" | awk -F':' '{print $1}')
release_name=$(echo "$subProject" | awk -F':' '{print $2}')

echo "Cloning $app_name with tag $release_name"

if [ "$app_name" == "Gigwa2" ]; then
continue
fi

git clone -b $release_name --single-branch "https://github.com/GuilhemSempere/$app_name.git"
m2repo=$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)

declare -a subProjects=(GuilhemSempere/GenotypeFileManipulation GuilhemSempere/Mgdb2BrapiModel GuilhemSempere/Mgdb2 GuilhemSempere/Mgdb2Export GuilhemSempere/role_manager GuilhemSempere/Mgdb2BrapiImpl GuilhemSempere/Mgdb2BrapiV2Impl GuilhemSempere/Gigwa2ServiceInterface GuilhemSempere/Gigwa2ServiceImpl SouthGreenPlatform/Gigwa2)

for subProject in ${subProjects[*]} ;
do
echo
subProjectName="${subProject##*/}"
rm -rf $subProjectName
git clone -b master --single-branch https://github.com/$subProject.git

cd $subProjectName
tag=$(grep -m 1 project\\\.version pom.xml | sed -n 's/.*<project\.version>\(.*\)<\/project\.version>.*/\1/p')
echo Switching to tag $tag in project $subProjectName
git -c advice.detachedHead=false checkout $tag
artifactId=$(grep -m 1 artifactId pom.xml | sed -n 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/p')

echo Cleaning $subProjectName folder in local m2 repository
rm -rf $m2repo/fr/cirad/$artifactId
cd ..
done

cd ./Gigwa2/bom/
print_current_dir

echo "Running Maven install"
mvn install "$@"
echo "Maven install completed"

cd Gigwa2/bom/
mvn install $@
cd ../..
print_current_dir

0 comments on commit 0062dcf

Please sign in to comment.