From 5b167b0c846b78765c7f07320a641bf80d114a35 Mon Sep 17 00:00:00 2001 From: Gaffer Date: Mon, 3 Apr 2023 15:31:15 +0000 Subject: [PATCH 01/13] prepare for next development iteration --- core/pom.xml | 2 +- doc/pom.xml | 2 +- pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 29fad2ff..6c973dcd 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -19,7 +19,7 @@ koryphe uk.gov.gchq.koryphe - 2.5.2 + 2.5.3-SNAPSHOT jar 4.0.0 diff --git a/doc/pom.xml b/doc/pom.xml index 70cbf483..32b45cf7 100644 --- a/doc/pom.xml +++ b/doc/pom.xml @@ -19,7 +19,7 @@ koryphe uk.gov.gchq.koryphe - 2.5.2 + 2.5.3-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 2ce4dd20..6790d2c4 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ uk.gov.gchq.koryphe koryphe - 2.5.2 + 2.5.3-SNAPSHOT pom ${project.groupId}:${project.artifactId} From 2d81a48aa031b4d601322316482e783d5d9202cd Mon Sep 17 00:00:00 2001 From: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> Date: Tue, 11 Apr 2023 10:52:52 +0100 Subject: [PATCH 02/13] Gh-310: Improve JUnit tests to run in parallel (#311) * Enable parallelism at class level with thread count equal to CPU threads Also fix config to apply always (not just profile) and remove outdated 'junit-platform-surefire-provider' dependency * Update versions for JUnit, AssertJ etc. * Fix Maven default platform encoding warning message --- pom.xml | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 6790d2c4..241ebfb8 100644 --- a/pom.xml +++ b/pom.xml @@ -33,13 +33,14 @@ + UTF-8 + 4.7.3 29.0-jre - 3.22.0 + 3.24.2 2.13.4 - 5.8.2 - 1.3.2 - 3.12.4 + 5.9.2 + 5.2.0 1.7.36 3.1.2 @@ -178,12 +179,6 @@ ${junit5.version} test - - org.junit.platform - junit-platform-surefire-provider - ${junitSurefireProvider.version} - test - org.mockito mockito-core @@ -291,6 +286,11 @@ org.apache.maven.plugins maven-surefire-plugin ${surefire.plugin.version} + > + ${argLine} + classes + true + org.apache.maven.plugins @@ -563,16 +563,6 @@ coverage - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire.plugin.version} - - 1 - false - ${argLine} - - com.github.spotbugs spotbugs-maven-plugin From 27e21de25318733b51cb86224c611f13a562a422 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 15:43:56 +0100 Subject: [PATCH 03/13] Gh-313: Upgrade json from 20211205 to 20230227 (#312) Bumps [json](https://github.com/douglascrockford/JSON-java) from 20211205 to 20230227. - [Release notes](https://github.com/douglascrockford/JSON-java/releases) - [Changelog](https://github.com/stleary/JSON-java/blob/master/docs/RELEASES.md) - [Commits](https://github.com/douglascrockford/JSON-java/commits) --- updated-dependencies: - dependency-name: org.json:json dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 241ebfb8..eea6cbba 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 1.9.0 1.15 2.11.0 - 20211205 + 20230227 3.9.0 ${spotbugs.version}.0 2.22.1 From 5495a252caeb147f6e92a6470914bbae95e4d630 Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Thu, 18 May 2023 14:56:17 +0100 Subject: [PATCH 04/13] Update codecov (#315) --- .github/workflows/continuous-integration.yaml | 2 +- cd/after_success.sh | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100755 cd/after_success.sh diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 036ce698..3da7c306 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -43,4 +43,4 @@ jobs: run: mvn -B -q spotless:check - name: Upload Coverage - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 diff --git a/cd/after_success.sh b/cd/after_success.sh deleted file mode 100755 index deb86ec8..00000000 --- a/cd/after_success.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ "$TRAVIS_PULL_REQUEST" != 'false' ]; then - bash <(curl -s https://codecov.io/bash) -fi From 36c63c3e24145e04405d7620524b23cf9b5b5849 Mon Sep 17 00:00:00 2001 From: t92549 <80890692+t92549@users.noreply.github.com> Date: Tue, 21 Nov 2023 12:35:30 +0000 Subject: [PATCH 05/13] Gh 307: Upgrade workflows (#318) * Upgrade GitHub workflows * Version fix * Update .github/workflows/release.yaml Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> * Remove unsupported actions and fix git config --------- Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> --- .github/release-notes.yml | 3 ++ .github/workflows/continuous-integration.yaml | 4 +- .github/workflows/create-hotfix-branch.yaml | 29 +++-------- .github/workflows/create-release-branch.yaml | 29 +++-------- .github/workflows/link-issue.yml | 2 +- .github/workflows/release-standalone.yaml | 4 +- .github/workflows/release.yaml | 51 +++++++------------ 7 files changed, 37 insertions(+), 85 deletions(-) diff --git a/.github/release-notes.yml b/.github/release-notes.yml index e7dcb513..74535a00 100644 --- a/.github/release-notes.yml +++ b/.github/release-notes.yml @@ -4,6 +4,9 @@ releasenotes: emoji: ":star:" labels: [ "headliner" ] - title: "New Features" + emoji: ":gift:" + labels: [ "feature" ] + - title: "Enhancements" emoji: ":sparkles:" labels: [ "enhancement" ] - title: "Bugs Fixed" diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 3da7c306..b77134f7 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -19,13 +19,13 @@ jobs: fetch-depth: 0 - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.m2/repository diff --git a/.github/workflows/create-hotfix-branch.yaml b/.github/workflows/create-hotfix-branch.yaml index 8eb46285..413db952 100644 --- a/.github/workflows/create-hotfix-branch.yaml +++ b/.github/workflows/create-hotfix-branch.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -36,37 +36,20 @@ jobs: if: ${{ !github.event.inputs.version }} run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^koryphe-//')" >> $GITHUB_ENV - - name: Bump latest tag variable + - name: Bump latest tag variable version if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-bump-semver@v1 - id: bump-semver - with: - current_version: ${{ env.CURRENT_VERSION }} - level: patch - - - name: Set version automatically - if: ${{ !github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ steps.bump-semver.outputs.new_version }} )" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.\2.$((\3+1))/' | sh)" >> $GITHUB_ENV - name: Verify version regex - uses: actions-ecosystem/action-regex-match@v2 - id: regex-match - with: - text: ${{ env.RELEASE_VERSION }} - # Ensure version doesn't end in .0 - regex: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.([1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - - - name: Fail if incorrect version - if: ${{ !steps.regex-match.outputs.match }} - run: exit 1 + run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - name: Set hotfix branch run: echo "BRANCH_NAME=$(echo hotfix/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Update versions run: | diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index 526e4b1e..d5bad21c 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout develop - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: develop token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -36,37 +36,20 @@ jobs: if: ${{ !github.event.inputs.version }} run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^koryphe-//')" >> $GITHUB_ENV - - name: Bump latest tag variable + - name: Bump latest tag variable version if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-bump-semver@v1 - id: bump-semver - with: - current_version: ${{ env.CURRENT_VERSION }} - level: minor - - - name: Set version automatically - if: ${{ !github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ steps.bump-semver.outputs.new_version }} )" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.$((\2+1)).0/' | sh)" >> $GITHUB_ENV - name: Verify version regex - uses: actions-ecosystem/action-regex-match@v2 - id: regex-match - with: - text: ${{ env.RELEASE_VERSION }} - # Ensure valid semver version - regex: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - - - name: Fail if incorrect version - if: ${{ !steps.regex-match.outputs.match }} - run: exit 1 + run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' - name: Set release branch run: echo "BRANCH_NAME=$(echo release/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Update versions run: | diff --git a/.github/workflows/link-issue.yml b/.github/workflows/link-issue.yml index 8e87000d..ae3c5d9e 100644 --- a/.github/workflows/link-issue.yml +++ b/.github/workflows/link-issue.yml @@ -7,7 +7,7 @@ jobs: issue-links: runs-on: ubuntu-latest steps: - - uses: tkt-actions/add-issue-links@v1.6.0 + - uses: tkt-actions/add-issue-links@v1.8.2 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' branch-prefix: 'gh-' diff --git a/.github/workflows/release-standalone.yaml b/.github/workflows/release-standalone.yaml index b295f003..73d67182 100644 --- a/.github/workflows/release-standalone.yaml +++ b/.github/workflows/release-standalone.yaml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '8' - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cafbc950..dcd31d57 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,13 +19,13 @@ jobs: steps: - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -33,8 +33,8 @@ jobs: - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Set release version run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV @@ -44,14 +44,14 @@ jobs: - name: Output branch name id: branch - run: echo "::set-output name=branch_name::$BRANCH_NAME" + run: echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - name: Fail if no branch found if: ${{ !env.BRANCH_NAME }} run: exit 1 - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -76,7 +76,7 @@ jobs: steps: - name: Checkout develop - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: develop token: ${{ secrets.ADMIN_GITHUB_TOKEN }} @@ -84,11 +84,11 @@ jobs: - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' @@ -113,7 +113,7 @@ jobs: steps: - name: Checkout Master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master @@ -141,18 +141,18 @@ jobs: steps: - name: Checkout Master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - name: Set up Github credentials run: | - git config user.name Gaffer - git config user.email github-actions@github.com + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' @@ -181,13 +181,13 @@ jobs: steps: - name: Setup JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' - name: Checkout master - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: master @@ -207,20 +207,3 @@ jobs: OSS_NEXUS_USERNAME: ${{ secrets.OSS_NEXUS_USERNAME }} OSS_NEXUS_PASSWORD: ${{ secrets.OSS_NEXUS_PASSWORD }} run: mvn deploy -P quick,ossrh-release --settings cd/mvnsettings.xml -B - - trigger-update-gaffer-koryphe-version: - runs-on: ubuntu-latest - needs: - - create-release-tag - - steps: - - name: Set version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV - - - name: Update Gaffer Koryphe version - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: Update Korpyhe Version - repo: gchq/Gaffer - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - inputs: '{ "version": "${{ env.RELEASE_VERSION }}" }' From e8b9c74fa4d687f07f86bfc79f32c68e9269d5a5 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> Date: Mon, 6 Jan 2025 13:35:06 +0000 Subject: [PATCH 06/13] Gh-324: Make IterableConcat's type signature more flexible (#325) * Make IterableConcat type signature more flexible IterableConcat can now easily accept nested Iterables which extend Iterable in more cases * Fix example * Update copyright * Fix Quality Gate --- .../koryphe/impl/function/IterableConcat.java | 6 +++--- .../impl/function/IterableConcatTest.java | 21 ++++++++++++++++++- .../iterable/IterableConcatExample.java | 5 +++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/function/IterableConcat.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/function/IterableConcat.java index a5854342..25b6bf49 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/impl/function/IterableConcat.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/function/IterableConcat.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2024 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +29,9 @@ */ @Since("1.1.0") @Summary("Concatenates 2 iterables") -public class IterableConcat extends KorypheFunction>, Iterable> { +public class IterableConcat extends KorypheFunction>, Iterable> { @Override - public Iterable apply(final Iterable> items) { + public Iterable apply(final Iterable> items) { return IterableUtil.concat(items); } } diff --git a/core/src/test/java/uk/gov/gchq/koryphe/impl/function/IterableConcatTest.java b/core/src/test/java/uk/gov/gchq/koryphe/impl/function/IterableConcatTest.java index 2bc5669b..33a5aeec 100644 --- a/core/src/test/java/uk/gov/gchq/koryphe/impl/function/IterableConcatTest.java +++ b/core/src/test/java/uk/gov/gchq/koryphe/impl/function/IterableConcatTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2024 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -86,6 +88,23 @@ public void shouldFlattenNestedIterables() { .containsExactly(1, 2, 3, 4, 5, 6); } + @Test + public void shouldFlattenWhenIterableNestedTypeExtendsIterable() { + // Given + final IterableConcat function = new IterableConcat<>(); + final Iterable> input = Arrays.asList( + new HashSet<>(Arrays.asList(5)), + new HashSet<>(Arrays.asList(10))); + + // When + final Iterable result = function.apply(input); + + // Then + assertThat(result) + .isNotNull() + .containsExactly(5, 10); + } + @Test public void shouldHandleNullInputIterable() { // Given diff --git a/doc/src/main/java/uk/gov/gchq/koryphe/example/function/iterable/IterableConcatExample.java b/doc/src/main/java/uk/gov/gchq/koryphe/example/function/iterable/IterableConcatExample.java index 3f9caa76..834efe05 100644 --- a/doc/src/main/java/uk/gov/gchq/koryphe/example/function/iterable/IterableConcatExample.java +++ b/doc/src/main/java/uk/gov/gchq/koryphe/example/function/iterable/IterableConcatExample.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 Crown Copyright + * Copyright 2017-2024 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,8 @@ public class IterableConcatExample extends KorypheIterableFunctionExample>, Iterable> { @Override public Function>, Iterable> getFunction() { - return new IterableConcat<>(); + Function>, Iterable> f = new IterableConcat<>(); + return ((Function>, Iterable>) f); } @Override From bc76769d861e225d6682213194365ac64b360503 Mon Sep 17 00:00:00 2001 From: cn337131 <141730190+cn337131@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:05:56 +0000 Subject: [PATCH 07/13] Gh-236: Update GH actions (#327) fix versions, update release process and remove gh action --- .github/release-notes.yml | 20 -- .github/release.yml | 23 +++ .github/workflows/continuous-integration.yaml | 8 +- .github/workflows/create-hotfix-branch.yaml | 4 +- .github/workflows/create-release-branch.yaml | 40 ++-- .github/workflows/release-standalone.yaml | 2 +- .github/workflows/release.yaml | 181 +++++++----------- 7 files changed, 119 insertions(+), 159 deletions(-) delete mode 100644 .github/release-notes.yml create mode 100644 .github/release.yml diff --git a/.github/release-notes.yml b/.github/release-notes.yml deleted file mode 100644 index 74535a00..00000000 --- a/.github/release-notes.yml +++ /dev/null @@ -1,20 +0,0 @@ -releasenotes: - sections: - - title: "Headliners" - emoji: ":star:" - labels: [ "headliner" ] - - title: "New Features" - emoji: ":gift:" - labels: [ "feature" ] - - title: "Enhancements" - emoji: ":sparkles:" - labels: [ "enhancement" ] - - title: "Bugs Fixed" - emoji: ":beetle:" - labels: [ "bug" ] - - title: "Documentation" - emoji: ":book:" - labels: "documentation" - - title: "Automation" - emoji: ":robot:" - labels: [ "automation" ] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..d30df62a --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,23 @@ +changelog: + categories: + - title: Headliners + labels: + - headliner + - title: New Features + labels: + - feature + - title: Enhancements + labels: + - enhancement + - title: Bugs Fixed + labels: + - bug + - title: Documentation + labels: + - documentation + - title: Automation + labels: + - automation + - title: Other changes + labels: + - "*" diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index b77134f7..be0d78f4 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -14,18 +14,18 @@ jobs: env: MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '11' - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.m2/repository @@ -43,4 +43,4 @@ jobs: run: mvn -B -q spotless:check - name: Upload Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 diff --git a/.github/workflows/create-hotfix-branch.yaml b/.github/workflows/create-hotfix-branch.yaml index 413db952..ead9da2d 100644 --- a/.github/workflows/create-hotfix-branch.yaml +++ b/.github/workflows/create-hotfix-branch.yaml @@ -29,12 +29,12 @@ jobs: - name: Get latest tag if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-get-latest-tag@v1 + run: echo "LATEST_TAG= $(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV id: get-latest-tag - name: Format latest tag if: ${{ !github.event.inputs.version }} - run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^koryphe-//')" >> $GITHUB_ENV + run: echo "CURRENT_VERSION=$(echo ${{ env.LATEST_TAG }} | sed 's/^koryphe-//')" >> $GITHUB_ENV - name: Bump latest tag variable version if: ${{ !github.event.inputs.version }} diff --git a/.github/workflows/create-release-branch.yaml b/.github/workflows/create-release-branch.yaml index d5bad21c..f9133ffc 100644 --- a/.github/workflows/create-release-branch.yaml +++ b/.github/workflows/create-release-branch.yaml @@ -1,11 +1,9 @@ name: Create Release Branch on: - workflow_dispatch: - inputs: - version: - description: 'Release Branch Version' - required: false + milestone: + types: + - closed env: artifactId: koryphe @@ -23,25 +21,8 @@ jobs: token: ${{ secrets.ADMIN_GITHUB_TOKEN }} fetch-depth: 0 - - name: Set version from input - if: ${{ github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ github.event.inputs.version }} | sed 's/^v//')" >> $GITHUB_ENV - - - name: Get latest tag - if: ${{ !github.event.inputs.version }} - uses: actions-ecosystem/action-get-latest-tag@v1 - id: get-latest-tag - - - name: Format latest tag - if: ${{ !github.event.inputs.version }} - run: echo "CURRENT_VERSION=$(echo ${{ steps.get-latest-tag.outputs.tag }} | sed 's/^koryphe-//')" >> $GITHUB_ENV - - - name: Bump latest tag variable version - if: ${{ !github.event.inputs.version }} - run: echo "RELEASE_VERSION=$(echo ${{ env.CURRENT_VERSION }} | sed -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/echo \1.$((\2+1)).0/' | sh)" >> $GITHUB_ENV - - - name: Verify version regex - run: echo ${{ env.RELEASE_VERSION }} | grep -E '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + - name: Set version from milestone + run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }})" >> $GITHUB_ENV - name: Set release branch run: echo "BRANCH_NAME=$(echo release/${{ env.RELEASE_VERSION }} )" >> $GITHUB_ENV @@ -60,3 +41,14 @@ jobs: git checkout -b $BRANCH_NAME git commit -a -m "prepare release $artifactId-$RELEASE_VERSION" git push --set-upstream origin $BRANCH_NAME + + - name: Tag release branch + run: | + git tag koryphe-$RELEASE_VERSION + git push origin --tags + + - name: Create PR to master + run: | + gh pr create -B master -H $BRANCH_NAME --title 'Merge release into master branch' --body 'Created by GH Action' + env: + GITHUB_TOKEN: ${{ secrets.ADMIN_GITHUB_TOKEN }} diff --git a/.github/workflows/release-standalone.yaml b/.github/workflows/release-standalone.yaml index 73d67182..54e41f13 100644 --- a/.github/workflows/release-standalone.yaml +++ b/.github/workflows/release-standalone.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '8' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index dcd31d57..cb9e7c9a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,25 +1,26 @@ name: Release on: - milestone: - types: - - closed + pull_request: + branches: + - master + types: [closed] env: artifactId: koryphe MAVEN_OPTS: -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 - jobs: - create-release-tag: + deploy-release: + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest outputs: - branch_name: ${{ steps.branch.outputs.branch_name }} + release_version: ${{ steps.release-version.outputs.release_version }} steps: - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '11' @@ -36,111 +37,18 @@ jobs: git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - name: Set release version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV - - - name: Set branch name - run: echo "BRANCH_NAME=$(git branch -a | grep $RELEASE_VERSION | tail -n 1 | cut -c 18-)" >> $GITHUB_ENV - - - name: Output branch name - id: branch - run: echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - - - name: Fail if no branch found - if: ${{ !env.BRANCH_NAME }} - run: exit 1 - - - name: Checkout master - uses: actions/checkout@v4 - with: - ref: master - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Merge release into master - run: | - git checkout ${{ env.BRANCH_NAME }} - git checkout master - git merge ${{ env.BRANCH_NAME }} - - - name: Push changes + - name: Output release version + id: release-version run: | - git tag $artifactId-$RELEASE_VERSION - git push origin $artifactId-$RELEASE_VERSION - git push - - update-develop: - runs-on: ubuntu-latest - needs: - - create-release-tag - - steps: - - name: Checkout develop - uses: actions/checkout@v4 - with: - ref: develop - token: ${{ secrets.ADMIN_GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Set up Github credentials - run: | - git config user.name github-actions[bot] - git config user.email 41898282+github-actions[bot]@users.noreply.github.com - - - name: Setup JDK - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '11' - - - name: Merge release into develop - run: | - git checkout ${{ needs.create-release-tag.outputs.branch_name }} - git checkout develop - git merge ${{ needs.create-release-tag.outputs.branch_name }} --strategy-option theirs - - - name: Update development branch - run: | - git checkout develop - mvn release:update-versions -B - git commit -a -m "prepare for next development iteration" - git push - - update-github-releases: - runs-on: ubuntu-latest - needs: - - create-release-tag - - steps: - - name: Checkout Master - uses: actions/checkout@v4 - with: - ref: master - - - name: Create Release Notes - uses: docker://decathlon/release-notes-generator-action:2.1.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Set version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV - - - name: Upload notes - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.artifactId }}-${{ env.RELEASE_VERSION }} - name: Koryphe ${{ env.RELEASE_VERSION }} - body_path: release_file.md + echo "release_version=$(mvn -q help:evaluate -DforceStdout -Dexpression=pom.version)" >> $GITHUB_OUTPUT generate-javadoc: runs-on: ubuntu-latest needs: - - create-release-tag + - deploy-release steps: - - name: Checkout Master + - name: Checkout master uses: actions/checkout@v4 with: ref: master @@ -158,7 +66,7 @@ jobs: java-version: '11' - name: Set version - run: echo "RELEASE_VERSION=$(echo ${{ github.event.milestone.title }} | cut -c 2-)" >> $GITHUB_ENV + run: echo "RELEASE_VERSION=$(echo ${{ needs.deploy-release.outputs.release_version }})" >> $GITHUB_ENV - name: Upload Javadoc run: | @@ -177,11 +85,11 @@ jobs: release-to-nexus: runs-on: ubuntu-latest needs: - - create-release-tag + - deploy-release steps: - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: '11' @@ -207,3 +115,60 @@ jobs: OSS_NEXUS_USERNAME: ${{ secrets.OSS_NEXUS_USERNAME }} OSS_NEXUS_PASSWORD: ${{ secrets.OSS_NEXUS_PASSWORD }} run: mvn deploy -P quick,ossrh-release --settings cd/mvnsettings.xml -B + + update-github-releases: + runs-on: ubuntu-latest + needs: + - deploy-release + + steps: + - name: Checkout Master + uses: actions/checkout@v4 + with: + ref: master + + - name: Set version + run: echo "RELEASE_VERSION=$(echo ${{ needs.deploy-release.outputs.release_version }})" >> $GITHUB_ENV + + - name: Create release notes + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ env.artifactId }}-${{ env.RELEASE_VERSION }} + name: Koryphe ${{ env.RELEASE_VERSION }} + + update-develop: + runs-on: ubuntu-latest + needs: + - deploy-release + + steps: + - name: Checkout develop + uses: actions/checkout@v4 + with: + ref: develop + token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Set up Github credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Setup JDK + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '11' + + - name: Merge master into develop + run: | + git merge origin/master + + - name: Update develop branch + run: | + git checkout develop + mvn release:update-versions -B + git commit -a -m "prepare for next development iteration" + git push From f2dead647ccf7dcc27ac88371529ddc6ca1d9a4c Mon Sep 17 00:00:00 2001 From: cn337131 <141730190+cn337131@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:44:37 +0000 Subject: [PATCH 08/13] Gh-321: Add ChainedIterator varargs constructor and IterableMerge binary operator (#328) * add new iterable merge binary operator and varargs to chainedItr * checkstyle * address comments * checkstyle --- .../impl/binaryoperator/IterableMerge.java | 38 +++++ .../koryphe/iterable/ChainedIterator.java | 7 +- .../binaryoperator/IterableMergeTest.java | 132 ++++++++++++++++++ 3 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMerge.java create mode 100644 core/src/test/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMergeTest.java diff --git a/core/src/main/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMerge.java b/core/src/main/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMerge.java new file mode 100644 index 00000000..8e3a3d05 --- /dev/null +++ b/core/src/main/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMerge.java @@ -0,0 +1,38 @@ +/* + * Copyright 2025 Crown Copyright + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package uk.gov.gchq.koryphe.impl.binaryoperator; + +import uk.gov.gchq.koryphe.Since; +import uk.gov.gchq.koryphe.Summary; +import uk.gov.gchq.koryphe.binaryoperator.KorypheBinaryOperator; +import uk.gov.gchq.koryphe.util.IterableUtil; + +import java.util.Arrays; + +/** + * An IterableMerge is a {@link KorypheBinaryOperator} that takes two + * {@link java.lang.Iterable}s and merges them together. + */ +@Since("2.6.0") +@Summary("Merges two iterables together.") +public class IterableMerge extends KorypheBinaryOperator> { + + @Override + protected Iterable _apply(final Iterable a, final Iterable b) { + return IterableUtil.concat(Arrays.asList(a, b)); + } +} diff --git a/core/src/main/java/uk/gov/gchq/koryphe/iterable/ChainedIterator.java b/core/src/main/java/uk/gov/gchq/koryphe/iterable/ChainedIterator.java index 2c38130d..e51edac4 100644 --- a/core/src/main/java/uk/gov/gchq/koryphe/iterable/ChainedIterator.java +++ b/core/src/main/java/uk/gov/gchq/koryphe/iterable/ChainedIterator.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 Crown Copyright + * Copyright 2025 Crown Copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import uk.gov.gchq.koryphe.util.CloseableUtil; import java.io.Closeable; +import java.util.Arrays; import java.util.Collections; import java.util.Iterator; @@ -31,6 +32,10 @@ public class ChainedIterator implements Closeable, Iterator { private final Iterator> iterablesIterator; private Iterator currentIterator = Collections.emptyIterator(); + public ChainedIterator(final Iterable... iterators) { + this((iterators == null || iterators.length == 0) ? null : Arrays.asList(iterators).iterator()); + } + public ChainedIterator(final Iterator> iterablesIterator) { if (null == iterablesIterator) { throw new IllegalArgumentException("iterables are required"); diff --git a/core/src/test/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMergeTest.java b/core/src/test/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMergeTest.java new file mode 100644 index 00000000..bebb0fce --- /dev/null +++ b/core/src/test/java/uk/gov/gchq/koryphe/impl/binaryoperator/IterableMergeTest.java @@ -0,0 +1,132 @@ +/* + * Copyright 2025 Crown Copyright + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package uk.gov.gchq.koryphe.impl.binaryoperator; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +import com.google.common.collect.Lists; + +import uk.gov.gchq.koryphe.binaryoperator.BinaryOperatorTest; +import uk.gov.gchq.koryphe.iterable.ChainedIterable; +import uk.gov.gchq.koryphe.util.JsonSerialiser; + +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.TreeSet; + +class IterableMergeTest extends BinaryOperatorTest { + + @Test + public void shouldJsonSerialiseAndDeserialise() throws IOException { + // Given + final IterableMerge merger = new IterableMerge<>(); + + // When + final String json = JsonSerialiser.serialise(merger); + + // Then + JsonSerialiser.assertEquals( + String.format("{%n" + + " \"class\" : \"uk.gov.gchq.koryphe.impl.binaryoperator.IterableMerge\"%n" + + "}"), + json); + + // When + final IterableMerge deserialisedMerger = JsonSerialiser.deserialise(json, IterableMerge.class); + + // Then + assertThat(deserialisedMerger).isNotNull(); + } + + @Test + void shouldMergeArrays() { + // Given + final IterableMerge merger = new IterableMerge<>(); + final List itr1 = Lists.newArrayList(1, 2, 3, 4); + final List itr2 = Lists.newArrayList(5, 6); + + // When + final Iterable result = merger.apply(itr1, itr2); + + // Then + assertThat(result) + .isInstanceOf(ChainedIterable.class) + .containsExactly(1, 2, 3, 4, 5, 6); + } + + @Test + void shouldMergeHashSets() { + // Given + final HashSet hashSet1 = new HashSet<>(); + hashSet1.add(1); + + final HashSet hashSet2 = new HashSet<>(); + hashSet2.add(2); + hashSet2.add(3); + + IterableMerge merger = new IterableMerge<>(); + final Iterable result = merger.apply(hashSet1, hashSet2); + + assertThat(result).containsExactly(1, 2, 3); + } + + @Test + void shouldMergeTreeSets() { + // Given + final TreeSet treeSet1 = new TreeSet<>(); + treeSet1.add("string1"); + + final TreeSet treeSet2 = new TreeSet<>(); + treeSet2.add("string3"); + treeSet2.add("string2"); + + final IterableMerge merger = new IterableMerge<>(); + + // When + final Iterable result = merger.apply(treeSet1, treeSet2); + + // Then + assertThat(result).containsExactly("string1", "string2", "string3"); + } + + @Test + void shouldHandleNullElementsOfIterable() { + // Given + final IterableMerge merger = new IterableMerge<>(); + final List itr1 = Lists.newArrayList(1, 2, null, 4); + final List itr2 = Lists.newArrayList(null, 6); + + // When + final Iterable results = merger.apply(itr1, itr2); + + // Then + assertThat(results).containsExactly(1, 2, null, 4, null, 6); + } + + @Override + protected IterableMerge getInstance() { + return new IterableMerge<>(); + } + + @Override + protected Iterable getDifferentInstancesOrNull() { + return null; + } +} From 7aafe0f834c503a32b70af18548d2ec5516e228a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:08:55 +0000 Subject: [PATCH 09/13] Bump commons-io:commons-io from 2.11.0 to 2.14.0 (#323) * Bump commons-io:commons-io from 2.11.0 to 2.14.0 Bumps commons-io:commons-io from 2.11.0 to 2.14.0. --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update copyright for pom.xml * copyright --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GCHQDeveloper314 <94527357+GCHQDeveloper314@users.noreply.github.com> Co-authored-by: j69772 <172510359+j69772@users.noreply.github.com> Co-authored-by: cn337131 <141730190+cn337131@users.noreply.github.com> --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index eea6cbba..f73f49b8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@