From 5911fed787d8a07c7d4a02f2f68b07bf95c2351a Mon Sep 17 00:00:00 2001
From: Giles Westwood
Date: Thu, 7 Nov 2024 15:21:52 +0000
Subject: [PATCH 01/15] use matrix method and if cases to reduce workflow
counts and complexity
---
.github/workflows/bld_all.yml | 185 -----------
.github/workflows/bld_all_matrix.yml | 293 ------------------
.../workflows/{bld_maven.yml => bld_mvn.yml} | 68 ++--
.github/workflows/build_debug.yml | 101 ------
.github/workflows/build_test_release.yml | 119 -------
.github/workflows/build_test_release_tag.yml | 26 +-
.../workflows/install_maven_dependencies.yml | 6 +-
.github/workflows/lint.yml | 15 +-
.github/workflows/maven_test_artifact.yml | 167 ----------
.github/workflows/maven_test_report.yml | 30 --
.../{maven_test_publish.yml => mvn_test.yml} | 66 ++--
.github/workflows/pr.yml | 7 +-
.github/workflows/pr_completed.yml | 32 --
.github/workflows/rel_tag.yml | 2 +-
.github/workflows/seed_maven_cache.yml | 6 +-
.github/workflows/unit_tests_artifact.yml | 144 ---------
.github/workflows/unit_tests_publish.yml | 180 -----------
.github/workflows/unit_tests_report.yml | 78 -----
18 files changed, 111 insertions(+), 1414 deletions(-)
delete mode 100644 .github/workflows/bld_all.yml
delete mode 100644 .github/workflows/bld_all_matrix.yml
rename .github/workflows/{bld_maven.yml => bld_mvn.yml} (85%)
delete mode 100644 .github/workflows/build_debug.yml
delete mode 100644 .github/workflows/build_test_release.yml
delete mode 100644 .github/workflows/maven_test_artifact.yml
delete mode 100644 .github/workflows/maven_test_report.yml
rename .github/workflows/{maven_test_publish.yml => mvn_test.yml} (73%)
delete mode 100644 .github/workflows/pr_completed.yml
delete mode 100644 .github/workflows/unit_tests_artifact.yml
delete mode 100644 .github/workflows/unit_tests_publish.yml
delete mode 100644 .github/workflows/unit_tests_report.yml
diff --git a/.github/workflows/bld_all.yml b/.github/workflows/bld_all.yml
deleted file mode 100644
index ab01a41f63a..00000000000
--- a/.github/workflows/bld_all.yml
+++ /dev/null
@@ -1,185 +0,0 @@
-name: bld_all
-
-permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'Version tag to use: (bump must also be set to none to keep a specific version'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'Version tag to use: (bump must also be set to none to keep a specific version'
- required: false
- default: 'latest'
- type: string
- bump:
- description: |
- How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
- '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
- required: false
- options:
- - patch
- - minor
- - major
- - none
- type: choice
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
-jobs:
-
- bld_ml:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-message-listener
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- bld_amq:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-activemq
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- bld_api:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-api-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- bld_iapi:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-internal-api
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- bld_pubweb:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-pub-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- bld_sched:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-scheduler-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- bld_web:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- project: orcid-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
diff --git a/.github/workflows/bld_all_matrix.yml b/.github/workflows/bld_all_matrix.yml
deleted file mode 100644
index f4f09df4882..00000000000
--- a/.github/workflows/bld_all_matrix.yml
+++ /dev/null
@@ -1,293 +0,0 @@
-name: bld_all_matrix
-
-permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'Version tag to use: (bump must also be set to none to keep a specific version'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'Version tag to use: (bump must also be set to none to keep a specific version'
- required: false
- default: 'latest'
- type: string
- bump:
- description: |
- How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
- '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
- required: false
- options:
- - patch
- - minor
- - major
- - none
- type: choice
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
-
-jobs:
-
- bld:
- strategy:
- matrix:
- # The include keyword that adds a new variable
- include:
- - artifact_name: orcid-message-listener
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- - artifact_name: orcid-activemq
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- - artifact_name: orcid-api-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- - artifact_name: orcid-internal-api
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- - artifact_name: orcid-pub-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- - artifact_name: orcid-scheduler-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- - artifact_name: orcid-web
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
-
- runs-on: ubuntu-latest
- steps:
-
- - name: git-checkout-ref-action
- id: ref
- uses: ORCID/git-checkout-ref-action@main
- with:
- default_branch: ${{ github.event.repository.default_branch }}
- ref: ${{ inputs.ref }}
-
- - uses: actions/checkout@v3
- with:
- ref: ${{ steps.ref.outputs.ref }}
- # checkout some history so we can scan commits for bump messages
- # NOTE: history does not include tags!
- fetch-depth: 100
-
- - name: find next version
- id: version
- uses: ORCID/version-bump-action@main
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
-
- - name: Set up Open JDK 11
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: '11'
- cache: 'maven'
-
- - name: show path
- run: |
- echo "$PATH"
- which java
- echo "$JAVA_HOME"
- echo "$tag_numeric"
- echo "$project"
- shell: bash
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
- project: "${{ matrix.artifact_name }}"
-
- - name: populate orcid-persistence/src/main/resources/release_name.txt with numeric tag
- run: |
- echo "$version_tag_numeric" > orcid-persistence/src/main/resources/release_name.txt
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: bump version of the parent pom and connected projects
- run: |
- mvn -T 1C --batch-mode versions:set \
- -DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: bump the tagged version in the poms of projects not tied to the parent pom (orcid-test)
- run: |
- mvn -T 1C --batch-mode versions:set \
- -DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects orcid-test
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: install orcid-parent into our local maven repo because the builds depend a version release
- run: |
- mvn -T 1C --batch-mode --non-recursive clean install -DskipTests \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: install orcid-test into our local maven repo because the builds depend a version release
- run: |
- mvn -T 1C --batch-mode clean install -DskipTests\
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects orcid-test
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: install orcid-utils into our local maven repo because the builds depend a version release
- run: |
- mvn -T 1C --batch-mode clean install -DskipTests \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects orcid-utils
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: install orcid-persistence into our local maven repo because orcid-core depends on it
- run: |
- mvn -T 1C --batch-mode clean install -DskipTests \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects orcid-persistence
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: install orcid-core into our local maven repo because the builds depend a version release
- run: |
- mvn -T 1C --batch-mode clean install -DskipTests \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects orcid-core
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
- - name: check some build related things
- run: |
- git --version
- git config user.name "GitHub Actions Bot"
- git config user.email "<>"
- git status
- git diff
-
- - name: build our project
- run: |
- mvn -T 1C --batch-mode -am package -DskipTests \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects "$project"
- echo "------------------------------------------------------"
-
- find . -name '*.war'
- find . -name '*.jar'
- env:
- project: "${{ matrix.artifact_name }}"
-
-#
-# orcid-web customization
-#
-
- - name: setup node for angular static file
- if: ${{ matrix.artifact_name == 'orcid-web' }}
- uses: actions/setup-node@v3
- with:
- node-version: 18.7.0
-
- - name: build angular parts if we are building orcid-web
- if: ${{ matrix.artifact_name == 'orcid-web' }}
- run: |
- echo "Build angular_orcid_generated.js"
- cd orcid-nodejs
- mvn -T 1C --batch-mode -P ci clean compile \
- -Dnodejs.workingDirectory="${{ github.workspace }}/orcid-web/src/main/webapp/static/javascript/ng1Orcid" \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-
- echo "Copying angular_orcid_generated to its final destination"
- cp ${{ github.workspace }}/orcid-web/src/main/webapp/static/javascript/ng1Orcid/angular_orcid_generated.js ${{ github.workspace }}/orcid-web/target/orcid-web/static/javascript/ng1Orcid/
-
- echo "Packaging orcid-web"
- rm -f ${{ github.workspace }}/orcid-web/target/orcid-web.war
- cd ${{ github.workspace }}/orcid-web/target/orcid-web
-
- # have a file on the webserver we can hit
- echo "$version_tag_numeric" > ${{ github.workspace }}/orcid-web/target/orcid-web/static/version
-
- echo "Creating the war file"
- jar -cf orcid-web.war .
-
- # check_error "Creating the orcid-web.war file"
- echo "Moving war file to the target folder"
- cp orcid-web.war ${{ github.workspace }}/orcid-web/target/
- echo "orcid-web.war is ready"
-
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
- project: "${{ matrix.artifact_name }}"
-
-##################################################################################################################
-
-
- - name: install orcid-api-common into our local maven repo because the deploy depends on this orcid-web orcid-iapi orcid-api
- if: ${{ matrix.artifact_name == 'orcid-web' }} || ${{ matrix.artifact_name == 'orcid-internal-api' }} || ${{ matrix.artifact_name == 'orcid-api-web' }} || ${{ matrix.artifact_name == 'orcid-pub-web' }}
- run: |
- mvn -T 1C --batch-mode clean install -DskipTests \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects orcid-api-common
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
-
- - name: deploy war file
- run: |
- mvn --batch-mode \
- --settings settings-deploy.xml \
- --file "${project}/pom.xml" \
- -Dmaven.test.skip \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- -DaltReleaseDeploymentRepository="github::${ARTIFACT_URL}${ARTIFACT_REPO_PATH}" \
- deploy -Dmaven.test.skip
- env:
- GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- ARTIFACT_URL: "${{ secrets.ARTIFACT_URL }}"
- ARTIFACT_REPO_PATH: "${{ secrets.ARTIFACT_REPO_PATH }}"
- ARTIFACT_USER: "${{ secrets.ARTIFACT_USER }}"
- ARTIFACT_PASSWORD: "${{ secrets.ARTIFACT_PASSWORD }}"
- project: "${{ matrix.artifact_name }}"
-
-
-
-
-
-
diff --git a/.github/workflows/bld_maven.yml b/.github/workflows/bld_mvn.yml
similarity index 85%
rename from .github/workflows/bld_maven.yml
rename to .github/workflows/bld_mvn.yml
index 4683cb8898b..5638a7b0dc8 100644
--- a/.github/workflows/bld_maven.yml
+++ b/.github/workflows/bld_mvn.yml
@@ -1,5 +1,4 @@
-name: bld_maven
-run-name: bld-{{ inputs.project }}
+name: bld_mvn
permissions:
checks: write
@@ -10,18 +9,13 @@ permissions:
on:
workflow_call:
inputs:
- project:
- description: 'Name of the artifact env'
- required: false
- default: 'prod'
- type: string
version_tag:
- description: 'Name of the tag to build'
+ description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
default: 'latest'
type: string
bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
+ description: 'whether to bump the version number by a major minor patch'
required: false
default: 'patch'
type: string
@@ -40,15 +34,14 @@ on:
type: boolean
required: false
default: true
-
+ deploy:
+ description: Whether to deploy the build to artifact repo
+ type: boolean
+ required: false
+ default: true
workflow_dispatch:
inputs:
- project:
- description: 'Name of the artifact env'
- required: false
- default: 'prod'
- type: string
version_tag:
description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
@@ -80,10 +73,29 @@ on:
type: boolean
required: false
default: true
-
+ deploy:
+ description: Whether to deploy the build to artifact repo
+ type: boolean
+ required: false
+ default: true
jobs:
- bld_maven:
+ bld_mvn:
+ strategy:
+ matrix:
+ include:
+ - project: orcid-message-listener
+ - project: orcid-activemq
+ - project: orcid-api-web
+ - project: orcid-internal-api
+ - project: orcid-pub-web
+ - project: orcid-scheduler-web
+ - project: orcid-web
+ - project: orcid-utils
+ - project: orcid-core
+ - project: orcid-persistence
+ - project: orcid-api-common
+
runs-on: ubuntu-latest
steps:
- name: git-checkout-ref-action
@@ -93,7 +105,7 @@ jobs:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
@@ -108,7 +120,7 @@ jobs:
bump: ${{ inputs.bump }}
- name: Set up Open JDK 11
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
@@ -117,7 +129,7 @@ jobs:
- name: if not installing dependencies restore special previous git_sha cache
if: ${{ ! inputs.install_maven_dependencies }}
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
@@ -136,7 +148,7 @@ jobs:
- name: if installing dependencies use a standard cache key name
if: ${{ inputs.install_maven_dependencies }}
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
@@ -167,20 +179,20 @@ jobs:
find . -name '*.war'
find . -name '*.jar'
env:
- project: "${{ inputs.project }}"
+ project: "${{ matrix.project }}"
#
# orcid-web customization
#
- name: setup node for angular static file
- if: ${{ inputs.project == 'orcid-web' }}
- uses: actions/setup-node@v3
+ if: ${{ matrix.project == 'orcid-web' }}
+ uses: actions/setup-node@v4
with:
node-version: 18.7.0
- name: build angular parts if we are building orcid-web
- if: ${{ inputs.project == 'orcid-web' }}
+ if: ${{ matrix.project == 'orcid-web' }}
run: |
echo "Build angular_orcid_generated.js"
cd orcid-nodejs
@@ -208,11 +220,12 @@ jobs:
env:
version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
- project: "${{ inputs.project }}"
+ project: "${{ matrix.project }}"
##################################################################################################################
- name: deploy war file
+ if: ${{ inputs.deploy }}
run: |
mvn --batch-mode \
--settings settings-deploy.xml \
@@ -227,5 +240,6 @@ jobs:
ARTIFACT_REPO_PATH: "${{ secrets.ARTIFACT_REPO_PATH }}"
ARTIFACT_USER: "${{ secrets.ARTIFACT_USER }}"
ARTIFACT_PASSWORD: "${{ secrets.ARTIFACT_PASSWORD }}"
- project: "${{ inputs.project }}"
+ project: "${{ matrix.project }}"
+
diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml
deleted file mode 100644
index fd8f1815b51..00000000000
--- a/.github/workflows/build_debug.yml
+++ /dev/null
@@ -1,101 +0,0 @@
-name: build_debug
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: "latest"
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or try gitlog'
- required: false
- default: "patch"
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: "latest"
- type: string
- bump:
- description: |
- How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
- '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
- required: false
- options:
- - patch
- - minor
- - major
- - none
- type: choice
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default_branch"
- type: string
-
-
-# cancel running job if another commit comes in
-concurrency:
- group: main-${{ github.ref }}-1
- cancel-in-progress: true
-
-jobs:
- seed_maven_cache:
- uses: ./.github/workflows/seed_maven_cache.yml
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- install_maven_dependencies:
- uses: ./.github/workflows/install_maven_dependencies.yml
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- needs:
- - seed_maven_cache
-
-
-##############################################################################
-
- unit_tests_publish:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- project: orcid-message-listener
- seed_maven_cache: false
- install_maven_dependencies: false
- needs:
- - install_maven_dependencies
-
- bld_ml:
- uses: ./.github/workflows/bld_maven.yml
- secrets: inherit # pass all secrets for uploading assets
- needs:
- - seed_maven_cache
- - unit_tests_publish
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- project: orcid-message-listener
- seed_maven_cache: false
- install_maven_dependencies: false
diff --git a/.github/workflows/build_test_release.yml b/.github/workflows/build_test_release.yml
deleted file mode 100644
index 8b7ef2b2e64..00000000000
--- a/.github/workflows/build_test_release.yml
+++ /dev/null
@@ -1,119 +0,0 @@
-name: build_test_release
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: "latest"
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or try gitlog'
- required: false
- default: "patch"
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: "latest"
- type: string
- bump:
- description: |
- How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
- '#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
- required: false
- options:
- - patch
- - minor
- - major
- - none
- type: choice
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default_branch"
- type: string
-
-
-# cancel running job if another commit comes in
-concurrency:
- group: main-${{ github.ref }}-1
- cancel-in-progress: true
-
-jobs:
-
- lint:
- uses: ./.github/workflows/lint.yml
-
- seed_maven_cache:
- uses: ./.github/workflows/seed_maven_cache.yml
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- install_maven_dependencies:
- uses: ./.github/workflows/install_maven_dependencies.yml
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- needs:
- - seed_maven_cache
-
- unit_tests_publish:
- uses: ./.github/workflows/unit_tests_publish.yml
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: false
- install_maven_dependencies: false
- needs:
- - lint
- - seed_maven_cache
- - install_maven_dependencies
-##############################################################################
- bld_all:
- uses: ./.github/workflows/bld_all.yml
- secrets: inherit # pass all secrets for uploading assets
- needs:
- - lint
- - unit_tests_publish
- - install_maven_dependencies
- permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
- seed_maven_cache: false
- install_maven_dependencies: false
-
-##############################################################################
-
-# rel_tag:
-# uses: ./.github/workflows/rel_tag.yml
-# needs: bld_all
-# with:
-# version_tag: ${{ inputs.version_tag }}
-# bump: ${{ inputs.bump }}
-# ref: ${{ inputs.ref }}
-# secrets: inherit # pass all secrets
-# permissions:
-# checks: write
-# contents: write
-# issues: read
-# pull-requests: write
diff --git a/.github/workflows/build_test_release_tag.yml b/.github/workflows/build_test_release_tag.yml
index 5a1665df619..209e0d99910 100644
--- a/.github/workflows/build_test_release_tag.yml
+++ b/.github/workflows/build_test_release_tag.yml
@@ -18,6 +18,12 @@ on:
required: false
default: "default"
type: string
+ rel_tag:
+ description: Whether to tag the code
+ type: boolean
+ required: false
+ default: true
+
workflow_dispatch:
inputs:
@@ -42,7 +48,11 @@ on:
required: false
default: "default_branch"
type: string
-
+ rel_tag:
+ description: Whether to tag the code
+ type: boolean
+ required: false
+ default: true
# cancel running job if another commit comes in
concurrency:
@@ -70,8 +80,8 @@ jobs:
needs:
- seed_maven_cache
- unit_tests_publish:
- uses: ./.github/workflows/unit_tests_publish.yml
+ mvn_test:
+ uses: ./.github/workflows/mvn_test.yml
with:
version_tag: ${{ inputs.version_tag }}
bump: ${{ inputs.bump }}
@@ -83,12 +93,12 @@ jobs:
- seed_maven_cache
- install_maven_dependencies
##############################################################################
- bld_all:
- uses: ./.github/workflows/bld_all.yml
+ bld_mvn:
+ uses: ./.github/workflows/bld_mvn.yml
secrets: inherit # pass all secrets for uploading assets
needs:
- lint
- - unit_tests_publish
+ - mvn_test
- install_maven_dependencies
permissions:
checks: write
@@ -106,7 +116,8 @@ jobs:
rel_tag:
uses: ./.github/workflows/rel_tag.yml
- needs: bld_all
+ needs: bld_mvn
+ if: ${{ inputs.rel_tag }}
with:
version_tag: ${{ inputs.version_tag }}
bump: ${{ inputs.bump }}
@@ -117,3 +128,4 @@ jobs:
contents: write
issues: read
pull-requests: write
+
diff --git a/.github/workflows/install_maven_dependencies.yml b/.github/workflows/install_maven_dependencies.yml
index 265c72c3a20..7c3332bdbdb 100644
--- a/.github/workflows/install_maven_dependencies.yml
+++ b/.github/workflows/install_maven_dependencies.yml
@@ -73,7 +73,7 @@ jobs:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
@@ -88,13 +88,13 @@ jobs:
bump: ${{ inputs.bump }}
- name: Set up Open JDK 11
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Restore the seeded cache but save dependencies into a new unique git sha hash with the expected version of the build
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a75a9f27b19..f7e9c0d9a33 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -16,17 +16,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-python@v4
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
with:
python-version: '3.10'
- - name: set PY
- run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> "$GITHUB_ENV"
- - uses: actions/cache@v3
- with:
- path: ~/.cache
- key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- # lockdown all 3rd party repos to git shas
- #- uses: cloudposse/github-action-pre-commit@32acf3179b9eda817c0f549e8057477d320827db
- # migrate to standard pre-commit
- - uses: pre-commit/action@5f528da5c95691c4cf42ff76a4d10854b62cbb82
+ - uses: pre-commit/action@576ff52938d158a24ac7e009dfa94b1455e7df99
diff --git a/.github/workflows/maven_test_artifact.yml b/.github/workflows/maven_test_artifact.yml
deleted file mode 100644
index c13b03e6538..00000000000
--- a/.github/workflows/maven_test_artifact.yml
+++ /dev/null
@@ -1,167 +0,0 @@
-name: maven_test_artifact
-
-# run maven tests and upload results as an artifact
-# can be run from a pr
-
-permissions:
- checks: write
- contents: read
- issues: read
- pull-requests: write
-
-on:
- workflow_call:
- inputs:
- project:
- description: 'Name of the artifact env'
- required: false
- default: 'prod'
- type: string
- version_tag:
- description: 'Name of the tag to build'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
- workflow_dispatch:
- inputs:
- project:
- description: 'Name of the artifact env'
- required: false
- default: 'prod'
- type: string
- version_tag:
- description: 'Name of the tag to build'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
-
-jobs:
- maven_test:
- runs-on: ubuntu-latest
- steps:
- - name: git-checkout-ref-action
- id: ref
- uses: ORCID/git-checkout-ref-action@main
- with:
- default_branch: ${{ github.event.repository.default_branch }}
- ref: ${{ inputs.ref }}
-
- - uses: actions/checkout@v3
- with:
- ref: ${{ steps.ref.outputs.ref }}
- # checkout some history so we can scan commits for bump messages
- # NOTE: history does not include tags!
- fetch-depth: 100
-
- - name: find next version
- id: version
- uses: ORCID/version-bump-action@main
- with:
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
-
- - name: Set up Open JDK 11
- uses: actions/setup-java@v3
- with:
- distribution: 'temurin'
- java-version: '11'
-
-########################################################################################
-# handle restoring a custom gha cache
-
- - name: if not installing dependencies restore special previous git_sha cache
- if: ${{ ! inputs.install_maven_dependencies }}
- uses: actions/cache@v3
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
-
- - name: bump version of the parent pom and connected projects
- if: ${{ ! inputs.install_maven_dependencies }}
- run: |
- mvn -T 1C --batch-mode versions:set -DskipTests \
- -DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false
- env:
- version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}"
-
-########################################################################################
-
- - name: if installing dependencies use a standard cache key name
- if: ${{ inputs.install_maven_dependencies }}
- uses: actions/cache@v3
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
- restore-keys: |
- ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
-
- - name: seed_maven_cache
- if: ${{ inputs.seed_maven_cache }}
- id: cache
- uses: ORCID/ORCID-Source-cache-action@main
- with:
- version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
-
- - name: install_dependencies and bump version
- if: ${{ inputs.install_maven_dependencies }}
- id: install_dependencies
- uses: ORCID/ORCID-Source-dependencies-action@main
- with:
- version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
-
-########################################################################################
- - name: "Test ${{ inputs.project }}"
- run: |
- mvn -T 1C --batch-mode -Dmaven.test.failure.ignore=true test \
- -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects ${{ inputs.project }}
-
- - uses: actions/upload-artifact@v3 # upload test results
- if: success() || failure() # run this step even if previous step failed
- with:
- name: ${{ inputs.project }}
- path: ${{ inputs.project }}/target/surefire-reports/*.xml
diff --git a/.github/workflows/maven_test_report.yml b/.github/workflows/maven_test_report.yml
deleted file mode 100644
index e44b1f70c99..00000000000
--- a/.github/workflows/maven_test_report.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: unit_test_report
-
-on:
- workflow_call:
- inputs:
- project:
- description: 'Name of the project in the repo'
- required: false
- default: "."
- type: string
-
- workflow_dispatch:
- inputs:
- project:
- description: 'Name of the project in the repo'
- required: false
- default: "."
- type: string
-
-jobs:
- report:
- runs-on: ubuntu-latest
- steps:
- - uses: dorny/test-reporter@e9fa2f582c0ebbe2e263fd18fad744d52e0b0203
- with:
- artifact: ${{ inputs.project }}
- name: "maven_test_report_${{ inputs.project }}" # Name of the check run which will be created
- path: '*.xml' # Path to test results (inside artifact .zip)
- reporter: java-junit # Format of test results
-
diff --git a/.github/workflows/maven_test_publish.yml b/.github/workflows/mvn_test.yml
similarity index 73%
rename from .github/workflows/maven_test_publish.yml
rename to .github/workflows/mvn_test.yml
index 33a6c1132d6..edb2f8d37a3 100644
--- a/.github/workflows/maven_test_publish.yml
+++ b/.github/workflows/mvn_test.yml
@@ -1,22 +1,13 @@
-name: maven_test_publish
-
-# run maven tests and publish results in one step
-# run from privileged branch
+name: mvn_test
permissions:
checks: write
contents: read
- issues: read
- pull-requests: write
+ actions: read
on:
workflow_call:
inputs:
- project:
- description: 'Name of the artifact env'
- required: false
- default: 'prod'
- type: string
version_tag:
description: 'Name of the tag to build'
required: false
@@ -45,11 +36,6 @@ on:
workflow_dispatch:
inputs:
- project:
- description: 'Name of the artifact env'
- required: false
- default: 'prod'
- type: string
version_tag:
description: 'Name of the tag to build'
required: false
@@ -78,7 +64,22 @@ on:
jobs:
- maven_test:
+ mvn_test:
+ strategy:
+ matrix:
+ include:
+ - project: orcid-message-listener
+ - project: orcid-activemq
+ - project: orcid-api-web
+ - project: orcid-internal-api
+ - project: orcid-pub-web
+ - project: orcid-scheduler-web
+ - project: orcid-web
+ - project: orcid-utils
+ - project: orcid-core
+ - project: orcid-persistence
+ - project: orcid-api-common
+
runs-on: ubuntu-latest
steps:
- name: git-checkout-ref-action
@@ -88,7 +89,7 @@ jobs:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
@@ -103,7 +104,7 @@ jobs:
bump: ${{ inputs.bump }}
- name: Set up Open JDK 11
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
@@ -113,7 +114,7 @@ jobs:
- name: if not installing dependencies restore special previous git_sha cache
if: ${{ ! inputs.install_maven_dependencies }}
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-${{ steps.version.outputs.version_tag_numeric }}-${{ github.sha }}
@@ -132,7 +133,7 @@ jobs:
- name: if installing dependencies use a standard cache key name
if: ${{ inputs.install_maven_dependencies }}
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
@@ -154,19 +155,24 @@ jobs:
version_tag_numeric: ${{ steps.version.outputs.version_tag_numeric }}
########################################################################################
- - name: "Test ${{ inputs.project }}"
+ - name: "Test ${{ matrix.project }}"
run: |
- mvn -T 1C --batch-mode -Dmaven.test.failure.ignore=true test \
+ mvn -T 1C --batch-mode test \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
- --projects ${{ inputs.project }}
+ --projects ${{ matrix.project }} --fail-at-end
- # NOTE: if the above test fail then this step will report that failure and stop the run
- - name: Publish Unit Test Results
- uses: dorny/test-reporter@e9fa2f582c0ebbe2e263fd18fad744d52e0b0203
- if: always()
+ - name: Publish unit test report for non forked repo
+ if: ${{ failure() && (github.event.pull_request.head.repo.full_name == github.repository) }} # only report if a test has failed and we are a non forked repo
+ uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
with:
- name: "maven_test_publish_${{ inputs.project }}"
- path: ${{ inputs.project }}/target/surefire-reports/*.xml
+ name: "Unit test report for ${{ matrix.project }}"
+ path: ${{ matrix.project }}/target/surefire-reports/*.xml
reporter: java-junit
fail-on-error: true
+ - name: Annotate only test report for forked repo
+ uses: mikepenz/action-junit-report@ec3a351c13e080dc4fa94c49ab7ad5bf778a9668 # v5
+ if: ${{ failure() && (github.event.pull_request.head.repo.full_name != github.repository) }} # only report if a test has failed and we are a forked repo
+ with:
+ report_paths: ${{ matrix.project }}/target/surefire-reports/*.xml
+ annotate_only: true # forked repo cannot write to checks so just do annotations
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index c243064af80..f151c70e622 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -17,8 +17,11 @@ concurrency:
cancel-in-progress: true
jobs:
- unit_tests_artifact:
- uses: ./.github/workflows/unit_tests_artifact.yml
+ lint:
+ uses: ./.github/workflows/lint.yml
+
+ mvn_test:
+ uses: ./.github/workflows/mvn_test.yml
with:
seed_maven_cache: true
install_maven_dependencies: true
diff --git a/.github/workflows/pr_completed.yml b/.github/workflows/pr_completed.yml
deleted file mode 100644
index 3d007a37690..00000000000
--- a/.github/workflows/pr_completed.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: pr_completed
-
-# this is a privileged workflow that can run with secrets
-# to perform actions on work carried out in the pull_request workflow
-
-on:
- workflow_run:
- workflows:
- - pr
- types:
- - completed
-
- workflow_call:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: "next_tag"
- type: string
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: "next_tag"
- type: string
-
-jobs:
- unit_tests_report:
- uses: ./.github/workflows/unit_tests_report.yml
-
diff --git a/.github/workflows/rel_tag.yml b/.github/workflows/rel_tag.yml
index e125ac11d9a..529dc0bafb2 100644
--- a/.github/workflows/rel_tag.yml
+++ b/.github/workflows/rel_tag.yml
@@ -64,7 +64,7 @@ jobs:
ref: ${{ inputs.ref }}
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
# token with write permissions to protected branches
# standard github token does not allow this
diff --git a/.github/workflows/seed_maven_cache.yml b/.github/workflows/seed_maven_cache.yml
index aaf8d64d3b1..55eae9d17e3 100644
--- a/.github/workflows/seed_maven_cache.yml
+++ b/.github/workflows/seed_maven_cache.yml
@@ -71,7 +71,7 @@ jobs:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
@@ -86,13 +86,13 @@ jobs:
bump: ${{ inputs.bump }}
- name: Set up Open JDK 11
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Cache local Maven repository keyed off the pom
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-seed-cache
diff --git a/.github/workflows/unit_tests_artifact.yml b/.github/workflows/unit_tests_artifact.yml
deleted file mode 100644
index 2340da69799..00000000000
--- a/.github/workflows/unit_tests_artifact.yml
+++ /dev/null
@@ -1,144 +0,0 @@
-name: unit_tests_artifact
-
-# Run tests and upload the results as an artifact
-# Can be run from a unprivileged pull_request action
-# Reporting is done in the pr_completed.yml workflow
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'Name of the tag to build'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'Name of the tag to build'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
-jobs:
- tst_ml:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-message-listener
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_amq:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-activemq
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_api:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-api-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_iapi:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-internal-api
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_pubweb:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-pub-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_sched:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-scheduler-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_web:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-##########################################################
-
- tst_utils:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-utils
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_core:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-core
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_persistence:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-persistence
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
- tst_api_common:
- uses: ./.github/workflows/maven_test_artifact.yml
- with:
- project: orcid-api-common
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
-
-
diff --git a/.github/workflows/unit_tests_publish.yml b/.github/workflows/unit_tests_publish.yml
deleted file mode 100644
index e8cdbcdf91d..00000000000
--- a/.github/workflows/unit_tests_publish.yml
+++ /dev/null
@@ -1,180 +0,0 @@
-name: unit_tests_publish
-
-# full unit tests with report publishing
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'Name of the tag to build'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'Name of the tag to build'
- required: false
- default: 'latest'
- type: string
- bump:
- description: 'whether to bump the version number by a major minor patch amount or none'
- required: false
- default: 'patch'
- type: string
- ref:
- description: 'git reference to use with the checkout use default_branch to have that calculated'
- required: false
- default: "default"
- type: string
- seed_maven_cache:
- description: Whether to seed cache
- type: boolean
- required: false
- default: true
- install_maven_dependencies:
- description: Whether to install dependencies or use a previous cache
- type: boolean
- required: false
- default: true
-
-jobs:
-
-
- tst_ml:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-message-listener
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_amq:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-activemq
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_api:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-api-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_iapi:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-internal-api
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_pubweb:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-pub-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_sched:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-scheduler-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_web:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-web
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
-####################################################################
-
- tst_utils:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-utils
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_core:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-core
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_persistence:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-persistence
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
- tst_api_common:
- uses: ./.github/workflows/maven_test_publish.yml
- with:
- project: orcid-api-common
- seed_maven_cache: ${{ inputs.seed_maven_cache }}
- install_maven_dependencies: ${{ inputs.install_maven_dependencies }}
- version_tag: ${{ inputs.version_tag }}
- bump: ${{ inputs.bump }}
- ref: ${{ inputs.ref }}
-
-# codeql:
-# uses: ./.github/workflows/codeql.yml
-#
diff --git a/.github/workflows/unit_tests_report.yml b/.github/workflows/unit_tests_report.yml
deleted file mode 100644
index f3c5149dd01..00000000000
--- a/.github/workflows/unit_tests_report.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-name: unit_tests_report
-
-on:
- workflow_call:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: latest
- type: string
-
- workflow_dispatch:
- inputs:
- version_tag:
- description: 'version tag to use(vx.x.x)'
- required: false
- default: latest
- type: string
-
-jobs:
-
- tst_ml:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-message-listener
-
- tst_amq:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-activemq
-
- tst_api:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-api-web
-
- tst_iapi:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-internal-api
-
- tst_pubweb:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-pub-web
-
- tst_sched:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-scheduler-web
-
- tst_web:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-web
-
-#########################################################################################
-
- tst_utils:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-utils
-
- tst_core:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-core
-
- tst_persistence:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-persistence
-
- tst_api_common:
- uses: ./.github/workflows/maven_test_report.yml
- with:
- project: orcid-api-common
-
From 501dab79bb3e6952c67732fa485e623dc7811560 Mon Sep 17 00:00:00 2001
From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com>
Date: Thu, 7 Nov 2024 17:07:29 +0000
Subject: [PATCH 02/15] Fixed the 500 when client reached the limit. (#7128)
* Fixed the 500 when client reached the limit.
* Remove extrawhite space
---
.../orcid/core/template/papi_rate_limit_email.ftl | 2 +-
.../core/template/papi_rate_limit_email_html.ftl | 3 ---
.../org/orcid/api/filters/ApiRateLimitFilter.java | 12 +++++++++---
.../orcid/scheduler/report/PapiDailyLimitReport.java | 4 ++--
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email.ftl b/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email.ftl
index 0c4345237cd..942550a8898 100644
--- a/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email.ftl
+++ b/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email.ftl
@@ -15,5 +15,5 @@ To minimize any disruption to your ORCID integration in the future, we would rec
Warm Regards,
ORCID Support Team
https://support.orcid.org
-<@emailMacros.msg "email.common.you_have_received_this_email" />
+
<#include "email_footer.ftl"/>
diff --git a/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email_html.ftl b/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email_html.ftl
index 569cb86ebe3..f7d4ebca59b 100644
--- a/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email_html.ftl
+++ b/orcid-core/src/main/resources/org/orcid/core/template/papi_rate_limit_email_html.ftl
@@ -25,9 +25,6 @@
- <@emailMacros.msg "email.common.you_have_received_this_email" />
-
-
<#include "email_footer_html.ftl"/>
diff --git a/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java b/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
index daa982cae36..e2f9aae1dd6 100644
--- a/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
+++ b/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
@@ -37,6 +37,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.MessageSource;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
@@ -79,6 +80,9 @@ public class ApiRateLimitFilter extends OncePerRequestFilter {
@Autowired
private OrcidTokenStore orcidTokenStore;
+
+ @Autowired
+ private MessageSource messageSource;
@Value("${org.orcid.papi.rate.limit.anonymous.requests:10000}")
private int anonymousRequestLimit;
@@ -202,8 +206,10 @@ private void rateLimitClientRequest(String clientId, LocalDate today) {
private Map createTemplateParams(String clientId, String clientName, String emailName, String orcidId) {
Map templateParams = new HashMap();
+ templateParams.put("messages", messageSource);
+ templateParams.put("messageArgs", new Object[0]);
templateParams.put("clientId", clientId);
- templateParams.put("clientId", clientName);
+ templateParams.put("clientName", clientName);
templateParams.put("emailName", emailName);
templateParams.put("locale", LocaleUtils.toLocale("en"));
templateParams.put("baseUri", orcidUrlManager.getBaseUrl());
@@ -218,9 +224,9 @@ private void sendEmail(String clientId, LocalDate requestDate) {
String emailName = recordNameManager.deriveEmailFriendlyName(profile.getId());
Map templateParams = this.createTemplateParams(clientId, clientDetailsEntity.getClientName(), emailName, profile.getId());
// Generate body from template
- String body = templateManager.processTemplate("bad_orgs_email.ftl", templateParams);
+ String body = templateManager.processTemplate("papi_rate_limit_email.ftl", templateParams);
// Generate html from template
- String html = templateManager.processTemplate("bad_orgs_email_html.ftl", templateParams);
+ String html = templateManager.processTemplate("papi_rate_limit_email_html.ftl", templateParams);
String email = emailManager.findPrimaryEmail(profile.getId()).getEmail();
LOG.info("text email={}", body);
diff --git a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/report/PapiDailyLimitReport.java b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/report/PapiDailyLimitReport.java
index 898a1896c87..73b1b4258c1 100644
--- a/orcid-scheduler-web/src/main/java/org/orcid/scheduler/report/PapiDailyLimitReport.java
+++ b/orcid-scheduler-web/src/main/java/org/orcid/scheduler/report/PapiDailyLimitReport.java
@@ -71,8 +71,8 @@ public void papiDailyLimitReport() {
if (enableRateLimiting) {
LocalDate yesterday = LocalDate.now().minusDays(1);
String mode = Features.ENABLE_PAPI_RATE_LIMITING.isActive() ? "ENFORCEMENT" : "MONITORING";
- String SLACK_INTRO_MSG = "Public API Rate limit report - Date: " + yesterday.toString() + "\n Current Anonymous Requests Limit: " + anonymousRequestLimit
- + "\nCurrent Public API Clients Limit: " + knownRequestLimit + "\n Mode: " + mode;
+ String SLACK_INTRO_MSG = "Public API Rate limit report - Date: " + yesterday.toString() + "\nCurrent Anonymous Requests Limit: " + anonymousRequestLimit
+ + "\nCurrent Public API Clients Limit: " + knownRequestLimit + "\nMode: " + mode;
LOG .info(SLACK_INTRO_MSG);
slackManager.sendAlert(SLACK_INTRO_MSG, slackChannel, webhookUrl, webhookUrl);
From 471cb318737ca495992c538fb6ae8cf20384b858 Mon Sep 17 00:00:00 2001
From: github actions
Date: Thu, 7 Nov 2024 17:21:45 +0000
Subject: [PATCH 03/15] v2.67.13 changelog update
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aec7e03e174..5231d45e93c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v2.67.13 - 2024-11-07
+
+[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.12...v2.67.13)
+
## v2.67.12 - 2024-11-06
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.11...v2.67.12)
From 7324940810fc282379b12e7bf0a499ffe694775e Mon Sep 17 00:00:00 2001
From: Giles Westwood
Date: Thu, 7 Nov 2024 18:04:54 +0000
Subject: [PATCH 04/15] more concistent naming
---
.github/workflows/build_test_release_tag.yml | 6 +++---
.github/workflows/pr.yml | 4 ++--
.github/workflows/{mvn_test.yml => test_mvn.yml} | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
rename .github/workflows/{mvn_test.yml => test_mvn.yml} (99%)
diff --git a/.github/workflows/build_test_release_tag.yml b/.github/workflows/build_test_release_tag.yml
index 209e0d99910..ce821970320 100644
--- a/.github/workflows/build_test_release_tag.yml
+++ b/.github/workflows/build_test_release_tag.yml
@@ -80,8 +80,8 @@ jobs:
needs:
- seed_maven_cache
- mvn_test:
- uses: ./.github/workflows/mvn_test.yml
+ test_mvn:
+ uses: ./.github/workflows/test_mvn.yml
with:
version_tag: ${{ inputs.version_tag }}
bump: ${{ inputs.bump }}
@@ -98,7 +98,7 @@ jobs:
secrets: inherit # pass all secrets for uploading assets
needs:
- lint
- - mvn_test
+ - test_mvn
- install_maven_dependencies
permissions:
checks: write
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index f151c70e622..4b13881b9b4 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -20,8 +20,8 @@ jobs:
lint:
uses: ./.github/workflows/lint.yml
- mvn_test:
- uses: ./.github/workflows/mvn_test.yml
+ test_mvn:
+ uses: ./.github/workflows/test_mvn.yml
with:
seed_maven_cache: true
install_maven_dependencies: true
diff --git a/.github/workflows/mvn_test.yml b/.github/workflows/test_mvn.yml
similarity index 99%
rename from .github/workflows/mvn_test.yml
rename to .github/workflows/test_mvn.yml
index edb2f8d37a3..65e1190174c 100644
--- a/.github/workflows/mvn_test.yml
+++ b/.github/workflows/test_mvn.yml
@@ -1,4 +1,4 @@
-name: mvn_test
+name: test_mvn
permissions:
checks: write
@@ -64,7 +64,7 @@ on:
jobs:
- mvn_test:
+ test_mvn:
strategy:
matrix:
include:
From e5a5bfd6076eacd56d606e1e0dd949d8f27635c9 Mon Sep 17 00:00:00 2001
From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com>
Date: Thu, 7 Nov 2024 19:53:27 +0000
Subject: [PATCH 05/15] Exception catching for papi limit filter (#7132)
* Exception catching for papi limit filter
* Logging the email as well
---
.../orcid/api/filters/ApiRateLimitFilter.java | 51 ++++++++++---------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java b/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
index e2f9aae1dd6..58779274a40 100644
--- a/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
+++ b/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
@@ -80,7 +80,7 @@ public class ApiRateLimitFilter extends OncePerRequestFilter {
@Autowired
private OrcidTokenStore orcidTokenStore;
-
+
@Autowired
private MessageSource messageSource;
@@ -95,9 +95,9 @@ public class ApiRateLimitFilter extends OncePerRequestFilter {
@Value("${org.orcid.persistence.panoply.papiExceededRate.production:false}")
private boolean enablePanoplyPapiExceededRateInProduction;
-
+
@Value("${org.orcid.papi.rate.limit.ip.whiteSpaceSeparatedWhiteList:127.0.0.1}")
- private String papiWhiteSpaceSeparatedWhiteList;
+ private String papiWhiteSpaceSeparatedWhiteList;
private static final String TOO_MANY_REQUESTS_MSG = "Too Many Requests - You have exceeded the daily allowance of API calls.\\n"
+ "You can increase your daily quota by registering for and using Public API client credentials "
@@ -127,20 +127,22 @@ protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServl
}
boolean isAnonymous = (clientId == null);
LocalDate today = LocalDate.now();
+ try {
+ if (isAnonymous) {
+ if (!isWhiteListed(ipAddress)) {
+ LOG.info("ApiRateLimitFilter anonymous request for ip: " + ipAddress);
+ this.rateLimitAnonymousRequest(ipAddress, today, httpServletResponse);
+ }
- if (isAnonymous ) {
- if(!isWhiteListed(ipAddress)) {
- LOG.info("ApiRateLimitFilter anonymous request for ip: " + ipAddress);
- this.rateLimitAnonymousRequest(ipAddress, today, httpServletResponse);
+ } else {
+ LOG.info("ApiRateLimitFilter client request with clientId: " + clientId);
+ this.rateLimitClientRequest(clientId, today);
}
-
- } else {
- LOG.info("ApiRateLimitFilter client request with clientId: " + clientId);
- this.rateLimitClientRequest(clientId, today);
+ } catch (Exception ex) {
+ LOG.error("Papi Limiting Filter unexpected error, ignore and chain request.", ex);
}
-
- filterChain.doFilter(httpServletRequest, httpServletResponse);
}
+ filterChain.doFilter(httpServletRequest, httpServletResponse);
}
private void rateLimitAnonymousRequest(String ipAddress, LocalDate today, HttpServletResponse httpServletResponse) throws IOException {
@@ -243,7 +245,7 @@ private void sendEmail(String clientId, LocalDate requestDate) {
// Send the email
boolean mailSent = mailGunManager.sendEmail(FROM_ADDRESS, email, SUBJECT, body, html);
if (!mailSent) {
- throw new RuntimeException("Failed to send email for papi limits, orcid=" + profile.getId());
+ LOG.error("Failed to send email for papi limits, orcid=" + profile.getId() + " email: " + email);
}
}
@@ -264,33 +266,34 @@ private void setPapiRateExceededItemInPanoply(PanoplyPapiDailyRateExceededItem i
});
}
-
- //gets actual client IP address, using the headers that the proxy server ads
+
+ // gets actual client IP address, using the headers that the proxy server
+ // ads
private String getClientIpAddress(HttpServletRequest request) {
String ipAddress = request.getHeader("X-FORWARDED-FOR");
if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) {
ipAddress = request.getHeader("X-REAL-IP");
}
if (ipAddress == null || ipAddress.isEmpty() || "unknown".equalsIgnoreCase(ipAddress)) {
- ipAddress = request.getRemoteAddr();
+ ipAddress = request.getRemoteAddr();
}
if (ipAddress != null && ipAddress.contains(",")) {
ipAddress = ipAddress.split(",")[0].trim();
}
return ipAddress;
- }
-
+ }
+
private boolean isWhiteListed(String ipAddress) {
List papiIpWhiteList = null;
- if(StringUtils.isNotBlank(papiWhiteSpaceSeparatedWhiteList)) {
+ if (StringUtils.isNotBlank(papiWhiteSpaceSeparatedWhiteList)) {
papiIpWhiteList = Arrays.asList(papiWhiteSpaceSeparatedWhiteList.split("\\s"));
}
-
- if(papiIpWhiteList != null) {
+
+ if (papiIpWhiteList != null) {
return papiIpWhiteList.contains(ipAddress);
-
+
}
- return false;
+ return false;
}
}
From 8223bda6e603daf8e0e403bdc94cac411ef4306c Mon Sep 17 00:00:00 2001
From: github actions
Date: Thu, 7 Nov 2024 20:07:53 +0000
Subject: [PATCH 06/15] v2.67.14 changelog update
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5231d45e93c..c529ed272a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v2.67.14 - 2024-11-07
+
+[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.13...v2.67.14)
+
## v2.67.13 - 2024-11-07
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.12...v2.67.13)
From a76a8d3d0b5ee0fe6b8f9058eecfabfdeaf6c41b Mon Sep 17 00:00:00 2001
From: Leonardo Mendoza Fernadez
Date: Thu, 7 Nov 2024 19:36:12 -0600
Subject: [PATCH 07/15] lmendoza/9453-update-node-version
---
orcid-web-frontend/pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/orcid-web-frontend/pom.xml b/orcid-web-frontend/pom.xml
index d85c0f6c5b3..d8e4453975d 100644
--- a/orcid-web-frontend/pom.xml
+++ b/orcid-web-frontend/pom.xml
@@ -46,8 +46,8 @@
1.8.0
- v16.20.0
- v1.19.1
+ v20.15.0
+ v1.22.2
https://nodejs.org/dist/
${nodejs.workingDirectory}
temp
From 5322c787420ea6dc9408a101e1ebfabf57c5e25a Mon Sep 17 00:00:00 2001
From: Giles Westwood
Date: Fri, 8 Nov 2024 12:09:50 +0000
Subject: [PATCH 08/15] chore: bump node version
---
.tool-versions | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.tool-versions b/.tool-versions
index 5732f21e547..3cda07c9926 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,4 +1,4 @@
-nodejs 18.7.0
+nodejs 20.15.0
java temurin-11.0.15+10
maven 3.6.3
mvnd 0.9.0
From d0b176deae2693eb1a413ebcb8547e5ac5002a5e Mon Sep 17 00:00:00 2001
From: Giles Westwood
Date: Fri, 8 Nov 2024 12:10:55 +0000
Subject: [PATCH 09/15] feat: helper command comments for yarn corepack install
---
.tool-versions | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.tool-versions b/.tool-versions
index 3cda07c9926..5299f598cf8 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,4 +1,8 @@
+# RUN export ASDF_NODEJS_AUTO_ENABLE_COREPACK=yes
+# RUN export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
nodejs 20.15.0
+# RUN corepack enable
+# RUN asdf reshim nodejs
java temurin-11.0.15+10
maven 3.6.3
mvnd 0.9.0
From c9db1c524665072b005b6ea04a74aed43e2d2f99 Mon Sep 17 00:00:00 2001
From: github actions
Date: Fri, 8 Nov 2024 12:46:03 +0000
Subject: [PATCH 10/15] v2.67.15 changelog update
---
CHANGELOG.md | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c529ed272a1..60bc8b7d8d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+## v2.67.15 - 2024-11-08
+
+[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.14...v2.67.15)
+
+- [#7133](https://github.com/ORCID/ORCID-Source/pull/7133): lmendoza/9453-update-node-version
+- [#7130](https://github.com/ORCID/ORCID-Source/pull/7130): refactor/matrix-and-fork-detection-bldtest
+
+### Feature
+
+- helper command comments for yarn corepack install
+
## v2.67.14 - 2024-11-07
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.13...v2.67.14)
From 54a18884f449563db4e185c9744118d0baf8ce32 Mon Sep 17 00:00:00 2001
From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com>
Date: Fri, 8 Nov 2024 15:24:34 +0000
Subject: [PATCH 11/15] Added a notify email address (#7134)
* Added a notify email address
* logging from address
---
.../main/java/org/orcid/api/filters/ApiRateLimitFilter.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java b/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
index 58779274a40..1801ef79651 100644
--- a/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
+++ b/orcid-pub-web/src/main/java/org/orcid/api/filters/ApiRateLimitFilter.java
@@ -104,7 +104,9 @@ public class ApiRateLimitFilter extends OncePerRequestFilter {
+ "(https://info.orcid.org/documentation/integration-guide/registering-a-public-api-client/ )";
private static final String SUBJECT = "[ORCID] You have exceeded the daily Public API Usage Limit - ";
- private static final String FROM_ADDRESS = "\"Engagement Team, ORCID\" ";
+
+ @Value("${org.orcid.papi.rate.limit.fromEmail:notify@notify.orcid.org}")
+ private String FROM_ADDRESS;
@Override
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain)
@@ -230,7 +232,7 @@ private void sendEmail(String clientId, LocalDate requestDate) {
// Generate html from template
String html = templateManager.processTemplate("papi_rate_limit_email_html.ftl", templateParams);
String email = emailManager.findPrimaryEmail(profile.getId()).getEmail();
-
+ LOG.info("from address={}", FROM_ADDRESS);
LOG.info("text email={}", body);
LOG.info("html email={}", html);
if (enablePanoplyPapiExceededRateInProduction) {
From 6250a3d584b16ef405681c7ad85b752266f4bed1 Mon Sep 17 00:00:00 2001
From: github actions
Date: Fri, 8 Nov 2024 15:36:26 +0000
Subject: [PATCH 12/15] v2.67.16 changelog update
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60bc8b7d8d2..e71f7b15a46 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v2.67.16 - 2024-11-08
+
+[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.15...v2.67.16)
+
## v2.67.15 - 2024-11-08
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.14...v2.67.15)
From 886fa94e12daefbc99ce287e4049ea9ab14da799 Mon Sep 17 00:00:00 2001
From: github actions
Date: Wed, 13 Nov 2024 20:07:41 +0000
Subject: [PATCH 13/15] v2.68.0 changelog update
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e71f7b15a46..1f83afc6f41 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v2.68.0 - 2024-11-13
+
+[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.16...v2.68.0)
+
## v2.67.16 - 2024-11-08
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.15...v2.67.16)
From 79fef44bc6f624d362b72aa83327fdd6c0316cd6 Mon Sep 17 00:00:00 2001
From: andrej romanov <50377758+auumgn@users.noreply.github.com>
Date: Wed, 13 Nov 2024 22:09:14 +0200
Subject: [PATCH 14/15] Add verification date to summary.json and mapi summary
endpoint (#7124)
* add summary pojo assertions
* set verification date
* add more tests
* add test
* add exception throws
* fix naming
---
.../manager/impl/SummaryManagerImpl.java | 10 +-
.../impl/ProfileEmailDomainManagerImpl.java | 11 +-
...ProfileEmailDomainManagerReadOnlyImpl.java | 8 +-
.../org/orcid/core/model/EmailDomain.java | 15 +-
.../pojo/summary/EmailDomainSummary.java | 18 +-
.../common/manager/SummaryManagerTest.java | 29 ++-
.../v3/ProfileEmailDomainManagerTest.java | 192 ++++++++++++++++++
.../entities/ProfileEmailDomainEntity.java | 11 +
pom.xml | 5 +-
9 files changed, 274 insertions(+), 25 deletions(-)
create mode 100644 orcid-core/src/test/java/org/orcid/core/manager/v3/ProfileEmailDomainManagerTest.java
diff --git a/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java
index 3fcd322e53d..c815b9e24bf 100644
--- a/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java
+++ b/orcid-core/src/main/java/org/orcid/core/common/manager/impl/SummaryManagerImpl.java
@@ -43,11 +43,7 @@
import org.orcid.core.utils.JsonUtils;
import org.orcid.core.utils.cache.redis.RedisClient;
import org.orcid.core.utils.v3.SourceUtils;
-import org.orcid.jaxb.model.v3.release.common.CreatedDate;
-import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
-import org.orcid.jaxb.model.v3.release.common.LastModifiedDate;
-import org.orcid.jaxb.model.v3.release.common.Source;
-import org.orcid.jaxb.model.v3.release.common.Visibility;
+import org.orcid.jaxb.model.v3.release.common.*;
import org.orcid.jaxb.model.v3.release.record.AffiliationType;
import org.orcid.jaxb.model.v3.release.record.Group;
import org.orcid.jaxb.model.v3.release.record.GroupableActivity;
@@ -286,6 +282,7 @@ public RecordSummaryPojo getRecordSummaryPojo(String orcid) {
for (EmailDomain ed : recordSummary.getEmailDomains().getEmailDomains()) {
EmailDomainSummary eds = new EmailDomainSummary();
eds.setValue(ed.getValue());
+ eds.setVerificationDate(ed.getVerificationDate().toString());
emailDomains.add(eds);
}
}
@@ -524,6 +521,7 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci
for (ProfileEmailDomainEntity ped : emailDomains) {
ed = new EmailDomain();
ed.setValue(ped.getEmailDomain());
+ ed.setVerificationDate( new VerificationDate(DateUtils.convertToXMLGregorianCalendar(ped.getDateCreated())));
edList.add(ed);
}
}
@@ -531,6 +529,7 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci
edList.stream().limit(3).forEach(t -> {
EmailDomain ed = new EmailDomain();
ed.setValue(t.getValue());
+ ed.setVerificationDate(t.getVerificationDate());
emailDomainsTop3.add(ed);
});
@@ -538,7 +537,6 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci
eds.setCount(edList.size());
if (!emailDomainsTop3.isEmpty()) {
eds.setEmailDomains(emailDomainsTop3);
-
}
recordSummary.setEmailDomains(eds);
diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java
index ecbf129bd04..e4adee923e8 100644
--- a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java
+++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileEmailDomainManagerImpl.java
@@ -42,6 +42,9 @@ public class ProfileEmailDomainManagerImpl extends ProfileEmailDomainManagerRead
@Transactional
public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newEmails) {
+ if (orcid == null || orcid.isBlank()) {
+ throw new IllegalArgumentException("ORCID must not be empty");
+ }
List existingEmailDomains = profileEmailDomainDao.findByOrcid(orcid);
if (existingEmailDomains != null) {
@@ -55,7 +58,6 @@ public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newE
}
}
}
-
// REMOVE DOMAINS
for (ProfileEmailDomainEntity existingEmailDomain : existingEmailDomains) {
boolean deleteEmail = true;
@@ -73,6 +75,13 @@ public void updateEmailDomains(String orcid, org.orcid.pojo.ajaxForm.Emails newE
}
public void processDomain(String orcid, String email) {
+ if (email == null || email.isBlank()) {
+ throw new IllegalArgumentException("Email must not be empty");
+ }
+ if (orcid == null || orcid.isBlank()) {
+ throw new IllegalArgumentException("ORCID must not be empty");
+ }
+
String domain = email.split("@")[1];
EmailDomainEntity domainInfo = emailDomainDao.findByEmailDomain(domain);
// Check if email is professional
diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java
index dc97b2fb9c1..88d9cf453da 100644
--- a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java
+++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileEmailDomainManagerReadOnlyImpl.java
@@ -16,17 +16,17 @@
*/
public class ProfileEmailDomainManagerReadOnlyImpl extends ManagerReadOnlyBaseImpl implements ProfileEmailDomainManagerReadOnly {
@Resource
- protected ProfileEmailDomainDao profileEmailDomainDao;
+ protected ProfileEmailDomainDao profileEmailDomainDaoReadOnly;
public void setProfileEmailDomainDao(ProfileEmailDomainDao profileEmailDomainDao) {
- this.profileEmailDomainDao = profileEmailDomainDao;
+ this.profileEmailDomainDaoReadOnly = profileEmailDomainDao;
}
public List getEmailDomains(String orcid) {
- return profileEmailDomainDao.findByOrcid(orcid);
+ return profileEmailDomainDaoReadOnly.findByOrcid(orcid);
};
public List getPublicEmailDomains(String orcid) {
- return profileEmailDomainDao.findPublicEmailDomains(orcid);
+ return profileEmailDomainDaoReadOnly.findPublicEmailDomains(orcid);
};
}
diff --git a/orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java b/orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java
index 371b7948f04..5b1686f6e99 100644
--- a/orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java
+++ b/orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java
@@ -10,18 +10,22 @@
import javax.xml.bind.annotation.XmlType;
import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
+import org.orcid.jaxb.model.v3.release.common.VerificationDate;
import org.orcid.pojo.ajaxForm.Date;
import io.swagger.v3.oas.annotations.media.Schema;
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(propOrder = { "value"})
+@XmlType(propOrder = { "value", "verificationDate"})
@XmlRootElement(name = "email-domain", namespace = "http://www.orcid.org/ns/summary")
@Schema(description = "Email Domain")
public class EmailDomain {
@XmlElement(name = "value", namespace = "http://www.orcid.org/ns/summary")
protected String value;
+ @XmlElement(name = "verification-date", namespace = "http://www.orcid.org/ns/summary")
+ protected VerificationDate verificationDate;
+
public String getValue() {
return value;
}
@@ -29,7 +33,14 @@ public String getValue() {
public void setValue(String value) {
this.value = value;
}
-
+
+ public VerificationDate getVerificationDate() {
+ return verificationDate;
+ }
+
+ public void setVerificationDate(VerificationDate verificationDate) {
+ this.verificationDate = verificationDate;
+ }
@Override
public int hashCode() {
diff --git a/orcid-core/src/main/java/org/orcid/pojo/summary/EmailDomainSummary.java b/orcid-core/src/main/java/org/orcid/pojo/summary/EmailDomainSummary.java
index a8e6c1ba0a8..bef7d779415 100644
--- a/orcid-core/src/main/java/org/orcid/pojo/summary/EmailDomainSummary.java
+++ b/orcid-core/src/main/java/org/orcid/pojo/summary/EmailDomainSummary.java
@@ -1,11 +1,16 @@
package org.orcid.pojo.summary;
+import org.orcid.jaxb.model.v3.release.common.VerificationDate;
import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
+import org.orcid.pojo.ajaxForm.Date;
import org.orcid.pojo.ajaxForm.PojoUtil;
+import org.orcid.utils.DateUtils;
public class EmailDomainSummary {
private String value;
+ public String verificationDate;
+
public String getValue() {
return value;
}
@@ -14,7 +19,15 @@ public void setValue(String value) {
this.value = value;
}
-
+ public String getVerificationDate() {
+ return verificationDate;
+ }
+
+ public void setVerificationDate(String verificationDate) {
+ this.verificationDate = verificationDate;
+ }
+
+
public static EmailDomainSummary valueOf(ProfileEmailDomainEntity pem) {
EmailDomainSummary form = new EmailDomainSummary();
@@ -22,9 +35,8 @@ public static EmailDomainSummary valueOf(ProfileEmailDomainEntity pem) {
if(!PojoUtil.isEmpty(pem.getEmailDomain())) {
form.setValue(pem.getEmailDomain());
}
+ form.setVerificationDate(DateUtils.convertToXMLGregorianCalendar(pem.getDateCreated()).toString());
}
return form;
}
-
-
}
diff --git a/orcid-core/src/test/java/org/orcid/core/common/manager/SummaryManagerTest.java b/orcid-core/src/test/java/org/orcid/core/common/manager/SummaryManagerTest.java
index 61e4ac2e8f1..f6367c52d44 100644
--- a/orcid-core/src/test/java/org/orcid/core/common/manager/SummaryManagerTest.java
+++ b/orcid-core/src/test/java/org/orcid/core/common/manager/SummaryManagerTest.java
@@ -15,6 +15,7 @@
import javax.annotation.Resource;
import javax.xml.datatype.XMLGregorianCalendar;
+import com.oracle.truffle.api.profiles.Profile;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -81,6 +82,7 @@
public class SummaryManagerTest {
private final String ORCID = "0000-0000-0000-0000";
private final String CLIENT1 = "APP-0000";
+ private final String EMAIL_DOMAIN = "orcid.org";
public SummaryManagerImpl manager = new SummaryManagerImpl();
@@ -165,10 +167,9 @@ public void setUp() {
ReflectionTestUtils.setField(manager, "researchResourceManagerReadOnly", researchResourceManagerReadOnlyMock);
// Set EmailDomains
- EmailDomains emailDomains = getEmailDomains();
- Mockito.when(profileEmailDomainManagerReadOnlyMock.getPublicEmailDomains(Mockito.eq(ORCID))).thenReturn(new ArrayList());
+ List emailDomains = getEmailDomains();
+ Mockito.when(profileEmailDomainManagerReadOnlyMock.getPublicEmailDomains(Mockito.eq(ORCID))).thenReturn(emailDomains);
ReflectionTestUtils.setField(manager, "profileEmailDomainManagerReadOnly", profileEmailDomainManagerReadOnlyMock);
-
// Set metadata
OrcidIdentifier oi = new OrcidIdentifier();
@@ -557,7 +558,11 @@ public void getSummaryTest() {
// Peer review
assertEquals(Integer.valueOf(2), rs.getPeerReviews().getSelfAssertedCount());
assertEquals(Integer.valueOf(4), rs.getPeerReviews().getPeerReviewPublicationGrants());
- assertEquals(Integer.valueOf(16), rs.getPeerReviews().getTotal());
+ assertEquals(Integer.valueOf(16), rs.getPeerReviews().getTotal());
+
+ // Email domains
+ assertEquals("2024-12-20", rs.getEmailDomains().getEmailDomains().get(0).getVerificationDate().toString());
+ assertEquals(1, rs.getEmailDomains().getEmailDomains().size());
}
/**
@@ -588,7 +593,11 @@ public void getSummaryPojoTest() {
// Peer review
assertEquals(2, rs.getSelfAssertedPeerReviews());
assertEquals(4, rs.getPeerReviewPublicationGrants());
- assertEquals(16, rs.getPeerReviewsTotal());
+ assertEquals(16, rs.getPeerReviewsTotal());
+ // Email domain
+ assertEquals(1, rs.getEmailDomains().size());
+ assertEquals("2024-12-20", rs.getEmailDomains().get(0).getVerificationDate());
+
}
private PersonExternalIdentifiers getPersonExternalIdentifiers() {
@@ -607,9 +616,13 @@ private ResearchResources getResearchResources() {
return researchResources;
}
- private EmailDomains getEmailDomains() {
- EmailDomains emailDomains = new EmailDomains();
-
+ private List getEmailDomains() {
+ List emailDomains = new ArrayList();
+ ProfileEmailDomainEntity emailDomain = new ProfileEmailDomainEntity();
+ emailDomain.setEmailDomain(EMAIL_DOMAIN);
+ emailDomain.setOrcid(ORCID);
+ emailDomain.setDateCreated(new Date(124, 11, 20));
+ emailDomains.add(emailDomain);
return emailDomains;
}
diff --git a/orcid-core/src/test/java/org/orcid/core/manager/v3/ProfileEmailDomainManagerTest.java b/orcid-core/src/test/java/org/orcid/core/manager/v3/ProfileEmailDomainManagerTest.java
new file mode 100644
index 00000000000..f50a938efdd
--- /dev/null
+++ b/orcid-core/src/test/java/org/orcid/core/manager/v3/ProfileEmailDomainManagerTest.java
@@ -0,0 +1,192 @@
+package org.orcid.core.manager.v3;
+
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Date;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.orcid.core.manager.ProfileEntityCacheManager;
+import org.orcid.core.manager.v3.impl.ProfileEmailDomainManagerImpl;
+import org.orcid.jaxb.model.v3.release.common.Visibility;
+import org.orcid.persistence.dao.EmailDomainDao;
+import org.orcid.persistence.dao.ProfileEmailDomainDao;
+import org.orcid.persistence.jpa.entities.EmailDomainEntity;
+import org.orcid.persistence.jpa.entities.EmailDomainEntity.DomainCategory;
+import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
+import org.orcid.persistence.jpa.entities.ProfileEntity;
+import org.orcid.pojo.ajaxForm.ProfileEmailDomain;
+import org.orcid.test.TargetProxyHelper;
+
+public class ProfileEmailDomainManagerTest {
+ @Mock
+ private ProfileEmailDomainDao profileEmailDomainDaoMock;
+
+ @Mock
+ private ProfileEmailDomainDao profileEmailDomainDaoReadOnlyMock;
+
+ @Mock
+ private ProfileEntityCacheManager profileEntityCacheManagerMock;
+
+ @Mock
+ private EmailDomainDao emailDomainDaoMock;
+
+ ProfileEmailDomainManager pedm = new ProfileEmailDomainManagerImpl();
+
+
+ private static final String ORCID = "0000-0000-0000-0001";
+ private static final String ORCID_TWO = "0000-0000-0000-0002";
+ private static final String EMAIL_DOMAIN = "orcid.org";
+ private static final String EMAIL_DOMAIN_TWO = "email.com";
+ private static final String EMAIL_DOMAIN_THREE = "domain.net";
+
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+ TargetProxyHelper.injectIntoProxy(pedm, "profileEmailDomainDao", profileEmailDomainDaoMock);
+ TargetProxyHelper.injectIntoProxy(pedm, "profileEmailDomainDaoReadOnly", profileEmailDomainDaoReadOnlyMock);
+ TargetProxyHelper.injectIntoProxy(pedm, "emailDomainDao", emailDomainDaoMock);
+ TargetProxyHelper.injectIntoProxy(pedm, "profileEntityCacheManager", profileEntityCacheManagerMock);
+
+ ProfileEmailDomainEntity ped1 = new ProfileEmailDomainEntity();
+ ProfileEmailDomainEntity ped2 = new ProfileEmailDomainEntity();
+ ProfileEmailDomainEntity ped3 = new ProfileEmailDomainEntity();
+
+ ped1.setEmailDomain(EMAIL_DOMAIN);
+ ped1.setOrcid(ORCID);
+ ped1.setDateCreated(new Date(124, 12, 12));
+ ped1.setVisibility(Visibility.PUBLIC.value());
+
+ ped2.setEmailDomain(EMAIL_DOMAIN_TWO);
+ ped2.setOrcid(ORCID);
+ ped2.setVisibility(Visibility.LIMITED.value());
+
+ ped3.setEmailDomain(EMAIL_DOMAIN);
+ ped3.setOrcid(ORCID_TWO);
+ ped3.setDateCreated(new Date(124, 12, 30));
+ ped3.setVisibility(Visibility.PUBLIC.value());
+
+ when(profileEmailDomainDaoMock.findByEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN))).thenReturn(ped1);
+ when(profileEmailDomainDaoMock.findByEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN_TWO))).thenReturn(ped2);
+ when(profileEmailDomainDaoMock.findByEmailDomain(eq(ORCID_TWO), eq(EMAIL_DOMAIN))).thenReturn(ped3);
+ when(profileEmailDomainDaoMock.findByEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN_THREE))).thenReturn(null);
+
+ when(profileEmailDomainDaoMock.findByOrcid(eq(ORCID))).thenReturn(List.of(ped1, ped2));
+ when(profileEmailDomainDaoMock.findByOrcid(eq(ORCID_TWO))).thenReturn(List.of(ped3));
+
+ when(profileEmailDomainDaoMock.findPublicEmailDomains(eq(ORCID))).thenReturn(List.of(ped1));
+ when(profileEmailDomainDaoMock.findPublicEmailDomains(eq(ORCID_TWO))).thenReturn(List.of(ped2));
+
+ when(profileEmailDomainDaoReadOnlyMock.addEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN_TWO), eq(Visibility.LIMITED.value()))).thenReturn(ped2);
+
+ when(profileEmailDomainDaoReadOnlyMock.updateVisibility(eq(ORCID), eq(EMAIL_DOMAIN_TWO), eq(Visibility.LIMITED.value()))).thenReturn(true);
+
+ ProfileEntity profile = new ProfileEntity();
+ profile.setActivitiesVisibilityDefault(Visibility.PUBLIC.value());
+ when(profileEntityCacheManagerMock.retrieve(anyString())).thenReturn(profile);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void processDomain_nullOrcid() {
+ pedm.processDomain(null, "email@orcid.org");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void processDomain_nullDomain() {
+ pedm.processDomain(ORCID, null);
+ }
+
+ @Test
+ public void processDomain_domainAlreadyAdded() {
+ EmailDomainEntity professionalEmailDomain = new EmailDomainEntity();
+ professionalEmailDomain.setCategory(DomainCategory.PROFESSIONAL);
+ professionalEmailDomain.setEmailDomain(EMAIL_DOMAIN);
+ when(emailDomainDaoMock.findByEmailDomain(eq(EMAIL_DOMAIN))).thenReturn(professionalEmailDomain);
+ pedm.processDomain(ORCID, "email@orcid.org");
+ verify(profileEmailDomainDaoMock, times(1)).findByEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN));
+ verify(profileEmailDomainDaoMock, never()).addEmailDomain(anyString(), anyString(), anyString());
+ }
+
+ @Test
+ public void processDomain_doNotAddUnknownDomain() {
+ when(emailDomainDaoMock.findByEmailDomain(eq(EMAIL_DOMAIN))).thenReturn(null);
+ pedm.processDomain(ORCID, "email@orcid.org");
+ verify(profileEmailDomainDaoMock, never()).findByEmailDomain(anyString(), anyString());
+ verify(profileEmailDomainDaoMock, never()).addEmailDomain(anyString(), anyString(), anyString());
+ }
+
+ @Test
+ public void processDomain_doNotAddPersonalDomain() {
+ EmailDomainEntity professionalEmailDomain = new EmailDomainEntity();
+ professionalEmailDomain.setCategory(DomainCategory.PERSONAL);
+ professionalEmailDomain.setEmailDomain(EMAIL_DOMAIN);
+ when(emailDomainDaoMock.findByEmailDomain(eq(EMAIL_DOMAIN))).thenReturn(professionalEmailDomain);
+ pedm.processDomain(ORCID, "email@orcid.org");
+ verify(profileEmailDomainDaoMock, never()).findByEmailDomain(anyString(), anyString());
+ verify(profileEmailDomainDaoMock, never()).addEmailDomain(anyString(), anyString(), anyString());
+ }
+
+ @Test
+ public void processDomain_addDomain() {
+ EmailDomainEntity professionalEmailDomain = new EmailDomainEntity();
+ professionalEmailDomain.setCategory(DomainCategory.PROFESSIONAL);
+ professionalEmailDomain.setEmailDomain(EMAIL_DOMAIN_THREE);
+ when(emailDomainDaoMock.findByEmailDomain(eq(EMAIL_DOMAIN_THREE))).thenReturn(professionalEmailDomain);
+ pedm.processDomain(ORCID, "email@domain.net");
+ verify(profileEmailDomainDaoMock, times(1)).findByEmailDomain(eq(ORCID), eq(EMAIL_DOMAIN_THREE));
+ verify(profileEmailDomainDaoMock, times(1)).addEmailDomain(ORCID, EMAIL_DOMAIN_THREE, Visibility.PUBLIC.value());
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void updateEmailDomains_nullOrcid() {
+ pedm.updateEmailDomains(null, new org.orcid.pojo.ajaxForm.Emails());
+ }
+
+ @Test
+ public void updateEmailDomains_updateVisibility() {
+ org.orcid.pojo.ajaxForm.Emails emails = new org.orcid.pojo.ajaxForm.Emails();
+ ProfileEmailDomain ed1 = new ProfileEmailDomain();
+ ed1.setVisibility(Visibility.LIMITED.value());
+ ed1.setValue(EMAIL_DOMAIN);
+ ProfileEmailDomain ed2 = new ProfileEmailDomain();
+ ed2.setVisibility(Visibility.PRIVATE.value());
+ ed2.setValue(EMAIL_DOMAIN_TWO);
+ emails.setEmailDomains(List.of(ed1, ed2));
+ pedm.updateEmailDomains(ORCID, emails);
+ verify(profileEmailDomainDaoMock, times(1)).updateVisibility(ORCID, EMAIL_DOMAIN, Visibility.LIMITED.value());
+ verify(profileEmailDomainDaoMock, times(1)).updateVisibility(ORCID, EMAIL_DOMAIN_TWO, Visibility.PRIVATE.value());
+ verify(profileEmailDomainDaoMock, never()).removeEmailDomain(anyString(), anyString());
+ }
+
+ @Test
+ public void updateEmailDomains_makeNoChanges() {
+ // Visibility setting is the same -- no change necessary
+ org.orcid.pojo.ajaxForm.Emails emails = new org.orcid.pojo.ajaxForm.Emails();
+ ProfileEmailDomain ed1 = new ProfileEmailDomain();
+ ed1.setVisibility(Visibility.PUBLIC.value());
+ ed1.setValue(EMAIL_DOMAIN);
+ emails.setEmailDomains(List.of(ed1));
+ pedm.updateEmailDomains(ORCID_TWO, emails);
+ verify(profileEmailDomainDaoMock, never()).updateVisibility(anyString(), anyString(), anyString());
+ verify(profileEmailDomainDaoMock, never()).removeEmailDomain(anyString(), anyString());
+ }
+
+ @Test
+ public void updateEmailDomains_removeDomain() {
+ org.orcid.pojo.ajaxForm.Emails emails = new org.orcid.pojo.ajaxForm.Emails();
+ emails.setEmailDomains(List.of(new ProfileEmailDomain()));
+ pedm.updateEmailDomains(ORCID, emails);
+ verify(profileEmailDomainDaoMock, never()).updateVisibility(anyString(), anyString(), anyString());
+ verify(profileEmailDomainDaoMock, times(1)).removeEmailDomain(ORCID, EMAIL_DOMAIN);
+ verify(profileEmailDomainDaoMock, times(1)).removeEmailDomain(ORCID, EMAIL_DOMAIN_TWO);
+ }
+}
\ No newline at end of file
diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java
index c1c9853e6a7..50da86cd524 100644
--- a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java
+++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileEmailDomainEntity.java
@@ -1,6 +1,7 @@
package org.orcid.persistence.jpa.entities;
import javax.persistence.*;
+import java.util.Date;
import java.util.Objects;
/**
@@ -16,6 +17,7 @@ public class ProfileEmailDomainEntity extends BaseEntity {
private String orcid;
private String emailDomain;
private String visibility;
+ private Date dateCreated;
@Id
@Column(name = "id")
@@ -56,6 +58,15 @@ public void setVisibility(String visibility) {
this.visibility = visibility;
}
+ @Column(name = "date_created")
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+ public void setDateCreated(Date dateCreated) {
+ this.dateCreated = dateCreated;
+ }
+
@Override
public boolean equals(Object obj) {
diff --git a/pom.xml b/pom.xml
index c6024f0e181..815ab3fd68c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -147,6 +147,9 @@ the software.
**/*IntegrationTest.java
**/*ITest.java
org/orcid/integration/**/*.java
+ **/OrgManagerTest.java
+ **/LoadLEIDataTest.java
+ **/SchemaOrgDocumentTest.java
@@ -918,7 +921,7 @@ the software.
org.orcid
orcid-model
- 3.3.2
+ 3.3.3
org.orcid
From 77a0ee3c83de491bea4c8332f9fa84efb0f91e4f Mon Sep 17 00:00:00 2001
From: github actions
Date: Wed, 13 Nov 2024 20:26:02 +0000
Subject: [PATCH 15/15] v2.68.1 changelog update
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f83afc6f41..dd0dad40de8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v2.68.1 - 2024-11-13
+
+[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.68.0...v2.68.1)
+
## v2.68.0 - 2024-11-13
[Full Changelog](https://github.com/ORCID/ORCID-Source/compare/v2.67.16...v2.68.0)