From a7e8fef73dabbd159d4c6e95e333dcee64b47f50 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 15:48:34 -0800 Subject: [PATCH 01/12] CI --- .github/workflows/build.yaml | 33 ++++++++++++++++++++++++++++++ .github/workflows/build/action.yml | 14 ------------- .github/workflows/main.yaml | 21 +++++++++++++++++++ .github/workflows/maven.yml | 19 ----------------- 4 files changed, 54 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/build/action.yml create mode 100644 .github/workflows/main.yaml delete mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000000..dd67697b51 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: build +on: + workflow_call: + inputs: + mvn_goal: + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: 8 + distribution: corretto + cache: 'maven' + server-id: sagebionetworks + server-username: MAVEN_USERNAME + server-password: MAVEN_USERPWD + - name: Version develop artifacts + if: ${{ github.ref_name == 'develop' }} + run: echo pomSnapshotToGitHash.sh + - name: Version release artifacts + if: ${{ contains(github.ref_name, 'release') }} + run: echo pomSnapshotToLastGitHash.sh + - name: Build with Maven + run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml + env: + MAVEN_USERNAME: ${{ secrets.PLATFORM_ARTIFACTORY_USER }} + MAVEN_USERPWD: ${{ secrets.PLATFORM_ARTIFACTORY_PWD }} diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml deleted file mode 100644 index e3e8f00119..0000000000 --- a/.github/workflows/build/action.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'Build SWC' -description: 'Build SWC' -runs: - using: 'composite' - steps: - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - cache: maven - - name: Build with Maven - shell: bash - run: mvn -B package --file pom.xml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000000..ae96d95fe1 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,21 @@ +name: build-main + +on: + push: + branches: [develop, release-**] + pull_request: + branches: [develop, release-**] + +jobs: + call-build: + if: github.event_name == 'push' && github.repository_owner == 'Sage-Bionetworks' + uses: ./.github/workflows/build.yaml + with: + mvn_goal: deploy + secrets: inherit + call-test: + if: github.event_name == 'pull_request' + uses: ./.github/workflows/build.yaml + with: + mvn_goal: package + secrets: inherit diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index 4763d93659..0000000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,19 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Java CI with Maven - -on: - pull_request: - branches: [develop, release-**] - push: - branches: [develop] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build SWC - uses: ./.github/workflows/build From 3363c1fdabd351f366e21708ceb147f595ccc155 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 18:11:14 -0800 Subject: [PATCH 02/12] Fix cond --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dd67697b51..fde2a79aaa 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,10 +21,10 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_USERPWD - name: Version develop artifacts - if: ${{ github.ref_name == 'develop' }} + if: github.ref == 'refs/head/develop' run: echo pomSnapshotToGitHash.sh - name: Version release artifacts - if: ${{ contains(github.ref_name, 'release') }} + if: contains(github.ref, 'release') run: echo pomSnapshotToLastGitHash.sh - name: Build with Maven run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml From 6dd9583ef2b6c68f7c9801d346e7c16ab4b5df9e Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 18:22:08 -0800 Subject: [PATCH 03/12] Fix cond --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fde2a79aaa..4918b2ae00 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,7 +24,7 @@ jobs: if: github.ref == 'refs/head/develop' run: echo pomSnapshotToGitHash.sh - name: Version release artifacts - if: contains(github.ref, 'release') + if: github.event_name == 'pull_request' && contains(github.base_ref, 'release') run: echo pomSnapshotToLastGitHash.sh - name: Build with Maven run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml From c798a64261ac96abb1ee68a6b0aa86ece9fee7c5 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 19:18:53 -0800 Subject: [PATCH 04/12] Fix --- .github/workflows/build.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4918b2ae00..40b619a651 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,10 +21,7 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_USERPWD - name: Version develop artifacts - if: github.ref == 'refs/head/develop' - run: echo pomSnapshotToGitHash.sh - - name: Version release artifacts - if: github.event_name == 'pull_request' && contains(github.base_ref, 'release') + if: ${{ inputs.mvn_goal }} == 'deploy' run: echo pomSnapshotToLastGitHash.sh - name: Build with Maven run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml From 5f4a70a210f0e5b8a02720eb65a54b4d75ae80cb Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 19:33:28 -0800 Subject: [PATCH 05/12] Fix syntax --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 40b619a651..3846746437 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,8 +20,8 @@ jobs: server-id: sagebionetworks server-username: MAVEN_USERNAME server-password: MAVEN_USERPWD - - name: Version develop artifacts - if: ${{ inputs.mvn_goal }} == 'deploy' + - name: Version artifacts + if: ${{ inputs.mvn_goal == 'deploy' }} run: echo pomSnapshotToLastGitHash.sh - name: Build with Maven run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml From 955611987f8a35cac72648ad1a77a4a39522dfc0 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 19:39:51 -0800 Subject: [PATCH 06/12] Actual --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3846746437..6eacd8da88 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,9 +22,9 @@ jobs: server-password: MAVEN_USERPWD - name: Version artifacts if: ${{ inputs.mvn_goal == 'deploy' }} - run: echo pomSnapshotToLastGitHash.sh + run: ./pomSnapshotToLastGitHash.sh - name: Build with Maven - run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml + run: mvn -B ${{ inputs.mvn_goal }} --file pom.xml env: MAVEN_USERNAME: ${{ secrets.PLATFORM_ARTIFACTORY_USER }} MAVEN_USERPWD: ${{ secrets.PLATFORM_ARTIFACTORY_PWD }} From 7759d287545f0f8a0dd9260bf20cf031a9b562cc Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 19:49:59 -0800 Subject: [PATCH 07/12] Invert logic to test --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6eacd8da88..ec60d594d0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_USERPWD - name: Version artifacts - if: ${{ inputs.mvn_goal == 'deploy' }} + if: ${{ inputs.mvn_goal != 'deploy' }} run: ./pomSnapshotToLastGitHash.sh - name: Build with Maven run: mvn -B ${{ inputs.mvn_goal }} --file pom.xml From 2425431b4d01e9c80292bd0b114a364669a58d1b Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 20:00:41 -0800 Subject: [PATCH 08/12] Test --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ec60d594d0..1c6806cfd3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,9 +22,9 @@ jobs: server-password: MAVEN_USERPWD - name: Version artifacts if: ${{ inputs.mvn_goal != 'deploy' }} - run: ./pomSnapshotToLastGitHash.sh + run: chmod 777 pomSnapshotToLastGitTag.sh && ./pomSnapshotToLastGitTag.sh - name: Build with Maven - run: mvn -B ${{ inputs.mvn_goal }} --file pom.xml + run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml env: MAVEN_USERNAME: ${{ secrets.PLATFORM_ARTIFACTORY_USER }} MAVEN_USERPWD: ${{ secrets.PLATFORM_ARTIFACTORY_PWD }} From 40c9bf9141d1ea982d7b0240711545326ac25414 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Mon, 29 Jan 2024 20:07:00 -0800 Subject: [PATCH 09/12] Test --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1c6806cfd3..dc70d3eeaf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ jobs: server-password: MAVEN_USERPWD - name: Version artifacts if: ${{ inputs.mvn_goal != 'deploy' }} - run: chmod 777 pomSnapshotToLastGitTag.sh && ./pomSnapshotToLastGitTag.sh + run: chmod 777 pomSnapshotToGitHash.sh && ./pomSnapshotToGitHash.sh - name: Build with Maven run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml env: From 6ec48aff3ac2c666ce29faafa24167b5d104895e Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Fri, 2 Feb 2024 08:21:14 -0800 Subject: [PATCH 10/12] Reset test --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dc70d3eeaf..d743b9d8ef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,8 +21,8 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_USERPWD - name: Version artifacts - if: ${{ inputs.mvn_goal != 'deploy' }} - run: chmod 777 pomSnapshotToGitHash.sh && ./pomSnapshotToGitHash.sh + if: ${{ inputs.mvn_goal == 'deploy' }} + run: chmod 777 pomSnapshotToLastGitTag.sh && ./pomSnapshotToLastGitTag.sh - name: Build with Maven run: echo mvn -B ${{ inputs.mvn_goal }} --file pom.xml env: From 7d847290875672931c0c1e2096a17974c9bdbd42 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Fri, 2 Feb 2024 09:28:05 -0800 Subject: [PATCH 11/12] Test --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ae96d95fe1..ee22dae683 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -8,7 +8,7 @@ on: jobs: call-build: - if: github.event_name == 'push' && github.repository_owner == 'Sage-Bionetworks' + if: github.event_name == 'push' && github.ref != 'refs/heads/develop' && github.repository_owner == 'Sage-Bionetworks' uses: ./.github/workflows/build.yaml with: mvn_goal: deploy From a246f201610e1885508cb7f18ba3568f2f32c6d1 Mon Sep 17 00:00:00 2001 From: Xavier Schildwachter Date: Fri, 2 Feb 2024 10:00:03 -0800 Subject: [PATCH 12/12] Fix e2e --- .github/workflows/build/action.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/build/action.yml diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml new file mode 100644 index 0000000000..e3e8f00119 --- /dev/null +++ b/.github/workflows/build/action.yml @@ -0,0 +1,14 @@ +name: 'Build SWC' +description: 'Build SWC' +runs: + using: 'composite' + steps: + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + - name: Build with Maven + shell: bash + run: mvn -B package --file pom.xml