Skip to content

Commit 4c8b3af

Browse files
Merge pull request #77 from opencb/TASK-4163
TASK-4163 - Modify build workflow to check the same branch name of dependency
2 parents d4e60b7 + 755d18f commit 4c8b3af

File tree

5 files changed

+72
-32
lines changed

5 files changed

+72
-32
lines changed

.github/workflows/build-java-app-workflow.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,22 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323
with:
24-
fetch-depth: '10'
24+
fetch-depth: '10'
2525
- name: Set up JDK 8
2626
uses: actions/setup-java@v3
2727
with:
28-
distribution: 'temurin'
29-
java-version: '8'
30-
cache: 'maven'
28+
distribution: 'temurin'
29+
java-version: '8'
30+
cache: 'maven'
31+
- name: Install dependencies branches
32+
run: |
33+
if [ -f "./.github/workflows/scripts/get_same_branch.sh" ]; then
34+
chmod +x ./.github/workflows/scripts/get_same_branch.sh
35+
./.github/workflows/scripts/get_same_branch.sh ${{ github.ref_name }}
36+
fi
3137
- name: Maven Build (skip tests)
3238
run: mvn -T 2 clean install -DskipTests ${{ inputs.maven_opts }}
3339
- uses: actions/upload-artifact@v3
34-
# id: github.refName === 'cellbase' || github.refName === 'opencga'
3540
with:
3641
name: build-folder
3742
path: build
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
BRANCH_NAME=$1
4+
5+
if [[ -z $BRANCH_NAME ]]; then
6+
echo "The first parameter is mandatory and must be a valid branch name."
7+
exit 1
8+
fi
9+
10+
if [[ $BRANCH_NAME != "TASK-"* ]]; then
11+
echo "No need to check dependencies."
12+
exit 0
13+
fi
14+
15+
function install(){
16+
local REPO=$1
17+
cd /home/runner/work/ || exit 2
18+
#git clone [email protected]:opencb/"$REPO".git
19+
git clone https://github.com/opencb/"$REPO".git
20+
cd "$REPO" || exit 2
21+
git checkout "$BRANCH_NAME"
22+
CURRENT=$(git branch --show-current)
23+
echo "Current branch name $CURRENT"
24+
if [[ "$CURRENT" == "$BRANCH_NAME" ]]; then
25+
echo "Branch name $BRANCH_NAME already exists."
26+
mvn clean install -DskipTests
27+
else
28+
echo "$CURRENT Branch is NOT EQUALS $BRANCH_NAME "
29+
fi
30+
}
31+
32+
PWD=$(pwd)
33+
echo "The absolute exec path is $PWD"
34+
35+
if [[ "$PWD" != *"java-common-libs"* ]]; then
36+
## biodata
37+
if [[ "$PWD" == *"biodata"* ]]; then
38+
echo "It's biodata."
39+
install "java-common-libs"
40+
fi
41+
## cellbase
42+
if [[ "$PWD" == *"cellbase"* ]]; then
43+
echo "It's cellbase."
44+
install "java-common-libs"
45+
install "biodata"
46+
fi
47+
## opencga
48+
if [[ "$PWD" == *"opencga"* ]]; then
49+
echo "It's opencga."
50+
install "java-common-libs"
51+
install "biodata"
52+
install "cellbase"
53+
fi
54+
fi

.github/workflows/task.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,3 @@ jobs:
1616
with:
1717
report_context: development
1818
report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }}
19-
20-
deploy-maven:
21-
name: Deploy in maven only for renamed versions
22-
uses: ./.github/workflows/deploy-maven-repository-workflow.yml
23-
needs: [ build, test ]
24-
if: contains( needs.build.outputs.version ,'TASK')
25-
secrets: inherit
26-
27-
#The following jobs are to see that the previous 'if' doesn't fail and that the maven deploy is executed because it is true
28-
snapshot-version:
29-
name: Check SNAPSHOT version
30-
needs: [ build, test ]
31-
if: contains(needs.build.outputs.version ,'SNAPSHOT')
32-
runs-on: ubuntu-22.04
33-
steps:
34-
- name: test-version-from-check
35-
run: echo "Project version is " ${{ needs.build.outputs.version }}
36-
37-
task-version:
38-
name: Check TASK version
39-
needs: [ build, test ]
40-
if: contains(needs.build.outputs.version ,'TASK')
41-
runs-on: ubuntu-22.04
42-
steps:
43-
- name: test-version-from-check
44-
run: echo "Project version is " ${{ needs.build.outputs.version }}
45-

.github/workflows/test-analysis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Build and test the project
2+
23
on:
34
workflow_call:
45
secrets:
@@ -19,8 +20,10 @@ on:
1920
report_context:
2021
type: string
2122
required: true
23+
2224
env:
2325
xb_version: "1.7.0"
26+
2427
jobs:
2528
test:
2629
name: Test and push Sonar analysis
@@ -50,6 +53,7 @@ jobs:
5053
with:
5154
name: workdir
5255
path: "**/target/site"
56+
5357
publish-test:
5458
name: Publish test results
5559
runs-on: ubuntu-22.04

commons-lib/src/main/java/org/opencb/commons/utils/PrintUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ public static void print(String message) {
2121
System.out.print(message);
2222
}
2323

24+
public static void printSpace() {
25+
System.out.print(" ");
26+
}
27+
2428
public static void print(String message, Color color) {
2529
System.out.print(format(message, color));
2630
}

0 commit comments

Comments
 (0)