From bbd6056072a7b633065479fc393b849c5a4c0e03 Mon Sep 17 00:00:00 2001 From: Giles Westwood Date: Wed, 20 Nov 2024 10:37:07 +0000 Subject: [PATCH] sync up to orcid source and add second project --- .github/workflows/bld_all.yml | 185 ------------------ .../workflows/{bld_maven.yml => bld_mvn.yml} | 21 +- ...t_release_tag.yml => bld_test_rel_tag.yml} | 26 ++- .github/workflows/build_debug.yml | 101 ---------- .github/workflows/build_test_release.yml | 119 ----------- .github/workflows/pr.yml | 4 +- .github/workflows/pushmain.yml | 4 +- .../workflows/{mvn_test.yml => test_mvn.yml} | 5 +- hello_world_2/pom.xml | 38 ++++ .../src/main/java/com/example/HelloWorld.java | 12 ++ .../test/java/com/example/HelloWorldTest.java | 28 +++ pom.xml | 1 + 12 files changed, 117 insertions(+), 427 deletions(-) delete mode 100644 .github/workflows/bld_all.yml rename .github/workflows/{bld_maven.yml => bld_mvn.yml} (95%) rename .github/workflows/{build_test_release_tag.yml => bld_test_rel_tag.yml} (84%) delete mode 100644 .github/workflows/build_debug.yml delete mode 100644 .github/workflows/build_test_release.yml rename .github/workflows/{mvn_test.yml => test_mvn.yml} (98%) create mode 100644 hello_world_2/pom.xml create mode 100644 hello_world_2/src/main/java/com/example/HelloWorld.java create mode 100644 hello_world_2/src/test/java/com/example/HelloWorldTest.java diff --git a/.github/workflows/bld_all.yml b/.github/workflows/bld_all.yml deleted file mode 100644 index ab01a41..0000000 --- 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_maven.yml b/.github/workflows/bld_mvn.yml similarity index 95% rename from .github/workflows/bld_maven.yml rename to .github/workflows/bld_mvn.yml index 4683cb8..2ed9a6b 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 @@ -83,7 +82,13 @@ on: jobs: - bld_maven: + bld_mvn: + strategy: + matrix: + include: + - project: hello_world + - project: hello_world_2 + runs-on: ubuntu-latest steps: - name: git-checkout-ref-action @@ -167,20 +172,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' }} + if: ${{ matrix.project == 'orcid-web' }} uses: actions/setup-node@v3 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,7 +213,7 @@ jobs: env: version_tag_numeric: "${{ steps.version.outputs.version_tag_numeric }}" - project: "${{ inputs.project }}" + project: "${{ matrix.project }}" ################################################################################################################## @@ -227,5 +232,5 @@ 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_test_release_tag.yml b/.github/workflows/bld_test_rel_tag.yml similarity index 84% rename from .github/workflows/build_test_release_tag.yml rename to .github/workflows/bld_test_rel_tag.yml index fb48088..2a37c15 100644 --- a/.github/workflows/build_test_release_tag.yml +++ b/.github/workflows/bld_test_rel_tag.yml @@ -1,4 +1,4 @@ -name: build_test_release_tag +name: bld_test_rel_tag on: workflow_call: @@ -18,6 +18,11 @@ 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 +47,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: @@ -54,8 +63,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: version_tag: ${{ inputs.version_tag }} bump: ${{ inputs.bump }} @@ -65,12 +74,12 @@ jobs: needs: - lint ############################################################################## - 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 - - mvn_test + - test_mvn permissions: checks: write contents: read @@ -87,7 +96,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 }} diff --git a/.github/workflows/build_debug.yml b/.github/workflows/build_debug.yml deleted file mode 100644 index 5c1f3ac..0000000 --- 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 - - -############################################################################## - - mvn_test: - uses: ./.github/workflows/mvn_test.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 - - mvn_test - 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 be2054b..0000000 --- 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 - - mvn_test: - uses: ./.github/workflows/mvn_test.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 - - mvn_test - - 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/pr.yml b/.github/workflows/pr.yml index 53f36d7..b50a2f2 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -17,8 +17,8 @@ concurrency: cancel-in-progress: true jobs: - 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/pushmain.yml b/.github/workflows/pushmain.yml index f45606e..7a59907 100644 --- a/.github/workflows/pushmain.yml +++ b/.github/workflows/pushmain.yml @@ -20,8 +20,8 @@ concurrency: cancel-in-progress: false jobs: - build_test_release_tag: - uses: ./.github/workflows/build_test_release_tag.yml + bld_test_rel_tag: + uses: ./.github/workflows/bld_test_rel_tag.yml secrets: inherit # pass all secrets for pushing with: # NOTE: passing in a specific branch means that commits made during the pipeline before the final build is completed will be included diff --git a/.github/workflows/mvn_test.yml b/.github/workflows/test_mvn.yml similarity index 98% rename from .github/workflows/mvn_test.yml rename to .github/workflows/test_mvn.yml index 846f8e4..39fa493 100644 --- a/.github/workflows/mvn_test.yml +++ b/.github/workflows/test_mvn.yml @@ -1,4 +1,4 @@ -name: mvn_test +name: test_mvn # run maven tests and publish results in one step @@ -77,12 +77,13 @@ on: jobs: - mvn_test: + test_mvn: strategy: matrix: include: - project: hello_world + - project: hello_world_2 runs-on: ubuntu-latest steps: diff --git a/hello_world_2/pom.xml b/hello_world_2/pom.xml new file mode 100644 index 0000000..89c5217 --- /dev/null +++ b/hello_world_2/pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + + com.example + hello-world-parent + 1.0-SNAPSHOT + + + hello-world + + + + org.junit.jupiter + junit-jupiter-api + 5.7.0 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.7.0 + test + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + diff --git a/hello_world_2/src/main/java/com/example/HelloWorld.java b/hello_world_2/src/main/java/com/example/HelloWorld.java new file mode 100644 index 0000000..97c4f9f --- /dev/null +++ b/hello_world_2/src/main/java/com/example/HelloWorld.java @@ -0,0 +1,12 @@ +package com.example; + +public class HelloWorld { + public String sayHello() { + return "Hello, World!"; + } + + public static void main(String[] args) { + HelloWorld helloWorld = new HelloWorld(); + System.out.println(helloWorld.sayHello()); + } +} diff --git a/hello_world_2/src/test/java/com/example/HelloWorldTest.java b/hello_world_2/src/test/java/com/example/HelloWorldTest.java new file mode 100644 index 0000000..1802e10 --- /dev/null +++ b/hello_world_2/src/test/java/com/example/HelloWorldTest.java @@ -0,0 +1,28 @@ +package com.example; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class HelloWorldTest { + + @Test + public void testSayHello() { + HelloWorld helloWorld = new HelloWorld(); + assertEquals("Hello, World!", helloWorld.sayHello()); + } + + @Test + public void testFailingAssertion() { + // This assertion will fail + assertTrue(false, "This is a failing test to test the pipeline."); + } + + @Test + public void testFailingAssertionMore() { + // This assertion will fail + assertTrue(false, "This is also failing test to test the pipeline."); + } + + +} diff --git a/pom.xml b/pom.xml index 9b28603..76eff46 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,7 @@ hello_world + hello_world_2