Skip to content

Commit

Permalink
Merge branch 'develop' into TASK-6780
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfeSanahuja committed Oct 3, 2024
2 parents b41110c + 2122af0 commit b6cf47a
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
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 }}"
echo "secrets.ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}"
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ 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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-github-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
name: ${{ inputs.artifact }}
- name: GitHub Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ github.ref_name }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/scripts/get-xetabase-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ get_xetabase_branch() {
return 0
fi

# Check if the branch name starts with "release-" and follows the patterns "release-a.b.x" or "release-a.b.c.x"
if [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.x$ ]] || [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.([0-9]+)\.x$ ]]; then
# 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 3 from MAJOR
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/test-xetabase-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ jobs:
path: opencga-enterprise
fetch-depth: "10"
- id: get_opencga_branch
name: Get OpenCGA branch from 'pom.xml' property
name: Get OpenCGA branch
run: |
pwd
ls -lrtha
ls -lrtha ./opencga-enterprise
chmod +x ./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh
opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh)
# If the task exists in the opencga repository, this is the branch to be tested
if [[ "${{ inputs.task }}" == TASK* ]]; then
if [ "$(git ls-remote "https://github.com/opencb/opencga.git" "${{ inputs.task }}")" ]; then
opencga_branch="${{ inputs.task }}";
fi
else
chmod +x ./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh
opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh)
fi
echo "opencga_branch=${opencga_branch}"
echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT
- name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}'
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/tmp-test-xetabase-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: TMP test-xetabase-branch
run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}'

on:
push:
branches:
- TASK-*


jobs:
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 java-common-libs
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: |
if [ "$( git ls-remote https://$ZETTA_REPO_ACCESS_TOKEN@github.com/opencb/opencga.git "TASK-6879" )" ] ; then
echo "OPENCGA TASK-6879 branch";
fi
if [ "$( git ls-remote https://$ZETTA_REPO_ACCESS_TOKEN@github.com/zetta-genomics/opencga-enterprise.git "$input_branch" )" ] ; then
echo "Here it is TASK-6807 branch";
fi
chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
echo "secrets.ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}" | tee -a ${GITHUB_STEP_SUMMARY}
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh "TASK-6879" )
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"
needs: calculate-xetabase-branch
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
with:
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
task: TASK-6879
secrets: inherit

0 comments on commit b6cf47a

Please sign in to comment.