From b0df8da39944ba380fa59ca5756dfbefcf1ec498 Mon Sep 17 00:00:00 2001 From: Kenneth Mead Date: Thu, 23 Oct 2025 23:17:58 -0400 Subject: [PATCH 1/6] added spec compliance workflow fixes eclipse-uprotocol/up-rust#282 --- .../update-spec-compliance-badge.yaml | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/update-spec-compliance-badge.yaml diff --git a/.github/workflows/update-spec-compliance-badge.yaml b/.github/workflows/update-spec-compliance-badge.yaml new file mode 100644 index 0000000..059b713 --- /dev/null +++ b/.github/workflows/update-spec-compliance-badge.yaml @@ -0,0 +1,86 @@ +# ******************************************************************************** +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +name: Update Spec Compliance Badge + +on: + workflow_call: + secrets: + UP_SPEC_COMPLIANCE_GIST_TOKEN: + required: true + +jobs: + update-spec-compliance-badge: + name: update spec compliance badge + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Get current spec version + id: current-spec-version + run: | + UP_SPEC_COMMIT=$(git ls-tree HEAD up-spec | awk '{print $3}') + echo "Up-spec submodule is at commit: $UP_SPEC_COMMIT" + cd up-spec + git fetch --tags + CURRENT_UP_SPEC_VERSION=$(git describe --tags --exact-match) + if [ -z "$CURRENT_UP_SPEC_VERSION" ]; then + echo "No tag found at up-spec commit $UP_SPEC_COMMIT, using nearest tagged commit hash" + CURRENT_UP_SPEC_VERSION=$(git rev-parse --short HEAD) + NEAREST_UP_SPEC_VERSION=$(git describe --tags --abbrev=0) + CURRENT_UP_SPEC_VERSION=$CURRENT_UP_SPEC_VERSION.$NEAREST_UP_SPEC_VERSION + echo "nearest tag and its commit hash: $CURRENT_UP_SPEC_VERSION" + echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT + else + echo "Current commit is tagged as: $CURRENT_UP_SPEC_VERSION" + echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT + fi + + - name: Get latest spec version + id: latest-spec-version + run: | + cd up-spec + git fetch --tags + LATEST_UP_SPEC_VERSION=$(git ls-remote --tags origin | grep -v '\^{}' | grep -E 'refs/tags/v?[0-9]+\.[0-9]+' | sort -V -k2 | tail -1 | cut -d'/' -f3) + if [ -n "$LATEST_UP_SPEC_VERSION" ]; then + echo "Found latest up-spec tag: $LATEST_UP_SPEC_VERSION" + else + # Fallback to main branch if no tags found + LATEST_UP_SPEC_VERSION=$(git ls-remote origin main | cut -f1 | cut -c1-7) + echo "No tags found, using main branch commit: $LATEST_UP_SPEC_VERSION" + fi + echo "latest_up_spec_version=$LATEST_UP_SPEC_VERSION" >> $GITHUB_OUTPUT + + - name: Is current spec version latest? + id: is-latest + run: | + if [ "${{ steps.current-spec-version.outputs.current_up_spec_version }}" = "${{ steps.latest-spec-version.outputs.latest_up_spec_version }}" ]; then + echo "Current spec version is the latest." + echo "is_latest=true" >> $GITHUB_OUTPUT + else + echo "Current spec version is not the latest." + echo "is_latest=false" >> $GITHUB_OUTPUT + fi + + - name: Update spec compliance badge gist + uses: schneegans/dynamic-badges-action@v1.7.0 + with: + auth: ${{ secrets.UP_SPEC_COMPLIANCE_GIST_TOKEN }} + gistID: 80759847e7bd262515184cb28f588a09 + filename: spec-compliance-badge.json + label: up-spec + message: ${{ steps.current-spec-version.outputs.current_up_spec_version }} + color: ${{ steps.is-latest.outputs.is_latest == 'true' && 'brightgreen' || 'red' }} From 6aba6bb25669cd1fd1cea766326fbb8a5cdba52b Mon Sep 17 00:00:00 2001 From: Kenneth Mead Date: Sun, 14 Dec 2025 12:32:00 -0500 Subject: [PATCH 2/6] added badge creation for up-spec version and compliance checks issue 282 --- .github/actions/check-spec-version/action.yml | 85 ++++++++++++++++++ .../create-spec-compliance-badge/action.yml | 46 ++++++++++ .../create-spec-version-badge/action.yml | 52 +++++++++++ .github/workflows/requirements-tracing.yaml | 4 + .../update-spec-compliance-badge.yaml | 86 ------------------- 5 files changed, 187 insertions(+), 86 deletions(-) create mode 100644 .github/actions/check-spec-version/action.yml create mode 100644 .github/actions/create-spec-compliance-badge/action.yml create mode 100644 .github/actions/create-spec-version-badge/action.yml delete mode 100644 .github/workflows/update-spec-compliance-badge.yaml diff --git a/.github/actions/check-spec-version/action.yml b/.github/actions/check-spec-version/action.yml new file mode 100644 index 0000000..f51a24c --- /dev/null +++ b/.github/actions/check-spec-version/action.yml @@ -0,0 +1,85 @@ +# ******************************************************************************** +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# *******************************************************************************/ + +name: 'Check Spec Version' +description: 'Checks the current up-spec version and compares it with the latest version' +author: 'Eclipse uProtocol' + +inputs: + submodule-path: + description: 'Path to the up-spec submodule' + required: false + default: 'up-spec' + +outputs: + current-version: + description: 'Current up-spec version' + value: ${{ steps.current-spec-version.outputs.current_up_spec_version }} + latest-version: + description: 'Latest up-spec version' + value: ${{ steps.latest-spec-version.outputs.latest_up_spec_version }} + is-latest: + description: 'Whether the current version is the latest (true/false)' + value: ${{ steps.is-latest.outputs.is_latest }} + +runs: + using: 'composite' + steps: + - name: Get current spec version + id: current-spec-version + shell: bash + run: | + UP_SPEC_COMMIT=$(git ls-tree HEAD ${{ inputs.submodule-path }} | awk '{print $3}') + echo "Up-spec submodule is at commit: $UP_SPEC_COMMIT" + cd ${{ inputs.submodule-path }} + git fetch --tags + CURRENT_UP_SPEC_VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "") + if [ -z "$CURRENT_UP_SPEC_VERSION" ]; then + echo "No tag found at up-spec commit $UP_SPEC_COMMIT, using nearest tagged commit hash" + CURRENT_UP_SPEC_VERSION=$(git rev-parse --short HEAD) + NEAREST_UP_SPEC_VERSION=$(git describe --tags --abbrev=0) + CURRENT_UP_SPEC_VERSION=$NEAREST_UP_SPEC_VERSION.$CURRENT_UP_SPEC_VERSION + echo "nearest tag and its commit hash: $CURRENT_UP_SPEC_VERSION" + echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT + else + echo "Current commit is tagged as: $CURRENT_UP_SPEC_VERSION" + echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT + fi + + - name: Get latest spec version + id: latest-spec-version + shell: bash + run: | + cd ${{ inputs.submodule-path }} + git fetch --tags + LATEST_UP_SPEC_VERSION=$(git ls-remote --tags origin | grep -v '\^{}' | grep -E 'refs/tags/v?[0-9]+\.[0-9]+' | sort -V -k2 | tail -1 | cut -d'/' -f3) + if [ -n "$LATEST_UP_SPEC_VERSION" ]; then + echo "Found latest up-spec tag: $LATEST_UP_SPEC_VERSION" + else + # Fallback to main branch if no tags found + LATEST_UP_SPEC_VERSION=$(git ls-remote origin main | cut -f1 | cut -c1-7) + echo "No tags found, using main branch commit: $LATEST_UP_SPEC_VERSION" + fi + echo "latest_up_spec_version=$LATEST_UP_SPEC_VERSION" >> $GITHUB_OUTPUT + + - name: Is current spec version latest? + id: is-latest + shell: bash + run: | + if [ "${{ steps.current-spec-version.outputs.current_up_spec_version }}" = "${{ steps.latest-spec-version.outputs.latest_up_spec_version }}" ]; then + echo "Current spec version is the latest." + echo "is_latest=true" >> $GITHUB_OUTPUT + else + echo "Current spec version is not the latest." + echo "is_latest=false" >> $GITHUB_OUTPUT + fi diff --git a/.github/actions/create-spec-compliance-badge/action.yml b/.github/actions/create-spec-compliance-badge/action.yml new file mode 100644 index 0000000..05faef1 --- /dev/null +++ b/.github/actions/create-spec-compliance-badge/action.yml @@ -0,0 +1,46 @@ +# ******************************************************************************** +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# *******************************************************************************/ + +name: 'Create Spec Compliance Badge' +description: 'Creates a badge showing the compliance of the up-spec based on the OFT actions exit code' +author: 'Eclipse uProtocol' + +inputs: + oft-exit-code: + description: 'Exit code of the OFT tests (0 for pass, non-0 for fail)' + required: true + badge-path: + description: 'Path where the badge SVG will be saved' + required: false + default: '.github/badges/spec-compliance.svg' + +outputs: + badge-path: + description: 'Path to the generated badge file' + value: ${{ inputs.badge-path }} + +runs: + using: 'composite' + steps: + - name: Create badge directory + shell: bash + run: mkdir -p "$(dirname '${{ inputs.badge-path }}')" + + - name: Generate the badge SVG image + uses: emibcn/badge-action@v2.0.3 + id: generate + with: + label: up-spec compliance + status: ${{ inputs.oft-exit-code }} + color: ${{ inputs.oft-exit-code == '0' && 'brightgreen' || 'red' }} + path: ${{ inputs.badge-path }} diff --git a/.github/actions/create-spec-version-badge/action.yml b/.github/actions/create-spec-version-badge/action.yml new file mode 100644 index 0000000..e113391 --- /dev/null +++ b/.github/actions/create-spec-version-badge/action.yml @@ -0,0 +1,52 @@ +# ******************************************************************************** +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# *******************************************************************************/ + +name: 'Create Spec Version Badge' +description: 'Creates a badge showing the current up-spec version and whether it is the latest' +author: 'Eclipse uProtocol' + +inputs: + current-version: + description: 'Current up-spec version' + required: true + latest-version: + description: 'Latest up-spec version' + required: true + is-latest: + description: 'Whether the current version is the latest (true/false)' + required: true + badge-path: + description: 'Path where the badge SVG will be saved' + required: false + default: '.github/badges/spec-version.svg' + +outputs: + badge-path: + description: 'Path to the generated badge file' + value: ${{ inputs.badge-path }} + +runs: + using: 'composite' + steps: + - name: Create badge directory + shell: bash + run: mkdir -p "$(dirname '${{ inputs.badge-path }}')" + + - name: Generate the badge SVG image + uses: emibcn/badge-action@v2.0.3 + id: generate + with: + label: up-spec + status: ${{ inputs.current-version }} + color: ${{ inputs.is-latest == 'true' && 'brightgreen' || 'red' }} + path: ${{ inputs.badge-path }} diff --git a/.github/workflows/requirements-tracing.yaml b/.github/workflows/requirements-tracing.yaml index 8a5e943..00e8571 100644 --- a/.github/workflows/requirements-tracing.yaml +++ b/.github/workflows/requirements-tracing.yaml @@ -61,6 +61,9 @@ on: tracing-report-url: description: "URL of the requirements tracing report" value: ${{ jobs.tracing.outputs.tracing-report-url }} + oft-exit-code: + description: "Exit code of the OpenFastTrace run (0: success, 1: failure)" + value: ${{ jobs.tracing.outputs.oft-exit-code }} jobs: tracing: @@ -68,6 +71,7 @@ jobs: runs-on: ubuntu-latest outputs: tracing-report-url: ${{ steps.run-oft.outputs.tracing-report-url }} + oft-exit-code: ${{ steps.run-oft.outputs.oft-exit-code }} steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/update-spec-compliance-badge.yaml b/.github/workflows/update-spec-compliance-badge.yaml deleted file mode 100644 index 059b713..0000000 --- a/.github/workflows/update-spec-compliance-badge.yaml +++ /dev/null @@ -1,86 +0,0 @@ -# ******************************************************************************** -# Copyright (c) 2025 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Apache License Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# ******************************************************************************* - -name: Update Spec Compliance Badge - -on: - workflow_call: - secrets: - UP_SPEC_COMPLIANCE_GIST_TOKEN: - required: true - -jobs: - update-spec-compliance-badge: - name: update spec compliance badge - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Get current spec version - id: current-spec-version - run: | - UP_SPEC_COMMIT=$(git ls-tree HEAD up-spec | awk '{print $3}') - echo "Up-spec submodule is at commit: $UP_SPEC_COMMIT" - cd up-spec - git fetch --tags - CURRENT_UP_SPEC_VERSION=$(git describe --tags --exact-match) - if [ -z "$CURRENT_UP_SPEC_VERSION" ]; then - echo "No tag found at up-spec commit $UP_SPEC_COMMIT, using nearest tagged commit hash" - CURRENT_UP_SPEC_VERSION=$(git rev-parse --short HEAD) - NEAREST_UP_SPEC_VERSION=$(git describe --tags --abbrev=0) - CURRENT_UP_SPEC_VERSION=$CURRENT_UP_SPEC_VERSION.$NEAREST_UP_SPEC_VERSION - echo "nearest tag and its commit hash: $CURRENT_UP_SPEC_VERSION" - echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT - else - echo "Current commit is tagged as: $CURRENT_UP_SPEC_VERSION" - echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT - fi - - - name: Get latest spec version - id: latest-spec-version - run: | - cd up-spec - git fetch --tags - LATEST_UP_SPEC_VERSION=$(git ls-remote --tags origin | grep -v '\^{}' | grep -E 'refs/tags/v?[0-9]+\.[0-9]+' | sort -V -k2 | tail -1 | cut -d'/' -f3) - if [ -n "$LATEST_UP_SPEC_VERSION" ]; then - echo "Found latest up-spec tag: $LATEST_UP_SPEC_VERSION" - else - # Fallback to main branch if no tags found - LATEST_UP_SPEC_VERSION=$(git ls-remote origin main | cut -f1 | cut -c1-7) - echo "No tags found, using main branch commit: $LATEST_UP_SPEC_VERSION" - fi - echo "latest_up_spec_version=$LATEST_UP_SPEC_VERSION" >> $GITHUB_OUTPUT - - - name: Is current spec version latest? - id: is-latest - run: | - if [ "${{ steps.current-spec-version.outputs.current_up_spec_version }}" = "${{ steps.latest-spec-version.outputs.latest_up_spec_version }}" ]; then - echo "Current spec version is the latest." - echo "is_latest=true" >> $GITHUB_OUTPUT - else - echo "Current spec version is not the latest." - echo "is_latest=false" >> $GITHUB_OUTPUT - fi - - - name: Update spec compliance badge gist - uses: schneegans/dynamic-badges-action@v1.7.0 - with: - auth: ${{ secrets.UP_SPEC_COMPLIANCE_GIST_TOKEN }} - gistID: 80759847e7bd262515184cb28f588a09 - filename: spec-compliance-badge.json - label: up-spec - message: ${{ steps.current-spec-version.outputs.current_up_spec_version }} - color: ${{ steps.is-latest.outputs.is_latest == 'true' && 'brightgreen' || 'red' }} From 554bc313c7b9e2b3d93c7c3d52848952e40b1a6e Mon Sep 17 00:00:00 2001 From: Kenneth Mead Date: Sun, 14 Dec 2025 13:40:41 -0500 Subject: [PATCH 3/6] added checkout action to up-spec version check --- .github/actions/check-spec-version/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/check-spec-version/action.yml b/.github/actions/check-spec-version/action.yml index f51a24c..478e611 100644 --- a/.github/actions/check-spec-version/action.yml +++ b/.github/actions/check-spec-version/action.yml @@ -35,6 +35,10 @@ outputs: runs: using: 'composite' steps: + - uses: actions/checkout@v6 + with: + submodules: true + - name: Get current spec version id: current-spec-version shell: bash From 0c6b18c20a21a31eee69d1ce9e279d1a8a3d5322 Mon Sep 17 00:00:00 2001 From: Kenneth Mead Date: Sun, 14 Dec 2025 13:45:58 -0500 Subject: [PATCH 4/6] updated up-spec version check flow --- .github/actions/check-spec-version/action.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/actions/check-spec-version/action.yml b/.github/actions/check-spec-version/action.yml index 478e611..0c72cf5 100644 --- a/.github/actions/check-spec-version/action.yml +++ b/.github/actions/check-spec-version/action.yml @@ -43,22 +43,20 @@ runs: id: current-spec-version shell: bash run: | - UP_SPEC_COMMIT=$(git ls-tree HEAD ${{ inputs.submodule-path }} | awk '{print $3}') - echo "Up-spec submodule is at commit: $UP_SPEC_COMMIT" cd ${{ inputs.submodule-path }} + UP_SPEC_COMMIT_HASH=$(git rev-parse --short HEAD) + echo "Up-spec submodule is at commit: $UP_SPEC_COMMIT_HASH" git fetch --tags CURRENT_UP_SPEC_VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "") if [ -z "$CURRENT_UP_SPEC_VERSION" ]; then - echo "No tag found at up-spec commit $UP_SPEC_COMMIT, using nearest tagged commit hash" - CURRENT_UP_SPEC_VERSION=$(git rev-parse --short HEAD) + echo "No tag found at up-spec commit $UP_SPEC_COMMIT_HASH, using nearest tagged commit hash" NEAREST_UP_SPEC_VERSION=$(git describe --tags --abbrev=0) - CURRENT_UP_SPEC_VERSION=$NEAREST_UP_SPEC_VERSION.$CURRENT_UP_SPEC_VERSION + CURRENT_UP_SPEC_VERSION=$NEAREST_UP_SPEC_VERSION.$UP_SPEC_COMMIT_HASH echo "nearest tag and its commit hash: $CURRENT_UP_SPEC_VERSION" - echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT else echo "Current commit is tagged as: $CURRENT_UP_SPEC_VERSION" - echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT fi + echo "current_up_spec_version=$CURRENT_UP_SPEC_VERSION" >> $GITHUB_OUTPUT - name: Get latest spec version id: latest-spec-version From a9d6013eb0dcb32226d35611a7df3831c8f7f524 Mon Sep 17 00:00:00 2001 From: Kenneth Mead Date: Sun, 14 Dec 2025 13:54:14 -0500 Subject: [PATCH 5/6] updated tag resolution strategy --- .github/actions/check-spec-version/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/check-spec-version/action.yml b/.github/actions/check-spec-version/action.yml index 0c72cf5..91aed1a 100644 --- a/.github/actions/check-spec-version/action.yml +++ b/.github/actions/check-spec-version/action.yml @@ -37,7 +37,7 @@ runs: steps: - uses: actions/checkout@v6 with: - submodules: true + submodules: 'recursive' - name: Get current spec version id: current-spec-version @@ -50,7 +50,7 @@ runs: CURRENT_UP_SPEC_VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "") if [ -z "$CURRENT_UP_SPEC_VERSION" ]; then echo "No tag found at up-spec commit $UP_SPEC_COMMIT_HASH, using nearest tagged commit hash" - NEAREST_UP_SPEC_VERSION=$(git describe --tags --abbrev=0) + NEAREST_UP_SPEC_VERSION=$(git tag --sort=-creatordate | head -n 1) CURRENT_UP_SPEC_VERSION=$NEAREST_UP_SPEC_VERSION.$UP_SPEC_COMMIT_HASH echo "nearest tag and its commit hash: $CURRENT_UP_SPEC_VERSION" else From ab48479520cbfc3eabe22df5615f20187b48e879 Mon Sep 17 00:00:00 2001 From: Kenneth Mead Date: Sun, 14 Dec 2025 13:56:14 -0500 Subject: [PATCH 6/6] updated label for up-spec compliance badge --- .github/actions/create-spec-compliance-badge/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/create-spec-compliance-badge/action.yml b/.github/actions/create-spec-compliance-badge/action.yml index 05faef1..cc581be 100644 --- a/.github/actions/create-spec-compliance-badge/action.yml +++ b/.github/actions/create-spec-compliance-badge/action.yml @@ -41,6 +41,6 @@ runs: id: generate with: label: up-spec compliance - status: ${{ inputs.oft-exit-code }} + status: ${{ inputs.oft-exit-code == '0' && 'passing' || 'failing' }} color: ${{ inputs.oft-exit-code == '0' && 'brightgreen' || 'red' }} path: ${{ inputs.badge-path }}