diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 196fc122b..3029b0fdb 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -10,12 +10,7 @@ jobs: build: uses: ./.github/workflows/build-java-app-workflow.yml - test: - uses: ./.github/workflows/test-analysis.yml - needs: build - secrets: inherit - deploy-maven: uses: ./.github/workflows/deploy-maven-repository-workflow.yml - needs: test + needs: build secrets: inherit diff --git a/.github/workflows/scripts/get-xetabase-branch.sh b/.github/workflows/scripts/get-xetabase-branch.sh index be89ffbf2..6e62a8ff6 100644 --- a/.github/workflows/scripts/get-xetabase-branch.sh +++ b/.github/workflows/scripts/get-xetabase-branch.sh @@ -22,6 +22,7 @@ get_xetabase_branch() { # 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 diff --git a/.github/workflows/tmp-test-xetabase-branch.yml b/.github/workflows/tmp-test-xetabase-branch.yml deleted file mode 100644 index c10d99ec5..000000000 --- a/.github/workflows/tmp-test-xetabase-branch.yml +++ /dev/null @@ -1,48 +0,0 @@ -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 \ No newline at end of file diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 9147f9b33..84a6c880b 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -67,6 +67,13 @@ com.fasterxml.jackson.core jackson-databind + test + + + commons-io + commons-io + 2.8.0 + compile diff --git a/commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java b/commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java index 93fba0f0d..1ae5ba87d 100644 --- a/commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java +++ b/commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; import org.opencb.commons.exec.Command; +import org.slf4j.LoggerFactory; import java.io.*; import java.nio.charset.Charset; @@ -188,6 +189,27 @@ public static String[] getUserAndGroup(Path path, boolean numericId) throws IOEx return new String[]{split[2], split[3]}; } + + public static void copyFile(File src, File dest) throws IOException { + try { + org.apache.commons.io.FileUtils.copyFile(src, dest); + } catch (IOException e) { + try { + if (src.length() == dest.length()) { + LoggerFactory.getLogger(FileUtils.class).warn(e.getMessage()); + return; + } + throw e; + } catch (Exception e1) { + throw e; + } + } + } + + //------------------------------------------------------------------------- + // P R I V A T E M E T H O D S + //------------------------------------------------------------------------- + private static String getLsOutput(Path path, boolean numericId) throws IOException { FileUtils.checkPath(path);