Skip to content

Commit

Permalink
Merge pull request #2506 from opencb/TASK-6879-dev
Browse files Browse the repository at this point in the history
TASK-6879 - Adapt GitHub Actions, CICD workflows and release scripts to new SDLC
  • Loading branch information
juanfeSanahuja authored Sep 19, 2024
2 parents 6b8bf32 + a30b6f3 commit 1f818cb
Show file tree
Hide file tree
Showing 29 changed files with 114 additions and 42 deletions.
40 changes: 31 additions & 9 deletions .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
name: Pull request approve workflow
run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}'

on:
pull_request_review:
types: [submitted]
types: [ submitted ]

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

test:
name: "Run all tests before merging, ie. short, medium and long tests."
uses: ./.github/workflows/test-analysis.yml
needs: build
name: "Run all tests before merging"
needs: calculate-xetabase-branch
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
with:
test_profile: runShortTests,runMediumTests
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
task: ${{ github.event.pull_request.head.ref }}
secrets: inherit

50 changes: 50 additions & 0 deletions .github/workflows/scripts/get-xetabase-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# Function to calculate the corresponding branch of Xetabase project
get_xetabase_branch() {
# Input parameter (branch name)
input_branch="$1"

# If the branch begins with 'TASK' and exists in the opencga-enterprise repository, I return it
if [[ $input_branch == TASK* ]]; then
if [ "$(git ls-remote "https://$ZETTA_REPO_ACCESS_TOKEN@github.com/zetta-genomics/opencga-enterprise.git" "$input_branch" )" ] ; then
echo $input_branch;
return 0;
fi
fi

# Check if the branch name is "develop" in that case return the same branch name
if [[ "$input_branch" == "develop" ]]; then
echo "develop"
return 0
fi

# Check if the branch name starts with "release-" and follows the patterns "release-a.x.x" or "release-a.b.x"
if [[ "$input_branch" =~ ^release-([0-9]+)\.x\.x$ ]] || [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.x$ ]]; then
# Extract the MAJOR part of the branch name
MAJOR=${BASH_REMATCH[1]}
# Calculate the XETABASE_MAJOR by subtracting 1 from MAJOR of opencga
XETABASE_MAJOR=$((MAJOR - 1))
# Check if the XETABASE_MAJOR is negative
if (( XETABASE_MAJOR < 0 )); then
echo "Error: 'MAJOR' digit after subtraction results in a negative number."
return 1
fi
# Construct and echo the new branch name
echo "release-$XETABASE_MAJOR.${input_branch#release-$MAJOR.}"
return 0
fi

# If the branch name does not match any of the expected patterns
echo "Error: The branch name is not correct."
return 1
}

# Check if the script receives exactly one argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <branch-name>"
exit 1
fi

# Call the function with the input branch name
get_xetabase_branch "$1"
2 changes: 1 addition & 1 deletion opencga-analysis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-catalog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-clinical/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion opencga-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-master/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>opencga</artifactId>
<groupId>org.opencb.opencga</groupId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-storage/opencga-storage-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-storage/opencga-storage-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>opencga-storage</artifactId>
<groupId>org.opencb.opencga</groupId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-storage/opencga-storage-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-compat</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-compat</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-compat</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-compat</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-lib</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-lib</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-lib</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop-lib</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage-hadoop</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-storage/opencga-storage-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-storage/opencga-storage-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga-storage</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opencga-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>org.opencb.opencga</groupId>
<artifactId>opencga</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>OpenCGA</name>
Expand All @@ -44,12 +44,12 @@

<properties>

<pyopencga.version>3.3.0_dev</pyopencga.version>
<opencgar.version>3.3.0_dev</opencgar.version>
<cellbase.version>6.3.0-SNAPSHOT</cellbase.version>
<biodata.version>3.3.0-SNAPSHOT</biodata.version>
<java-common-libs.version>5.3.0-SNAPSHOT</java-common-libs.version>
<iva.version>3.3.0-SNAPSHOT</iva.version>
<pyopencga.version>4.0.0_dev</pyopencga.version>
<opencgar.version>4.0.0_dev</opencgar.version>
<cellbase.version>7.0.0-SNAPSHOT</cellbase.version>
<biodata.version>4.0.0-SNAPSHOT</biodata.version>
<java-common-libs.version>6.0.0-SNAPSHOT</java-common-libs.version>
<iva.version>4.0.0-SNAPSHOT</iva.version>
<oskar.version>0.2.0</oskar.version>

<jackson.version>2.14.3</jackson.version>
Expand Down

0 comments on commit 1f818cb

Please sign in to comment.