From 2125d060209b56f98c62b910b019a186b4070565 Mon Sep 17 00:00:00 2001 From: imedina Date: Sun, 18 Jun 2023 17:02:49 +0100 Subject: [PATCH 01/10] cicd: remove test report copy --- .github/workflows/develop.yml | 6 +-- .github/workflows/release.yml | 6 +-- .github/workflows/task.yml | 6 +-- .github/workflows/test-analysis.yml | 84 ++++++++++++++++------------- 4 files changed, 57 insertions(+), 45 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 4d58a094b..2a8ffdd62 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -14,9 +14,9 @@ jobs: uses: ./.github/workflows/test-analysis.yml needs: build secrets: inherit - with: - report_context: development - report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }} +# with: +# report_context: development +# report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }} deploy-maven: uses: ./.github/workflows/deploy-maven-repository-workflow.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42013c00f..a4d2f7b45 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,9 +13,9 @@ jobs: uses: ./.github/workflows/test-analysis.yml needs: build secrets: inherit - with: - report_context: xetabase - report_dir: java-common-libs +# with: +# report_context: xetabase +# report_dir: java-common-libs deploy-maven: uses: ./.github/workflows/deploy-maven-repository-workflow.yml diff --git a/.github/workflows/task.yml b/.github/workflows/task.yml index 56fa91e72..a69c65871 100644 --- a/.github/workflows/task.yml +++ b/.github/workflows/task.yml @@ -13,6 +13,6 @@ jobs: uses: ./.github/workflows/test-analysis.yml needs: build secrets: inherit - with: - report_context: development - report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }} +# with: +# report_context: development +# report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }} diff --git a/.github/workflows/test-analysis.yml b/.github/workflows/test-analysis.yml index 474995253..908c97b7c 100644 --- a/.github/workflows/test-analysis.yml +++ b/.github/workflows/test-analysis.yml @@ -1,6 +1,13 @@ name: Build and test the project on: workflow_call: +# inputs: +# report_dir: +# type: string +# required: true +# report_context: +# type: string +# required: true secrets: SONAR_TOKEN: required: true @@ -12,15 +19,10 @@ on: required: true SSH_TESTING_SERVER_PASSWORD: required: true - inputs: - report_dir: - type: string - required: true - report_context: - type: string - required: true -env: - xb_version: "1.8.0" + +#env: +# xb_version: "1.8.0" + jobs: test: name: Test and push Sonar analysis @@ -44,31 +46,41 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify surefire-report:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=opencb_java-common-libs - - name: Upload result dir - uses: actions/upload-artifact@v3 - with: - name: workdir - path: "**/target/site" - publish-test: - name: Publish test results - runs-on: ubuntu-22.04 - needs: test - strategy: - matrix: - module: ["commons-lib", "commons-datastore", "commons-datastore/commons-datastore-core", "commons-datastore/commons-datastore-mongodb", "commons-datastore/commons-datastore-solr"] - steps: - - name: Download result dir - uses: actions/download-artifact@v3 - with: - name: workdir - - name: Deploy unit tests web recursively to remote - uses: garygrossgarten/github-action-scp@release + run: mvn -B verify surefire-report:report --fail-never org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=opencb_java-common-libs + - name: Publish Test Report + uses: scacap/action-surefire-report@v1 + ## Skip cancelled() + ## https://docs.github.com/en/actions/learn-github-actions/expressions#cancelled + if: success() || failure() with: - local: ${{ matrix.module }}/target/site - remote: /var/www/html/reports/${{ inputs.report_context }}/${{ env.xb_version }}/${{ inputs.report_dir }}/unit/${{ matrix.module }} - host: ${{ secrets.SSH_TESTING_SERVER_HOST}} - port: ${{ secrets.SSH_TESTING_SERVER_PORT}} - username: ${{ secrets.SSH_TESTING_SERVER_USER }} - password: ${{ secrets.SSH_TESTING_SERVER_PASSWORD }} - concurrency: 2 + check_name: "Surefire tests report" + report_paths: './**/surefire-reports/TEST-*.xml' + commit: '${{ github.sha }}' + fail_on_test_failures: true +# - name: Upload result dir +# uses: actions/upload-artifact@v3 +# with: +# name: workdir +# path: "**/target/site" +# publish-test: +# name: Publish test results +# runs-on: ubuntu-22.04 +# needs: test +# strategy: +# matrix: +# module: ["commons-lib", "commons-datastore", "commons-datastore/commons-datastore-core", "commons-datastore/commons-datastore-mongodb", "commons-datastore/commons-datastore-solr"] +# steps: +# - name: Download result dir +# uses: actions/download-artifact@v3 +# with: +# name: workdir +# - name: Deploy unit tests web recursively to remote +# uses: garygrossgarten/github-action-scp@release +# with: +# local: ${{ matrix.module }}/target/site +# remote: /var/www/html/reports/${{ inputs.report_context }}/${{ env.xb_version }}/${{ inputs.report_dir }}/unit/${{ matrix.module }} +# host: ${{ secrets.SSH_TESTING_SERVER_HOST}} +# port: ${{ secrets.SSH_TESTING_SERVER_PORT}} +# username: ${{ secrets.SSH_TESTING_SERVER_USER }} +# password: ${{ secrets.SSH_TESTING_SERVER_PASSWORD }} +# concurrency: 2 From e4626ceedb85b409602c3efc23079bb67fd35e96 Mon Sep 17 00:00:00 2001 From: imedina Date: Sun, 18 Jun 2023 17:04:10 +0100 Subject: [PATCH 02/10] cicd: remove old secrets --- .github/workflows/test-analysis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-analysis.yml b/.github/workflows/test-analysis.yml index 908c97b7c..d92faf1e0 100644 --- a/.github/workflows/test-analysis.yml +++ b/.github/workflows/test-analysis.yml @@ -11,14 +11,14 @@ on: secrets: SONAR_TOKEN: required: true - SSH_TESTING_SERVER_HOST: - required: true - SSH_TESTING_SERVER_PORT: - required: true - SSH_TESTING_SERVER_USER: - required: true - SSH_TESTING_SERVER_PASSWORD: - required: true +# SSH_TESTING_SERVER_HOST: +# required: true +# SSH_TESTING_SERVER_PORT: +# required: true +# SSH_TESTING_SERVER_USER: +# required: true +# SSH_TESTING_SERVER_PASSWORD: +# required: true #env: # xb_version: "1.8.0" From dd6207552354f2d4025abcab874e8d177a5159d0 Mon Sep 17 00:00:00 2001 From: imedina Date: Sun, 18 Jun 2023 17:15:51 +0100 Subject: [PATCH 03/10] cicd: minor style improvements --- .github/workflows/build-java-app-workflow.yml | 1 - .github/workflows/deploy-python-workflow.yml | 2 +- .github/workflows/develop.yml | 2 +- .github/workflows/task.yml | 2 +- .github/workflows/test-analysis.yml | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-java-app-workflow.yml b/.github/workflows/build-java-app-workflow.yml index e10e7a534..cfc75d83b 100644 --- a/.github/workflows/build-java-app-workflow.yml +++ b/.github/workflows/build-java-app-workflow.yml @@ -15,7 +15,6 @@ jobs: build-workflow: name: Build Java app runs-on: ubuntu-22.04 - #runs-on: self-hosted outputs: version: ${{ steps.get_project_version.outputs.version }} steps: diff --git a/.github/workflows/deploy-python-workflow.yml b/.github/workflows/deploy-python-workflow.yml index a6b60226d..a8f3634aa 100644 --- a/.github/workflows/deploy-python-workflow.yml +++ b/.github/workflows/deploy-python-workflow.yml @@ -30,4 +30,4 @@ jobs: env: TWINE_USERNAME: ${{ secrets.PYPI_TWINE_USER }} TWINE_PASSWORD: ${{ secrets.PYPI_TWINE_PASSWORD }} - run: ${{ inputs.cli }} \ No newline at end of file + run: ${{ inputs.cli }} diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 2a8ffdd62..68f98f2be 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -1,4 +1,4 @@ -name: Push java-common-libs develop +name: Merge/Push in java-common-libs develop branch on: push: diff --git a/.github/workflows/task.yml b/.github/workflows/task.yml index a69c65871..8513626dd 100644 --- a/.github/workflows/task.yml +++ b/.github/workflows/task.yml @@ -1,4 +1,4 @@ -name: Push java-common-libs task +name: Push in java-common-libs task branch on: push: diff --git a/.github/workflows/test-analysis.yml b/.github/workflows/test-analysis.yml index d92faf1e0..460748dd8 100644 --- a/.github/workflows/test-analysis.yml +++ b/.github/workflows/test-analysis.yml @@ -1,4 +1,5 @@ name: Build and test the project + on: workflow_call: # inputs: @@ -19,7 +20,6 @@ on: # required: true # SSH_TESTING_SERVER_PASSWORD: # required: true - #env: # xb_version: "1.8.0" From 4501a298211700ed6c486250d8d20f596e85cdb0 Mon Sep 17 00:00:00 2001 From: imedina Date: Sun, 18 Jun 2023 17:17:25 +0100 Subject: [PATCH 04/10] cicd: introduce an error to test new junit reports --- .../src/test/java/org/opencb/commons/utils/FileUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java b/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java index 8cae2f90e..800681924 100644 --- a/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java +++ b/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java @@ -16,7 +16,7 @@ public class FileUtilsTest { @Test public void getUser() throws IOException { String user = FileUtils.getUser(path); - Assert.assertEquals("root", user); + Assert.assertEquals("roo", user); } @Test From a3b16135d27cae38361cbd6a334a1df36d3c2938 Mon Sep 17 00:00:00 2001 From: imedina Date: Sun, 18 Jun 2023 17:17:42 +0100 Subject: [PATCH 05/10] cicd: rever previous change --- .../src/test/java/org/opencb/commons/utils/FileUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java b/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java index 800681924..8cae2f90e 100644 --- a/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java +++ b/commons-lib/src/test/java/org/opencb/commons/utils/FileUtilsTest.java @@ -16,7 +16,7 @@ public class FileUtilsTest { @Test public void getUser() throws IOException { String user = FileUtils.getUser(path); - Assert.assertEquals("roo", user); + Assert.assertEquals("root", user); } @Test From 04f8d83197a67423fe9ba7b45b4eba31fb82ffa4 Mon Sep 17 00:00:00 2001 From: imedina Date: Mon, 19 Jun 2023 00:32:00 +0100 Subject: [PATCH 06/10] cicd: remove avides GH action --- .github/workflows/build-java-app-workflow.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-java-app-workflow.yml b/.github/workflows/build-java-app-workflow.yml index cfc75d83b..56859fd4b 100644 --- a/.github/workflows/build-java-app-workflow.yml +++ b/.github/workflows/build-java-app-workflow.yml @@ -39,11 +39,15 @@ jobs: with: name: build-folder path: build +# - id: get_project_version +# uses: avides/actions-project-version-check@v1.3.0 +# with: +# token: ${{ secrets.GITHUB_TOKEN }} +# file-to-check: pom.xml +# only-return-version: true - id: get_project_version - uses: avides/actions-project-version-check@v1.3.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} - file-to-check: pom.xml - only-return-version: true + name: Get project version + run: | + echo `mvn help:evaluate -q -Dexpression=project.version -DforceStdout` >> $GITHUB_OUTPUT - name: test-version-from-check run: echo "Project version is " ${{ steps.get_project_version.outputs.version }} From 49047ddaca7170dab2797bebf47c78833b92a11d Mon Sep 17 00:00:00 2001 From: imedina Date: Mon, 19 Jun 2023 00:33:56 +0100 Subject: [PATCH 07/10] cicd: remove avides GH action --- .github/workflows/build-java-app-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-java-app-workflow.yml b/.github/workflows/build-java-app-workflow.yml index 56859fd4b..0de9bf145 100644 --- a/.github/workflows/build-java-app-workflow.yml +++ b/.github/workflows/build-java-app-workflow.yml @@ -48,6 +48,6 @@ jobs: - id: get_project_version name: Get project version run: | - echo `mvn help:evaluate -q -Dexpression=project.version -DforceStdout` >> $GITHUB_OUTPUT + echo "version=`mvn help:evaluate -q -Dexpression=project.version -DforceStdout`" >> $GITHUB_OUTPUT - name: test-version-from-check run: echo "Project version is " ${{ steps.get_project_version.outputs.version }} From 9bfcfddcc2bfa29dd83d2025490976391805a6ca Mon Sep 17 00:00:00 2001 From: imedina Date: Tue, 20 Jun 2023 12:24:48 +0100 Subject: [PATCH 08/10] cicd: delete old deprecated workflow --- .../deprecated/sonar-analysis-workflow.yml | 41 -------------- .github/workflows/scripts/get_same_branch.sh | 54 ------------------- 2 files changed, 95 deletions(-) delete mode 100644 .github/workflows/deprecated/sonar-analysis-workflow.yml delete mode 100644 .github/workflows/scripts/get_same_branch.sh diff --git a/.github/workflows/deprecated/sonar-analysis-workflow.yml b/.github/workflows/deprecated/sonar-analysis-workflow.yml deleted file mode 100644 index f93556cd3..000000000 --- a/.github/workflows/deprecated/sonar-analysis-workflow.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Sonar workflow - -on: - workflow_call: - inputs: - sonarProjectKey: - type: string - required: true - secrets: - SONAR_TOKEN: - required: true -jobs: - build: - name: Sonar Build - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '11' - cache: 'maven' - - name: Cache SonarCloud packages - uses: actions/cache@v1 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Start MongoDB v5.0 - uses: supercharge/mongodb-github-action@1.7.0 - with: - mongodb-version: 5.0 - mongodb-replica-set: rs-test - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -DskipTests -Dsonar.projectKey=${{ inputs.sonarProjectKey }} \ No newline at end of file diff --git a/.github/workflows/scripts/get_same_branch.sh b/.github/workflows/scripts/get_same_branch.sh deleted file mode 100644 index 4c0b14079..000000000 --- a/.github/workflows/scripts/get_same_branch.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -BRANCH_NAME=$1 - -if [[ -z $BRANCH_NAME ]]; then - echo "The first parameter is mandatory and must be a valid branch name." - exit 1 -fi - -if [[ $BRANCH_NAME != "TASK-"* ]]; then - echo "No need to check dependencies." - exit 0 -fi - -function install(){ - local REPO=$1 - cd /home/runner/work/ || exit 2 - #git clone git@github.com:opencb/"$REPO".git - git clone https://github.com/opencb/"$REPO".git - cd "$REPO" || exit 2 - git checkout "$BRANCH_NAME" - CURRENT=$(git branch --show-current) - echo "Current branch name $CURRENT" - if [[ "$CURRENT" == "$BRANCH_NAME" ]]; then - echo "Branch name $BRANCH_NAME already exists." - mvn clean install -DskipTests - else - echo "$CURRENT Branch is NOT EQUALS $BRANCH_NAME " - fi -} - -PWD=$(pwd) -echo "The absolute exec path is $PWD" - -if [[ "$PWD" != *"java-common-libs"* ]]; then - ## biodata - if [[ "$PWD" == *"biodata"* ]]; then - echo "It's biodata." - install "java-common-libs" - fi - ## cellbase - if [[ "$PWD" == *"cellbase"* ]]; then - echo "It's cellbase." - install "java-common-libs" - install "biodata" - fi - ## opencga - if [[ "$PWD" == *"opencga"* ]]; then - echo "It's opencga." - install "java-common-libs" - install "biodata" - install "cellbase" - fi -fi \ No newline at end of file From 300df8fb852aae592189ff7bbe7b3fdc88b4964c Mon Sep 17 00:00:00 2001 From: imedina Date: Fri, 23 Jun 2023 01:11:25 +0100 Subject: [PATCH 09/10] cicd: remove commented code --- .github/workflows/build-java-app-workflow.yml | 6 --- .github/workflows/develop.yml | 3 -- .github/workflows/release.yml | 3 -- .github/workflows/task.yml | 3 -- .github/workflows/test-analysis.yml | 44 ------------------- 5 files changed, 59 deletions(-) diff --git a/.github/workflows/build-java-app-workflow.yml b/.github/workflows/build-java-app-workflow.yml index 0de9bf145..2d9238a05 100644 --- a/.github/workflows/build-java-app-workflow.yml +++ b/.github/workflows/build-java-app-workflow.yml @@ -39,12 +39,6 @@ jobs: with: name: build-folder path: build -# - id: get_project_version -# uses: avides/actions-project-version-check@v1.3.0 -# with: -# token: ${{ secrets.GITHUB_TOKEN }} -# file-to-check: pom.xml -# only-return-version: true - id: get_project_version name: Get project version run: | diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 68f98f2be..196fc122b 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -14,9 +14,6 @@ jobs: uses: ./.github/workflows/test-analysis.yml needs: build secrets: inherit -# with: -# report_context: development -# report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }} deploy-maven: uses: ./.github/workflows/deploy-maven-repository-workflow.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4d2f7b45..3a9d5df37 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,9 +13,6 @@ jobs: uses: ./.github/workflows/test-analysis.yml needs: build secrets: inherit -# with: -# report_context: xetabase -# report_dir: java-common-libs deploy-maven: uses: ./.github/workflows/deploy-maven-repository-workflow.yml diff --git a/.github/workflows/task.yml b/.github/workflows/task.yml index 8513626dd..29f7f7d54 100644 --- a/.github/workflows/task.yml +++ b/.github/workflows/task.yml @@ -13,6 +13,3 @@ jobs: uses: ./.github/workflows/test-analysis.yml needs: build secrets: inherit -# with: -# report_context: development -# report_dir: ${{ github.ref_name }}/java-common-libs/${{ github.sha }} diff --git a/.github/workflows/test-analysis.yml b/.github/workflows/test-analysis.yml index 460748dd8..dd8240e5e 100644 --- a/.github/workflows/test-analysis.yml +++ b/.github/workflows/test-analysis.yml @@ -2,26 +2,9 @@ name: Build and test the project on: workflow_call: -# inputs: -# report_dir: -# type: string -# required: true -# report_context: -# type: string -# required: true secrets: SONAR_TOKEN: required: true -# SSH_TESTING_SERVER_HOST: -# required: true -# SSH_TESTING_SERVER_PORT: -# required: true -# SSH_TESTING_SERVER_USER: -# required: true -# SSH_TESTING_SERVER_PASSWORD: -# required: true -#env: -# xb_version: "1.8.0" jobs: test: @@ -57,30 +40,3 @@ jobs: report_paths: './**/surefire-reports/TEST-*.xml' commit: '${{ github.sha }}' fail_on_test_failures: true -# - name: Upload result dir -# uses: actions/upload-artifact@v3 -# with: -# name: workdir -# path: "**/target/site" -# publish-test: -# name: Publish test results -# runs-on: ubuntu-22.04 -# needs: test -# strategy: -# matrix: -# module: ["commons-lib", "commons-datastore", "commons-datastore/commons-datastore-core", "commons-datastore/commons-datastore-mongodb", "commons-datastore/commons-datastore-solr"] -# steps: -# - name: Download result dir -# uses: actions/download-artifact@v3 -# with: -# name: workdir -# - name: Deploy unit tests web recursively to remote -# uses: garygrossgarten/github-action-scp@release -# with: -# local: ${{ matrix.module }}/target/site -# remote: /var/www/html/reports/${{ inputs.report_context }}/${{ env.xb_version }}/${{ inputs.report_dir }}/unit/${{ matrix.module }} -# host: ${{ secrets.SSH_TESTING_SERVER_HOST}} -# port: ${{ secrets.SSH_TESTING_SERVER_PORT}} -# username: ${{ secrets.SSH_TESTING_SERVER_USER }} -# password: ${{ secrets.SSH_TESTING_SERVER_PASSWORD }} -# concurrency: 2 From 897bc822357a4b22f88208f51cd2ea68ad02c763 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Wed, 28 Jun 2023 12:03:37 +0200 Subject: [PATCH 10/10] Delete de test step in release.yml --- .github/workflows/release.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a9d5df37..9e3279201 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,11 +9,6 @@ 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