Skip to content

Commit 1f818cb

Browse files
Merge pull request #2506 from opencb/TASK-6879-dev
TASK-6879 - Adapt GitHub Actions, CICD workflows and release scripts to new SDLC
2 parents 6b8bf32 + a30b6f3 commit 1f818cb

File tree

29 files changed

+114
-42
lines changed

29 files changed

+114
-42
lines changed
Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
11
name: Pull request approve workflow
2+
run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}'
23

34
on:
45
pull_request_review:
5-
types: [submitted]
6+
types: [ submitted ]
67

78
jobs:
8-
build:
9-
uses: opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop
10-
with:
11-
maven_opts: -Phdp3.1,RClient -Dopencga.war.name=opencga -Dcheckstyle.skip
9+
calculate-xetabase-branch:
10+
name: Calculate Xetabase branch
11+
runs-on: ubuntu-22.04
12+
outputs:
13+
xetabase_branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }}
14+
steps:
15+
- name: Clone project
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: '10'
19+
## This is important to avoid the error in the next step: "fatal: repository 'https://github.com/zetta-genomics/opencga-enterprise.git/' not found"
20+
persist-credentials: false
21+
- id: get_xetabase_branch
22+
name: "Get current branch for Xetabase from target branch"
23+
run: |
24+
chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
25+
echo "github.event.pull_request.base.ref: ${{ github.event.pull_request.base.ref }}"
26+
echo "github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}"
27+
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ github.event.pull_request.base.ref }})
28+
echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY}
29+
echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT
30+
env:
31+
ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}
1232

1333
test:
14-
name: "Run all tests before merging, ie. short, medium and long tests."
15-
uses: ./.github/workflows/test-analysis.yml
16-
needs: build
34+
name: "Run all tests before merging"
35+
needs: calculate-xetabase-branch
36+
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
1737
with:
18-
test_profile: runShortTests,runMediumTests
38+
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
39+
task: ${{ github.event.pull_request.head.ref }}
1940
secrets: inherit
41+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# Function to calculate the corresponding branch of Xetabase project
4+
get_xetabase_branch() {
5+
# Input parameter (branch name)
6+
input_branch="$1"
7+
8+
# If the branch begins with 'TASK' and exists in the opencga-enterprise repository, I return it
9+
if [[ $input_branch == TASK* ]]; then
10+
if [ "$(git ls-remote "https://$ZETTA_REPO_ACCESS_TOKEN@github.com/zetta-genomics/opencga-enterprise.git" "$input_branch" )" ] ; then
11+
echo $input_branch;
12+
return 0;
13+
fi
14+
fi
15+
16+
# Check if the branch name is "develop" in that case return the same branch name
17+
if [[ "$input_branch" == "develop" ]]; then
18+
echo "develop"
19+
return 0
20+
fi
21+
22+
# Check if the branch name starts with "release-" and follows the patterns "release-a.x.x" or "release-a.b.x"
23+
if [[ "$input_branch" =~ ^release-([0-9]+)\.x\.x$ ]] || [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.x$ ]]; then
24+
# Extract the MAJOR part of the branch name
25+
MAJOR=${BASH_REMATCH[1]}
26+
# Calculate the XETABASE_MAJOR by subtracting 1 from MAJOR of opencga
27+
XETABASE_MAJOR=$((MAJOR - 1))
28+
# Check if the XETABASE_MAJOR is negative
29+
if (( XETABASE_MAJOR < 0 )); then
30+
echo "Error: 'MAJOR' digit after subtraction results in a negative number."
31+
return 1
32+
fi
33+
# Construct and echo the new branch name
34+
echo "release-$XETABASE_MAJOR.${input_branch#release-$MAJOR.}"
35+
return 0
36+
fi
37+
38+
# If the branch name does not match any of the expected patterns
39+
echo "Error: The branch name is not correct."
40+
return 1
41+
}
42+
43+
# Check if the script receives exactly one argument
44+
if [ "$#" -ne 1 ]; then
45+
echo "Usage: $0 <branch-name>"
46+
exit 1
47+
fi
48+
49+
# Call the function with the input branch name
50+
get_xetabase_branch "$1"

opencga-analysis/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.opencb.opencga</groupId>
2424
<artifactId>opencga</artifactId>
25-
<version>3.3.0-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

opencga-app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.opencb.opencga</groupId>
2424
<artifactId>opencga</artifactId>
25-
<version>3.3.0-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

opencga-catalog/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>org.opencb.opencga</groupId>
2525
<artifactId>opencga</artifactId>
26-
<version>3.3.0-SNAPSHOT</version>
26+
<version>4.0.0-SNAPSHOT</version>
2727
<relativePath>../pom.xml</relativePath>
2828
</parent>
2929

opencga-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.opencb.opencga</groupId>
2424
<artifactId>opencga</artifactId>
25-
<version>3.3.0-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

opencga-clinical/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.opencb.opencga</groupId>
77
<artifactId>opencga</artifactId>
8-
<version>3.3.0-SNAPSHOT</version>
8+
<version>4.0.0-SNAPSHOT</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<modelVersion>4.0.0</modelVersion>

opencga-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.opencb.opencga</groupId>
2424
<artifactId>opencga</artifactId>
25-
<version>3.3.0-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

opencga-master/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<artifactId>opencga</artifactId>
2424
<groupId>org.opencb.opencga</groupId>
25-
<version>3.3.0-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

opencga-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.opencb.opencga</groupId>
2424
<artifactId>opencga</artifactId>
25-
<version>3.3.0-SNAPSHOT</version>
25+
<version>4.0.0-SNAPSHOT</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

0 commit comments

Comments
 (0)