diff --git a/.github/workflows/maven_test_artifact.yml b/.github/workflows/maven_test_artifact.yml deleted file mode 100644 index fe576eb..0000000 --- a/.github/workflows/maven_test_artifact.yml +++ /dev/null @@ -1,124 +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' - -######################################################################################## - - 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 }} - - echo "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" - - - 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 e44b1f7..0000000 --- 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 72% rename from .github/workflows/maven_test_publish.yml rename to .github/workflows/mvn_test.yml index aa8205b..8512a79 100644 --- a/.github/workflows/maven_test_publish.yml +++ b/.github/workflows/mvn_test.yml @@ -1,7 +1,6 @@ -name: maven_test_publish +name: mvn_test # run maven tests and publish results in one step -# run from privileged branch permissions: checks: write @@ -78,7 +77,13 @@ on: jobs: - maven_test: + mvn_test: + + strategy: + matrix: + include: + - project: hello_world + runs-on: ubuntu-latest steps: - name: git-checkout-ref-action @@ -109,51 +114,25 @@ jobs: java-version: '11' ######################################################################################## - - name: "Test ${{ inputs.project }}" + - name: "Test ${{ matrix.project }}" run: | mvn -T 1C --batch-mode test \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ - --projects=${{ inputs.project }} --fail-at-end + --projects=${{ matrix.project }} --fail-at-end - - name: Publish Unit Test Results + - 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@e9fa2f582c0ebbe2e263fd18fad744d52e0b0203 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: Publish Unit Test Results -# uses: scacap/action-surefire-report@v1.8.0 -# if: failure() # only report if a test has failed -# with: -# report_paths: ${{ inputs.project }}/target/surefire-reports/*.xml -# create_check: true -# fail_on_test_failures: false -# file_name_in_stack_trace: true -# skip_publishing: false -# fail_if_no_tests: false - -# - name: Publish Unit Test Results non forked repo -# uses: mikepenz/action-junit-report@v5 -# 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 -# with: -# check_name: Unit Test Report ${{ inputs.project }} -# report_paths: ${{ inputs.project }}/target/surefire-reports/*.xml -# annotate_only: false -# - - name: Publish Unit Test Results forked repo - uses: mikepenz/action-junit-report@v5 + - name: Publish Unit 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: ${{ inputs.project }}/target/surefire-reports/*.xml - annotate_only: true # forked repo cannot write to checks - - - - - - - + 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 9c4c32a..53f36d7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -17,8 +17,8 @@ concurrency: cancel-in-progress: true jobs: - unit_tests_publish: - uses: ./.github/workflows/unit_tests_publish.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 3d007a3..0000000 --- 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/unit_tests_artifact.yml b/.github/workflows/unit_tests_artifact.yml deleted file mode 100644 index 77d775c..0000000 --- a/.github/workflows/unit_tests_artifact.yml +++ /dev/null @@ -1,73 +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_hw: - uses: ./.github/workflows/maven_test_artifact.yml - with: - project: hello_world - 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 b227776..0000000 --- a/.github/workflows/unit_tests_publish.yml +++ /dev/null @@ -1,74 +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_hello_world: - uses: ./.github/workflows/maven_test_publish.yml - with: - project: hello_world - 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 }} diff --git a/.github/workflows/unit_tests_report.yml b/.github/workflows/unit_tests_report.yml deleted file mode 100644 index 6d98244..0000000 --- a/.github/workflows/unit_tests_report.yml +++ /dev/null @@ -1,26 +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_hello_world: - uses: ./.github/workflows/maven_test_report.yml - with: - project: hello_world -