From f23a4dc1c2853b86c577091815458020d747e38e Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 16:26:55 +0800 Subject: [PATCH 01/22] Update release action --- .github/workflows/release.yml | 103 +++++++++++++++++++++++++++------- 1 file changed, 82 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4078defc..b9d6b1b07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,14 @@ on: description: 'Is this a re-release of existing tag/release? (Default: false)' default: 'false' required: false + +env: + repository_name: coreMQTT + source_folder_list: "source test" + mqtt_version_macro_file: source/include/core_mqtt.h + repository_compressed_name: coreMQTT-${{ github.event.inputs.version_number }} + repository_zip_name: coreMQTT-${{ github.event.inputs.version_number }}.zip + jobs: clean-existing-tag-and-release: if: ${{ github.event.inputs.delete_existing_tag_release == 'true' }} @@ -22,7 +30,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 + - name: Check if tag exists run: | git fetch origin @@ -31,6 +40,7 @@ jobs: echo "Deleting existing tag for $VERSION_NUM" git push origin --delete tags/$VERSION_NUM fi + - name: Check if release exists run: | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 23F3D4EA75716059 @@ -42,6 +52,7 @@ jobs: echo "Deleting existing release for $VERSION_NUM" gh release delete --yes $VERSION_NUM fi + add-sbom-and-tag-commit: if: ${{ ( github.event.inputs.delete_existing_tag_release == 'true' && success() ) || ( github.event.inputs.delete_existing_tag_release == 'false' && always() ) }} needs: clean-existing-tag-and-release @@ -49,35 +60,74 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.commit_id }} + - name: Configure git identity run: | git config --global user.name ${{ github.actor }} git config --global user.email ${{ github.actor }}@users.noreply.github.com + - name: create a new branch that references commit id run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }} + + - name: Update version number in source file + run: | + echo "${{ env.source_folder_list }}" | \ + xargs -n 1 sh -c \ + 'find $1 -type f \( -name "*.c" -o -name "*.h" \) \ + -exec sed -i -b -E "0,/^\* ${{ env.repository_name }}/s/\* ${{ env.repository_name }}.*/\* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}/g" {} +' + git add . + git commit -m '[AUTO][RELEASE]: Update version number in source files' + git push -u origin ${{ github.event.inputs.version_number }} + + - name : Update version number in manifest.yml + run: | + sed -i -b '0,/^versoin/s/^version.*/version: "${{ github.event.inputs.version_number }}"/g' ./manifest.yml + git add . + git commit -m '[AUTO][RELEASE]: Update version number in manifest.yml' + git push -u origin ${{ github.event.inputs.version_number }} + + - name : Update version number in doxygen + run: | + sed -i -b 's/PROJECT_NUMBER *=.*/PROJECT_NUMBER = ${{ github.event.inputs.version_number }}/g' ./docs/doxygen/config.doxyfile + git add . + git commit -m '[AUTO][RELEASE]: Update version number in manifest.yml' + git push -u origin ${{ github.event.inputs.version_number }} + + - name : Update MQTT version number macro + if: ${{ env.mqtt_version_macro_file }} + run: | + sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' ${{ env.mqtt_version_macro_file }} + git add . + git commit -m '[AUTO][RELEASE]: Update version number macro in ${{ env.mqtt_version_macro_file }}' + git push -u origin ${{ github.event.inputs.version_number }} + - name: Generate SBOM uses: FreeRTOS/CI-CD-Github-Actions/sbom-generator@main with: repo_path: ./ source_path: ./source + - name: commit SBOM file run: | git add . git commit -m 'Update SBOM' git push -u origin ${{ github.event.inputs.version_number }} + - name: Tag Commit and Push to remote run: | - git tag ${{ github.event.inputs.version_number }} -a -m "coreMQTT Library ${{ github.event.inputs.version_number }}" + git tag ${{ github.event.inputs.version_number }} -a -m "${{ env.repository_name }} Library ${{ github.event.inputs.version_number }}" git push origin --tags + - name: Verify tag on remote run: | git tag -d ${{ github.event.inputs.version_number }} git remote update git checkout tags/${{ github.event.inputs.version_number }} git diff ${{ github.event.inputs.commit_id }} tags/${{ github.event.inputs.version_number }} + create-zip: if: ${{ ( github.event.inputs.delete_existing_tag_release == 'true' && success() ) || ( github.event.inputs.delete_existing_tag_release == 'false' && always() ) }} needs: add-sbom-and-tag-commit @@ -86,32 +136,37 @@ jobs: steps: - name: Install ZIP tools run: sudo apt-get install zip unzip + - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.commit_id }} - path: coreMQTT + path: ${{ env.repository_name }} submodules: recursive + - name: Checkout disabled submodules run: | - cd coreMQTT + cd ${{ env.repository_name }} git submodule update --init --checkout --recursive + - name: Create ZIP run: | - zip -r coreMQTT-${{ github.event.inputs.version_number }}.zip coreMQTT -x "*.git*" + zip -r ${{ env.repository_zip_name }} ${{ env.repository_name }} -x "*.git*" ls ./ + - name: Validate created ZIP run: | mkdir zip-check - mv coreMQTT-${{ github.event.inputs.version_number }}.zip zip-check + mv ${{ env.repository_zip_name }} zip-check cd zip-check - unzip coreMQTT-${{ github.event.inputs.version_number }}.zip -d coreMQTT-${{ github.event.inputs.version_number }} - ls coreMQTT-${{ github.event.inputs.version_number }} - diff -r -x "*.git*" coreMQTT-${{ github.event.inputs.version_number }}/coreMQTT/ ../coreMQTT/ + unzip ${{ env.repository_zip_name }} -d ${{ env.repository_compressed_name }} + ls ${{ env.repository_compressed_name }} + diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ env.repository_name }}/ ../${{ env.repository_name }}/ cd ../ + - name: Build run: | - cd zip-check/coreMQTT-${{ github.event.inputs.version_number }}/coreMQTT + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} sudo apt-get install -y lcov cmake -S test -B build/ \ -G "Unix Makefiles" \ @@ -119,16 +174,19 @@ jobs: -DBUILD_CLONE_SUBMODULES=ON \ -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG' make -C build/ all + - name: Test run: | - cd zip-check/coreMQTT-${{ github.event.inputs.version_number }}/coreMQTT/build/ + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }}/build/ ctest -E system --output-on-failure cd .. + - name: Create artifact of ZIP - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: coreMQTT-${{ github.event.inputs.version_number }}.zip - path: zip-check/coreMQTT-${{ github.event.inputs.version_number }}.zip + name: ${{ env.repository_zip_name }} + path: zip-check/${{ env.repository_zip_name }} + deploy-doxygen: needs: add-sbom-and-tag-commit if: ${{ ( github.event.inputs.delete_existing_tag_release == 'true' && success() ) || ( github.event.inputs.delete_existing_tag_release == 'false' && always() ) }} @@ -140,6 +198,7 @@ jobs: with: ref: ${{ github.event.inputs.version_number }} add_release: "true" + create-release: needs: - create-zip @@ -156,13 +215,15 @@ jobs: with: tag_name: ${{ github.event.inputs.version_number }} release_name: ${{ github.event.inputs.version_number }} - body: Release ${{ github.event.inputs.version_number }} of the coreMQTT Library. + body: Release ${{ github.event.inputs.version_number }} of the ${{ env.repository_name }} Library. draft: false prerelease: false + - name: Download ZIP artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: - name: coreMQTT-${{ github.event.inputs.version_number }}.zip + name: ${{ env.repository_zip_name }} + - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 @@ -170,6 +231,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./coreMQTT-${{ github.event.inputs.version_number }}.zip - asset_name: coreMQTT-${{ github.event.inputs.version_number }}.zip + asset_path: ./${{ env.repository_zip_name }} + asset_name: ${{ env.repository_zip_name }} asset_content_type: application/zip From f41e6e3efae31090e536ee2e98f0ff3659ea5128 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 18:58:08 +0800 Subject: [PATCH 02/22] Update version number with development information --- docs/doxygen/config.doxyfile | 2 +- manifest.yml | 2 +- source/include/core_mqtt.h | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/doxygen/config.doxyfile b/docs/doxygen/config.doxyfile index 72b6f1234..dee1ba57a 100644 --- a/docs/doxygen/config.doxyfile +++ b/docs/doxygen/config.doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = coreMQTT # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v2.3.0 +PROJECT_NUMBER = v2.3.0+ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/manifest.yml b/manifest.yml index 0d4003852..8381c01c9 100644 --- a/manifest.yml +++ b/manifest.yml @@ -1,5 +1,5 @@ name : "coreMQTT" -version: "v2.3.0" +version: "v2.3.0+" description: | "Client implementation of the MQTT 3.1.1 specification for embedded devices.\n" license: "MIT" diff --git a/source/include/core_mqtt.h b/source/include/core_mqtt.h index fdfb06799..636169d36 100644 --- a/source/include/core_mqtt.h +++ b/source/include/core_mqtt.h @@ -44,8 +44,11 @@ /** * @cond DOXYGEN_IGNORE * The current version of this library. + * + * If MQTT_LIBRARY_VERSION ends with + it represents the version in development + * after the numbered release. */ -#define MQTT_LIBRARY_VERSION "v2.1.0" +#define MQTT_LIBRARY_VERSION "v2.3.0+" /** @endcond */ /** From cd1fdd4203b57eaf5339bfe3c3de5b713eea2832 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:06:09 +0800 Subject: [PATCH 03/22] Fix release yml file for first occurance --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9d6b1b07..2c4746dd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,7 @@ jobs: echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c \ 'find $1 -type f \( -name "*.c" -o -name "*.h" \) \ - -exec sed -i -b -E "0,/^\* ${{ env.repository_name }}/s/\* ${{ env.repository_name }}.*/\* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}/g" {} +' + -exec sed -i -b -E "0,/^ \* ${{ env.repository_name }}/s/^ \* ${{ env.repository_name }}.*/ \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}/g" {} +' git add . git commit -m '[AUTO][RELEASE]: Update version number in source files' git push -u origin ${{ github.event.inputs.version_number }} From 89b06075089fd9bea9a1f226a65bbf0b78c03c49 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:06:59 +0800 Subject: [PATCH 04/22] Update version number in source file to development branch --- source/core_mqtt.c | 2 +- source/core_mqtt_serializer.c | 2 +- source/core_mqtt_state.c | 2 +- source/include/core_mqtt.h | 2 +- source/include/core_mqtt_config_defaults.h | 2 +- source/include/core_mqtt_serializer.h | 2 +- source/include/core_mqtt_state.h | 2 +- source/interface/transport_interface.h | 2 +- test/cbmc/include/core_mqtt_config.h | 2 +- test/cbmc/include/event_callback_stub.h | 2 +- test/cbmc/include/get_time_stub.h | 2 +- test/cbmc/include/mqtt_cbmc_state.h | 2 +- test/cbmc/include/network_interface_stubs.h | 2 +- test/cbmc/proofs/MQTT_Connect/MQTT_Connect_harness.c | 2 +- .../proofs/MQTT_DeserializeAck/MQTT_DeserializeAck_harness.c | 2 +- .../MQTT_DeserializePublish/MQTT_DeserializePublish_harness.c | 2 +- test/cbmc/proofs/MQTT_Disconnect/MQTT_Disconnect_harness.c | 2 +- .../MQTT_GetIncomingPacketTypeAndLength_harness.c | 2 +- test/cbmc/proofs/MQTT_GetPacketId/MQTT_GetPacketId_harness.c | 2 +- .../MQTT_GetSubAckStatusCodes_harness.c | 2 +- test/cbmc/proofs/MQTT_Init/MQTT_Init_harness.c | 2 +- test/cbmc/proofs/MQTT_MatchTopic/MQTT_MatchTopic_harness.c | 2 +- test/cbmc/proofs/MQTT_Ping/MQTT_Ping_harness.c | 2 +- test/cbmc/proofs/MQTT_ProcessLoop/MQTT_ProcessLoop_harness.c | 2 +- test/cbmc/proofs/MQTT_Publish/MQTT_Publish_harness.c | 2 +- test/cbmc/proofs/MQTT_ReceiveLoop/MQTT_ReceiveLoop_harness.c | 2 +- test/cbmc/proofs/MQTT_SerializeAck/MQTT_SerializeAck_harness.c | 2 +- .../MQTT_SerializeConnect/MQTT_SerializeConnect_harness.c | 2 +- .../MQTT_SerializeDisconnect/MQTT_SerializeDisconnect_harness.c | 2 +- .../MQTT_SerializePingreq/MQTT_SerializePingreq_harness.c | 2 +- .../MQTT_SerializePublish/MQTT_SerializePublish_harness.c | 2 +- .../MQTT_SerializePublishHeader_harness.c | 2 +- .../MQTT_SerializeSubscribe/MQTT_SerializeSubscribe_harness.c | 2 +- .../MQTT_SerializeUnsubscribe_harness.c | 2 +- test/cbmc/proofs/MQTT_Subscribe/MQTT_Subscribe_harness.c | 2 +- test/cbmc/proofs/MQTT_Unsubscribe/MQTT_Unsubscribe_harness.c | 2 +- test/cbmc/sources/mqtt_cbmc_state.c | 2 +- test/cbmc/stubs/event_callback_stub.c | 2 +- test/cbmc/stubs/get_time_stub.c | 2 +- test/cbmc/stubs/memmove.c | 2 +- test/cbmc/stubs/network_interface_stubs.c | 2 +- test/unit-test/cmock_opaque_types.h | 2 +- test/unit-test/core_mqtt_config.h | 2 +- test/unit-test/core_mqtt_serializer_utest.c | 2 +- test/unit-test/core_mqtt_state_utest.c | 2 +- test/unit-test/core_mqtt_utest.c | 2 +- test/unit-test/logging/logging_levels.h | 2 +- test/unit-test/logging/logging_stack.h | 2 +- 48 files changed, 48 insertions(+), 48 deletions(-) diff --git a/source/core_mqtt.c b/source/core_mqtt.c index c5c315f73..943e08e19 100644 --- a/source/core_mqtt.c +++ b/source/core_mqtt.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/core_mqtt_serializer.c b/source/core_mqtt_serializer.c index e0595ca2b..97022034c 100644 --- a/source/core_mqtt_serializer.c +++ b/source/core_mqtt_serializer.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/core_mqtt_state.c b/source/core_mqtt_state.c index 63f3e7c79..b4f769cff 100644 --- a/source/core_mqtt_state.c +++ b/source/core_mqtt_state.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/include/core_mqtt.h b/source/include/core_mqtt.h index 636169d36..b8ce19968 100644 --- a/source/include/core_mqtt.h +++ b/source/include/core_mqtt.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/include/core_mqtt_config_defaults.h b/source/include/core_mqtt_config_defaults.h index 18bde6d95..3fd79f974 100644 --- a/source/include/core_mqtt_config_defaults.h +++ b/source/include/core_mqtt_config_defaults.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/include/core_mqtt_serializer.h b/source/include/core_mqtt_serializer.h index 16f797da9..4837ee654 100644 --- a/source/include/core_mqtt_serializer.h +++ b/source/include/core_mqtt_serializer.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/include/core_mqtt_state.h b/source/include/core_mqtt_state.h index e785ea28f..bc229f666 100644 --- a/source/include/core_mqtt_state.h +++ b/source/include/core_mqtt_state.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/source/interface/transport_interface.h b/source/interface/transport_interface.h index eed47f9d1..401cadb1b 100644 --- a/source/interface/transport_interface.h +++ b/source/interface/transport_interface.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/include/core_mqtt_config.h b/test/cbmc/include/core_mqtt_config.h index b3906bbdd..1780bb6eb 100644 --- a/test/cbmc/include/core_mqtt_config.h +++ b/test/cbmc/include/core_mqtt_config.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/include/event_callback_stub.h b/test/cbmc/include/event_callback_stub.h index dc3101ec4..4c69541ad 100644 --- a/test/cbmc/include/event_callback_stub.h +++ b/test/cbmc/include/event_callback_stub.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/include/get_time_stub.h b/test/cbmc/include/get_time_stub.h index 500a17ed0..14284daae 100644 --- a/test/cbmc/include/get_time_stub.h +++ b/test/cbmc/include/get_time_stub.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/include/mqtt_cbmc_state.h b/test/cbmc/include/mqtt_cbmc_state.h index 49c810430..741fa4ee3 100644 --- a/test/cbmc/include/mqtt_cbmc_state.h +++ b/test/cbmc/include/mqtt_cbmc_state.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/include/network_interface_stubs.h b/test/cbmc/include/network_interface_stubs.h index 24c9bbde9..12a2b87cf 100644 --- a/test/cbmc/include/network_interface_stubs.h +++ b/test/cbmc/include/network_interface_stubs.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Connect/MQTT_Connect_harness.c b/test/cbmc/proofs/MQTT_Connect/MQTT_Connect_harness.c index a1a613509..1ab176f09 100644 --- a/test/cbmc/proofs/MQTT_Connect/MQTT_Connect_harness.c +++ b/test/cbmc/proofs/MQTT_Connect/MQTT_Connect_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_DeserializeAck/MQTT_DeserializeAck_harness.c b/test/cbmc/proofs/MQTT_DeserializeAck/MQTT_DeserializeAck_harness.c index 9b50dcab6..09dd26ff3 100644 --- a/test/cbmc/proofs/MQTT_DeserializeAck/MQTT_DeserializeAck_harness.c +++ b/test/cbmc/proofs/MQTT_DeserializeAck/MQTT_DeserializeAck_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_DeserializePublish/MQTT_DeserializePublish_harness.c b/test/cbmc/proofs/MQTT_DeserializePublish/MQTT_DeserializePublish_harness.c index 474dc0935..531f8044d 100644 --- a/test/cbmc/proofs/MQTT_DeserializePublish/MQTT_DeserializePublish_harness.c +++ b/test/cbmc/proofs/MQTT_DeserializePublish/MQTT_DeserializePublish_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Disconnect/MQTT_Disconnect_harness.c b/test/cbmc/proofs/MQTT_Disconnect/MQTT_Disconnect_harness.c index 95cb99e1d..95fb4eee1 100644 --- a/test/cbmc/proofs/MQTT_Disconnect/MQTT_Disconnect_harness.c +++ b/test/cbmc/proofs/MQTT_Disconnect/MQTT_Disconnect_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_GetIncomingPacketTypeAndLength/MQTT_GetIncomingPacketTypeAndLength_harness.c b/test/cbmc/proofs/MQTT_GetIncomingPacketTypeAndLength/MQTT_GetIncomingPacketTypeAndLength_harness.c index a3bca1d49..5c4433fe8 100644 --- a/test/cbmc/proofs/MQTT_GetIncomingPacketTypeAndLength/MQTT_GetIncomingPacketTypeAndLength_harness.c +++ b/test/cbmc/proofs/MQTT_GetIncomingPacketTypeAndLength/MQTT_GetIncomingPacketTypeAndLength_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_GetPacketId/MQTT_GetPacketId_harness.c b/test/cbmc/proofs/MQTT_GetPacketId/MQTT_GetPacketId_harness.c index a696b4e3a..dfa8ffe83 100644 --- a/test/cbmc/proofs/MQTT_GetPacketId/MQTT_GetPacketId_harness.c +++ b/test/cbmc/proofs/MQTT_GetPacketId/MQTT_GetPacketId_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_GetSubAckStatusCodes/MQTT_GetSubAckStatusCodes_harness.c b/test/cbmc/proofs/MQTT_GetSubAckStatusCodes/MQTT_GetSubAckStatusCodes_harness.c index a4bcaf04e..3ee6db584 100644 --- a/test/cbmc/proofs/MQTT_GetSubAckStatusCodes/MQTT_GetSubAckStatusCodes_harness.c +++ b/test/cbmc/proofs/MQTT_GetSubAckStatusCodes/MQTT_GetSubAckStatusCodes_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Init/MQTT_Init_harness.c b/test/cbmc/proofs/MQTT_Init/MQTT_Init_harness.c index 70196a25c..46115418a 100644 --- a/test/cbmc/proofs/MQTT_Init/MQTT_Init_harness.c +++ b/test/cbmc/proofs/MQTT_Init/MQTT_Init_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_MatchTopic/MQTT_MatchTopic_harness.c b/test/cbmc/proofs/MQTT_MatchTopic/MQTT_MatchTopic_harness.c index 31160ca5c..106d95aaa 100644 --- a/test/cbmc/proofs/MQTT_MatchTopic/MQTT_MatchTopic_harness.c +++ b/test/cbmc/proofs/MQTT_MatchTopic/MQTT_MatchTopic_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Ping/MQTT_Ping_harness.c b/test/cbmc/proofs/MQTT_Ping/MQTT_Ping_harness.c index d29940dbc..a85c9a25e 100644 --- a/test/cbmc/proofs/MQTT_Ping/MQTT_Ping_harness.c +++ b/test/cbmc/proofs/MQTT_Ping/MQTT_Ping_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_ProcessLoop/MQTT_ProcessLoop_harness.c b/test/cbmc/proofs/MQTT_ProcessLoop/MQTT_ProcessLoop_harness.c index d9320e9e1..94c9ada4a 100644 --- a/test/cbmc/proofs/MQTT_ProcessLoop/MQTT_ProcessLoop_harness.c +++ b/test/cbmc/proofs/MQTT_ProcessLoop/MQTT_ProcessLoop_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Publish/MQTT_Publish_harness.c b/test/cbmc/proofs/MQTT_Publish/MQTT_Publish_harness.c index a86fd5105..cc48aac25 100644 --- a/test/cbmc/proofs/MQTT_Publish/MQTT_Publish_harness.c +++ b/test/cbmc/proofs/MQTT_Publish/MQTT_Publish_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_ReceiveLoop/MQTT_ReceiveLoop_harness.c b/test/cbmc/proofs/MQTT_ReceiveLoop/MQTT_ReceiveLoop_harness.c index d548b1d1f..ec11782f2 100644 --- a/test/cbmc/proofs/MQTT_ReceiveLoop/MQTT_ReceiveLoop_harness.c +++ b/test/cbmc/proofs/MQTT_ReceiveLoop/MQTT_ReceiveLoop_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializeAck/MQTT_SerializeAck_harness.c b/test/cbmc/proofs/MQTT_SerializeAck/MQTT_SerializeAck_harness.c index b439ac2de..1a618ad34 100644 --- a/test/cbmc/proofs/MQTT_SerializeAck/MQTT_SerializeAck_harness.c +++ b/test/cbmc/proofs/MQTT_SerializeAck/MQTT_SerializeAck_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializeConnect/MQTT_SerializeConnect_harness.c b/test/cbmc/proofs/MQTT_SerializeConnect/MQTT_SerializeConnect_harness.c index 888b3f2f6..15f74cb0b 100644 --- a/test/cbmc/proofs/MQTT_SerializeConnect/MQTT_SerializeConnect_harness.c +++ b/test/cbmc/proofs/MQTT_SerializeConnect/MQTT_SerializeConnect_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializeDisconnect/MQTT_SerializeDisconnect_harness.c b/test/cbmc/proofs/MQTT_SerializeDisconnect/MQTT_SerializeDisconnect_harness.c index a337e6b4e..e3255a92a 100644 --- a/test/cbmc/proofs/MQTT_SerializeDisconnect/MQTT_SerializeDisconnect_harness.c +++ b/test/cbmc/proofs/MQTT_SerializeDisconnect/MQTT_SerializeDisconnect_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializePingreq/MQTT_SerializePingreq_harness.c b/test/cbmc/proofs/MQTT_SerializePingreq/MQTT_SerializePingreq_harness.c index 69faf5119..12c2afea2 100644 --- a/test/cbmc/proofs/MQTT_SerializePingreq/MQTT_SerializePingreq_harness.c +++ b/test/cbmc/proofs/MQTT_SerializePingreq/MQTT_SerializePingreq_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializePublish/MQTT_SerializePublish_harness.c b/test/cbmc/proofs/MQTT_SerializePublish/MQTT_SerializePublish_harness.c index 37fee4316..1acafaae7 100644 --- a/test/cbmc/proofs/MQTT_SerializePublish/MQTT_SerializePublish_harness.c +++ b/test/cbmc/proofs/MQTT_SerializePublish/MQTT_SerializePublish_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializePublishHeader/MQTT_SerializePublishHeader_harness.c b/test/cbmc/proofs/MQTT_SerializePublishHeader/MQTT_SerializePublishHeader_harness.c index 07bde4cf2..9a74e9626 100644 --- a/test/cbmc/proofs/MQTT_SerializePublishHeader/MQTT_SerializePublishHeader_harness.c +++ b/test/cbmc/proofs/MQTT_SerializePublishHeader/MQTT_SerializePublishHeader_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializeSubscribe/MQTT_SerializeSubscribe_harness.c b/test/cbmc/proofs/MQTT_SerializeSubscribe/MQTT_SerializeSubscribe_harness.c index 5e5bf4854..19267433d 100644 --- a/test/cbmc/proofs/MQTT_SerializeSubscribe/MQTT_SerializeSubscribe_harness.c +++ b/test/cbmc/proofs/MQTT_SerializeSubscribe/MQTT_SerializeSubscribe_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_SerializeUnsubscribe/MQTT_SerializeUnsubscribe_harness.c b/test/cbmc/proofs/MQTT_SerializeUnsubscribe/MQTT_SerializeUnsubscribe_harness.c index a636ad5b7..39980e551 100644 --- a/test/cbmc/proofs/MQTT_SerializeUnsubscribe/MQTT_SerializeUnsubscribe_harness.c +++ b/test/cbmc/proofs/MQTT_SerializeUnsubscribe/MQTT_SerializeUnsubscribe_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Subscribe/MQTT_Subscribe_harness.c b/test/cbmc/proofs/MQTT_Subscribe/MQTT_Subscribe_harness.c index 866202856..abcc2be14 100644 --- a/test/cbmc/proofs/MQTT_Subscribe/MQTT_Subscribe_harness.c +++ b/test/cbmc/proofs/MQTT_Subscribe/MQTT_Subscribe_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/proofs/MQTT_Unsubscribe/MQTT_Unsubscribe_harness.c b/test/cbmc/proofs/MQTT_Unsubscribe/MQTT_Unsubscribe_harness.c index 598a37a15..9f020b9a5 100644 --- a/test/cbmc/proofs/MQTT_Unsubscribe/MQTT_Unsubscribe_harness.c +++ b/test/cbmc/proofs/MQTT_Unsubscribe/MQTT_Unsubscribe_harness.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/sources/mqtt_cbmc_state.c b/test/cbmc/sources/mqtt_cbmc_state.c index abdced7ff..5022642f8 100644 --- a/test/cbmc/sources/mqtt_cbmc_state.c +++ b/test/cbmc/sources/mqtt_cbmc_state.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/stubs/event_callback_stub.c b/test/cbmc/stubs/event_callback_stub.c index bcb586f88..1f29b3fbd 100644 --- a/test/cbmc/stubs/event_callback_stub.c +++ b/test/cbmc/stubs/event_callback_stub.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/stubs/get_time_stub.c b/test/cbmc/stubs/get_time_stub.c index 700375720..6dd0a8835 100644 --- a/test/cbmc/stubs/get_time_stub.c +++ b/test/cbmc/stubs/get_time_stub.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/stubs/memmove.c b/test/cbmc/stubs/memmove.c index 70c78683a..436842b04 100644 --- a/test/cbmc/stubs/memmove.c +++ b/test/cbmc/stubs/memmove.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/cbmc/stubs/network_interface_stubs.c b/test/cbmc/stubs/network_interface_stubs.c index 69c5764a2..826bb9e64 100644 --- a/test/cbmc/stubs/network_interface_stubs.c +++ b/test/cbmc/stubs/network_interface_stubs.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/cmock_opaque_types.h b/test/unit-test/cmock_opaque_types.h index 04e2fbc76..d29ef7b9b 100644 --- a/test/unit-test/cmock_opaque_types.h +++ b/test/unit-test/cmock_opaque_types.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/core_mqtt_config.h b/test/unit-test/core_mqtt_config.h index f39b7679b..24b577f57 100644 --- a/test/unit-test/core_mqtt_config.h +++ b/test/unit-test/core_mqtt_config.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/core_mqtt_serializer_utest.c b/test/unit-test/core_mqtt_serializer_utest.c index 305306c5d..e91aae72a 100644 --- a/test/unit-test/core_mqtt_serializer_utest.c +++ b/test/unit-test/core_mqtt_serializer_utest.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/core_mqtt_state_utest.c b/test/unit-test/core_mqtt_state_utest.c index 2d6655b1b..fd04d1523 100644 --- a/test/unit-test/core_mqtt_state_utest.c +++ b/test/unit-test/core_mqtt_state_utest.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/core_mqtt_utest.c b/test/unit-test/core_mqtt_utest.c index 5a382ec3a..df88964af 100644 --- a/test/unit-test/core_mqtt_utest.c +++ b/test/unit-test/core_mqtt_utest.c @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/logging/logging_levels.h b/test/unit-test/logging/logging_levels.h index b01bccfec..ea6f8dbfd 100644 --- a/test/unit-test/logging/logging_levels.h +++ b/test/unit-test/logging/logging_levels.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT diff --git a/test/unit-test/logging/logging_stack.h b/test/unit-test/logging/logging_stack.h index 813010c75..2fd7d2460 100644 --- a/test/unit-test/logging/logging_stack.h +++ b/test/unit-test/logging/logging_stack.h @@ -1,5 +1,5 @@ /* - * coreMQTT v2.3.0 + * coreMQTT * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * SPDX-License-Identifier: MIT From 86ef75a1a6c32afbfd78526a7672fc8d79e157b3 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:26:52 +0800 Subject: [PATCH 05/22] Fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c4746dd9..64ac05306 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,7 +84,7 @@ jobs: - name : Update version number in manifest.yml run: | - sed -i -b '0,/^versoin/s/^version.*/version: "${{ github.event.inputs.version_number }}"/g' ./manifest.yml + sed -i -b '0,/^version/s/^version.*/version: "${{ github.event.inputs.version_number }}"/g' ./manifest.yml git add . git commit -m '[AUTO][RELEASE]: Update version number in manifest.yml' git push -u origin ${{ github.event.inputs.version_number }} From 9bffcf269a30c2ad5792b1b5642956c24f6eef8e Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:32:08 +0800 Subject: [PATCH 06/22] Fix format --- source/include/core_mqtt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/include/core_mqtt.h b/source/include/core_mqtt.h index b8ce19968..ab8bfbb65 100644 --- a/source/include/core_mqtt.h +++ b/source/include/core_mqtt.h @@ -44,7 +44,7 @@ /** * @cond DOXYGEN_IGNORE * The current version of this library. - * + * * If MQTT_LIBRARY_VERSION ends with + it represents the version in development * after the numbered release. */ From 9f01c93d4399699b87ee2d467eab5a6ef049ff16 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:42:11 +0800 Subject: [PATCH 07/22] Use defalt variable github.repository --- .github/workflows/release.yml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64ac05306..2027b10bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,11 +15,9 @@ on: required: false env: - repository_name: coreMQTT source_folder_list: "source test" - mqtt_version_macro_file: source/include/core_mqtt.h - repository_compressed_name: coreMQTT-${{ github.event.inputs.version_number }} - repository_zip_name: coreMQTT-${{ github.event.inputs.version_number }}.zip + repository_compressed_name: ${{ github.repository }}-${{ github.event.inputs.version_number }} + repository_zip_name: ${{ github.repository }}-${{ github.event.inputs.version_number }}.zip jobs: clean-existing-tag-and-release: @@ -72,12 +70,12 @@ jobs: - name: create a new branch that references commit id run: git checkout -b ${{ github.event.inputs.version_number }} ${{ github.event.inputs.commit_id }} - - name: Update version number in source file + - name: Update version number in source files run: | echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c \ 'find $1 -type f \( -name "*.c" -o -name "*.h" \) \ - -exec sed -i -b -E "0,/^ \* ${{ env.repository_name }}/s/^ \* ${{ env.repository_name }}.*/ \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}/g" {} +' + -exec sed -i -b -E "0,/^ \* ${{ github.repository }}/s/^ \* ${{ github.repository }}.*/ \* ${{ github.repository }} ${{ github.event.inputs.version_number }}/g" {} +' git add . git commit -m '[AUTO][RELEASE]: Update version number in source files' git push -u origin ${{ github.event.inputs.version_number }} @@ -93,13 +91,13 @@ jobs: run: | sed -i -b 's/PROJECT_NUMBER *=.*/PROJECT_NUMBER = ${{ github.event.inputs.version_number }}/g' ./docs/doxygen/config.doxyfile git add . - git commit -m '[AUTO][RELEASE]: Update version number in manifest.yml' + git commit -m '[AUTO][RELEASE]: Update version number in doxygen' git push -u origin ${{ github.event.inputs.version_number }} - name : Update MQTT version number macro - if: ${{ env.mqtt_version_macro_file }} + if: ${{ env.repository_name == "coreMQTT" }} run: | - sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' ${{ env.mqtt_version_macro_file }} + sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' source/include/core_mqtt.h git add . git commit -m '[AUTO][RELEASE]: Update version number macro in ${{ env.mqtt_version_macro_file }}' git push -u origin ${{ github.event.inputs.version_number }} @@ -118,7 +116,7 @@ jobs: - name: Tag Commit and Push to remote run: | - git tag ${{ github.event.inputs.version_number }} -a -m "${{ env.repository_name }} Library ${{ github.event.inputs.version_number }}" + git tag ${{ github.event.inputs.version_number }} -a -m "${{ github.repository }} Library ${{ github.event.inputs.version_number }}" git push origin --tags - name: Verify tag on remote @@ -141,17 +139,17 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.commit_id }} - path: ${{ env.repository_name }} + path: ${{ github.repository }} submodules: recursive - name: Checkout disabled submodules run: | - cd ${{ env.repository_name }} + cd ${{ github.repository }} git submodule update --init --checkout --recursive - name: Create ZIP run: | - zip -r ${{ env.repository_zip_name }} ${{ env.repository_name }} -x "*.git*" + zip -r ${{ env.repository_zip_name }} ${{ github.repository }} -x "*.git*" ls ./ - name: Validate created ZIP @@ -161,12 +159,12 @@ jobs: cd zip-check unzip ${{ env.repository_zip_name }} -d ${{ env.repository_compressed_name }} ls ${{ env.repository_compressed_name }} - diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ env.repository_name }}/ ../${{ env.repository_name }}/ + diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ github.repository }}/ ../${{ github.repository }}/ cd ../ - name: Build run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + cd zip-check/${{ env.repository_compressed_name }}/${{ github.repository }} sudo apt-get install -y lcov cmake -S test -B build/ \ -G "Unix Makefiles" \ @@ -177,7 +175,7 @@ jobs: - name: Test run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }}/build/ + cd zip-check/${{ env.repository_compressed_name }}/${{ github.repository }}/build/ ctest -E system --output-on-failure cd .. @@ -215,7 +213,7 @@ jobs: with: tag_name: ${{ github.event.inputs.version_number }} release_name: ${{ github.event.inputs.version_number }} - body: Release ${{ github.event.inputs.version_number }} of the ${{ env.repository_name }} Library. + body: Release ${{ github.event.inputs.version_number }} of the ${{ github.repository }} Library. draft: false prerelease: false From 83fc65356835f1538b3d0e7dbfecbd9abb88fb33 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:45:07 +0800 Subject: [PATCH 08/22] Fix old environment name --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2027b10bc..c74d7409a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -95,11 +95,11 @@ jobs: git push -u origin ${{ github.event.inputs.version_number }} - name : Update MQTT version number macro - if: ${{ env.repository_name == "coreMQTT" }} + if: ${{ github.repository == "coreMQTT" }} run: | sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' source/include/core_mqtt.h git add . - git commit -m '[AUTO][RELEASE]: Update version number macro in ${{ env.mqtt_version_macro_file }}' + git commit -m '[AUTO][RELEASE]: Update version number macro in source/include/core_mqtt.h' git push -u origin ${{ github.event.inputs.version_number }} - name: Generate SBOM From afbe869824302aeb924e0453c3170f8a7c175e67 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:47:10 +0800 Subject: [PATCH 09/22] Fix quotation mark --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c74d7409a..83a9a198a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -95,7 +95,7 @@ jobs: git push -u origin ${{ github.event.inputs.version_number }} - name : Update MQTT version number macro - if: ${{ github.repository == "coreMQTT" }} + if: ${{ github.repository == 'coreMQTT' }} run: | sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' source/include/core_mqtt.h git add . From 3f96d056c0ee2cf962b7f4de732579f6cfb80fd9 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 19:57:57 +0800 Subject: [PATCH 10/22] Revert back repository_name --- .github/workflows/release.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83a9a198a..badeb21b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,9 +15,11 @@ on: required: false env: + repository_name: "coreMQTT" + repository_compressed_name: coreMQTT-${{ github.event.inputs.version_number }} + repository_zip_name: coreMQTT-${{ github.event.inputs.version_number }}.zip + # Source folder list for version number updates source_folder_list: "source test" - repository_compressed_name: ${{ github.repository }}-${{ github.event.inputs.version_number }} - repository_zip_name: ${{ github.repository }}-${{ github.event.inputs.version_number }}.zip jobs: clean-existing-tag-and-release: @@ -75,7 +77,7 @@ jobs: echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c \ 'find $1 -type f \( -name "*.c" -o -name "*.h" \) \ - -exec sed -i -b -E "0,/^ \* ${{ github.repository }}/s/^ \* ${{ github.repository }}.*/ \* ${{ github.repository }} ${{ github.event.inputs.version_number }}/g" {} +' + -exec sed -i -b -E "0,/^ \* ${{ env.repository_name }}/s/^ \* ${{ env.repository_name }}.*/ \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}/g" {} +' git add . git commit -m '[AUTO][RELEASE]: Update version number in source files' git push -u origin ${{ github.event.inputs.version_number }} @@ -95,7 +97,7 @@ jobs: git push -u origin ${{ github.event.inputs.version_number }} - name : Update MQTT version number macro - if: ${{ github.repository == 'coreMQTT' }} + if: ${{ env.repository_name == 'coreMQTT' }} run: | sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' source/include/core_mqtt.h git add . @@ -116,7 +118,7 @@ jobs: - name: Tag Commit and Push to remote run: | - git tag ${{ github.event.inputs.version_number }} -a -m "${{ github.repository }} Library ${{ github.event.inputs.version_number }}" + git tag ${{ github.event.inputs.version_number }} -a -m "${{ env.repository_name }} Library ${{ github.event.inputs.version_number }}" git push origin --tags - name: Verify tag on remote @@ -139,17 +141,17 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.commit_id }} - path: ${{ github.repository }} + path: ${{ env.repository_name }} submodules: recursive - name: Checkout disabled submodules run: | - cd ${{ github.repository }} + cd ${{ env.repository_name }} git submodule update --init --checkout --recursive - name: Create ZIP run: | - zip -r ${{ env.repository_zip_name }} ${{ github.repository }} -x "*.git*" + zip -r ${{ env.repository_zip_name }} ${{ env.repository_name }} -x "*.git*" ls ./ - name: Validate created ZIP @@ -159,12 +161,12 @@ jobs: cd zip-check unzip ${{ env.repository_zip_name }} -d ${{ env.repository_compressed_name }} ls ${{ env.repository_compressed_name }} - diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ github.repository }}/ ../${{ github.repository }}/ + diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ env.repository_name }}/ ../${{ env.repository_name }}/ cd ../ - name: Build run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ github.repository }} + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} sudo apt-get install -y lcov cmake -S test -B build/ \ -G "Unix Makefiles" \ @@ -175,7 +177,7 @@ jobs: - name: Test run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ github.repository }}/build/ + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }}/build/ ctest -E system --output-on-failure cd .. @@ -213,7 +215,7 @@ jobs: with: tag_name: ${{ github.event.inputs.version_number }} release_name: ${{ github.event.inputs.version_number }} - body: Release ${{ github.event.inputs.version_number }} of the ${{ github.repository }} Library. + body: Release ${{ github.event.inputs.version_number }} of the ${{ env.repository_name }} Library. draft: false prerelease: false From 42ed2cbe72677463be8882ce8852e3e96bf3cd7a Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Wed, 10 Jul 2024 20:09:47 +0800 Subject: [PATCH 11/22] Zip the version_number tag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index badeb21b8..0a8168efd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -140,7 +140,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - ref: ${{ github.event.inputs.commit_id }} + ref: ${{ github.event.inputs.version_number }} path: ${{ env.repository_name }} submodules: recursive From afc69afdc7c2e24c41b8cb70c08a7c845761ccfe Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 11:17:56 +0800 Subject: [PATCH 12/22] Add check action --- .github/workflows/release.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a8168efd..6de4cef26 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -164,6 +164,40 @@ jobs: diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ env.repository_name }}/ ../${{ env.repository_name }}/ cd ../ + - name: Check version number in source files + run: | + echo "${{ env.source_folder_list }}" | \ + xargs -I{} find {} -type f \( -name "*.c" -o -name "*.h" \) | \ + xargs -I{} sh -c \ + 'grep -x " \* ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }}" {} && \ + echo {} : match ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }} || \ + { echo "{} : ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }' + + - name: Check version number in doxygen + run: | + # find "PROJECT_NUMBER = " and compare the with input version number + DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*v2.3.0" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); + [[ $DOXYGEN_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ + && echo "config.doxyfile : match ${{ github.event.inputs.version_number }}" \ + || { echo "config.doxyfile : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } + + - name: Check version number in manifest.yml + run: | + # find the first occurence of "version: " and comare the with input version number + MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:.*" manifest.yml | awk -F: '{gsub(" ","",$2); print $2 }' ); \ + [[ $MANIFEST_VESION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ + && echo "manifest.yml : match ${{ github.event.inputs.version_number }}" \ + || { echo "manifest.yml : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } + + - name: Check MQTT version number macro in header file + if: ${{ env.repository_name == 'coreMQTT' }} + run: | + # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h and compare the with input version number + MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\"${{ github.event.inputs.version_number }}\"" source/include/core_mqtt.h | awk '{ print $3 }'); \ + [[ $MACRO_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ + && echo "core_mqtt.h : match ${{ github.event.inputs.version_number }}" \ + || { echo "core_mqtt.h : $MACRO_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } + - name: Build run: | cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} From af0cf66d1646740d086a012aabb0d95f4afe225a Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 11:24:42 +0800 Subject: [PATCH 13/22] change working directory --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6de4cef26..2a65c4be0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -166,6 +166,8 @@ jobs: - name: Check version number in source files run: | + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + echo "${{ env.source_folder_list }}" | \ xargs -I{} find {} -type f \( -name "*.c" -o -name "*.h" \) | \ xargs -I{} sh -c \ @@ -175,6 +177,8 @@ jobs: - name: Check version number in doxygen run: | + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + # find "PROJECT_NUMBER = " and compare the with input version number DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*v2.3.0" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); [[ $DOXYGEN_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ @@ -183,6 +187,8 @@ jobs: - name: Check version number in manifest.yml run: | + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + # find the first occurence of "version: " and comare the with input version number MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:.*" manifest.yml | awk -F: '{gsub(" ","",$2); print $2 }' ); \ [[ $MANIFEST_VESION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ @@ -192,6 +198,8 @@ jobs: - name: Check MQTT version number macro in header file if: ${{ env.repository_name == 'coreMQTT' }} run: | + cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h and compare the with input version number MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\"${{ github.event.inputs.version_number }}\"" source/include/core_mqtt.h | awk '{ print $3 }'); \ [[ $MACRO_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ From b39e85f74832cc84aea378c3a16c7d8c06d1d86c Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 11:37:10 +0800 Subject: [PATCH 14/22] Update flow --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a65c4be0..b06cac839 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -180,18 +180,18 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find "PROJECT_NUMBER = " and compare the with input version number - DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*v2.3.0" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); + DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*${{ github.event.inputs.version_number }}" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); [[ $DOXYGEN_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ && echo "config.doxyfile : match ${{ github.event.inputs.version_number }}" \ - || { echo "config.doxyfile : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } + || { echo "config.doxyfile : $DOXYGEN_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } - name: Check version number in manifest.yml run: | cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find the first occurence of "version: " and comare the with input version number - MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:.*" manifest.yml | awk -F: '{gsub(" ","",$2); print $2 }' ); \ - [[ $MANIFEST_VESION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ + MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:.*" manifest.yml | awk -F: '{gsub(" ","",$2);{gsub("\"","",$2); print $2 }' ); \ + [[ $MANIFEST_VESION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "manifest.yml : match ${{ github.event.inputs.version_number }}" \ || { echo "manifest.yml : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } @@ -201,8 +201,8 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h and compare the with input version number - MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\"${{ github.event.inputs.version_number }}\"" source/include/core_mqtt.h | awk '{ print $3 }'); \ - [[ $MACRO_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ + MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\"${{ github.event.inputs.version_number }}\"" source/include/core_mqtt.h | awk '{gsub("\"","",$3); print $3 }'); \ + [[ $MACRO_VERSION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "core_mqtt.h : match ${{ github.event.inputs.version_number }}" \ || { echo "core_mqtt.h : $MACRO_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } From 9dbcab9644d818d78456f6615c45f06dd659faee Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 11:49:05 +0800 Subject: [PATCH 15/22] Fix check flow --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b06cac839..4e49797e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -180,8 +180,8 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find "PROJECT_NUMBER = " and compare the with input version number - DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*${{ github.event.inputs.version_number }}" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); - [[ $DOXYGEN_VERSION_NUMBER == "\"${{ github.event.inputs.version_number }}\"" ]] \ + DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*[^ ]*[ ]*" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); + [[ $DOXYGEN_VERSION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "config.doxyfile : match ${{ github.event.inputs.version_number }}" \ || { echo "config.doxyfile : $DOXYGEN_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } @@ -190,7 +190,7 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find the first occurence of "version: " and comare the with input version number - MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:.*" manifest.yml | awk -F: '{gsub(" ","",$2);{gsub("\"","",$2); print $2 }' ); \ + MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:[ ]*\".*\"[ ]*" manifest.yml | awk -F: '{gsub(" ","",$2);{gsub("\"","",$2); print $2 }' ); \ [[ $MANIFEST_VESION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "manifest.yml : match ${{ github.event.inputs.version_number }}" \ || { echo "manifest.yml : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } @@ -201,7 +201,7 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h and compare the with input version number - MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\"${{ github.event.inputs.version_number }}\"" source/include/core_mqtt.h | awk '{gsub("\"","",$3); print $3 }'); \ + MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\".*\"[ ]*" source/include/core_mqtt.h | awk '{gsub("\"","",$3); print $3 }'); \ [[ $MACRO_VERSION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "core_mqtt.h : match ${{ github.event.inputs.version_number }}" \ || { echo "core_mqtt.h : $MACRO_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } From a8de95bdb8fade60f5f948248baa58c7063c0c74 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 11:57:23 +0800 Subject: [PATCH 16/22] Fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e49797e6..6208dac7b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -190,7 +190,7 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} # find the first occurence of "version: " and comare the with input version number - MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:[ ]*\".*\"[ ]*" manifest.yml | awk -F: '{gsub(" ","",$2);{gsub("\"","",$2); print $2 }' ); \ + MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:[ ]*\".*\"[ ]*" manifest.yml | awk -F: '{ gsub(" ","",$2); gsub("\"","",$2); print $2 }' ); \ [[ $MANIFEST_VESION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "manifest.yml : match ${{ github.event.inputs.version_number }}" \ || { echo "manifest.yml : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } From 387ac5a1de2fdbd547058148a9f195309151c1e1 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 12:23:36 +0800 Subject: [PATCH 17/22] Update for check source files --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6208dac7b..fb7f5ec14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -169,7 +169,7 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} echo "${{ env.source_folder_list }}" | \ - xargs -I{} find {} -type f \( -name "*.c" -o -name "*.h" \) | \ + xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' | \ xargs -I{} sh -c \ 'grep -x " \* ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }}" {} && \ echo {} : match ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }} || \ From a28250a10404215e9a6a04175801cbe943a9885d Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 12:27:36 +0800 Subject: [PATCH 18/22] Fix version check in source files again --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb7f5ec14..fdd01eb3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -171,9 +171,9 @@ jobs: echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' | \ xargs -I{} sh -c \ - 'grep -x " \* ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }}" {} && \ - echo {} : match ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }} || \ - { echo "{} : ${{ env.repository_compressed_name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }' + 'grep -x " \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}" {} && \ + echo {} : match ${{ env.repository_name }} ${{ github.event.inputs.version_number }} || \ + { echo "{} : ${{ env.repository_name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }' - name: Check version number in doxygen run: | From 4d814df2c6757d0f1574a4756f1a8812d99a0492 Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 12:46:33 +0800 Subject: [PATCH 19/22] Fix check source file again --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fdd01eb3e..1fda349dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ env: repository_compressed_name: coreMQTT-${{ github.event.inputs.version_number }} repository_zip_name: coreMQTT-${{ github.event.inputs.version_number }}.zip # Source folder list for version number updates - source_folder_list: "source test" + source_folder_list: "source test/cbmc test/unit-test" jobs: clean-existing-tag-and-release: @@ -170,6 +170,7 @@ jobs: echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' | \ + xargs -I[] grep -l -x " * ${{ env.repository_name }}.*" {} | \ xargs -I{} sh -c \ 'grep -x " \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}" {} && \ echo {} : match ${{ env.repository_name }} ${{ github.event.inputs.version_number }} || \ From 0d462ac6955eacfbc8e498d33651de4f95fc3fdc Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 12:54:17 +0800 Subject: [PATCH 20/22] Update check source file header version again --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1fda349dc..8c0decfc1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -170,7 +170,7 @@ jobs: echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' | \ - xargs -I[] grep -l -x " * ${{ env.repository_name }}.*" {} | \ + xargs -I{} grep -l -x " \* ${{ env.repository_name }}.*" {} | \ xargs -I{} sh -c \ 'grep -x " \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}" {} && \ echo {} : match ${{ env.repository_name }} ${{ github.event.inputs.version_number }} || \ From 40336db323ddd1de194d69e55251a868e29181bb Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 14:48:51 +0800 Subject: [PATCH 21/22] Update default variable --- .github/workflows/release.yml | 45 +++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c0decfc1..5810f6ce4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,11 +15,10 @@ on: required: false env: - repository_name: "coreMQTT" - repository_compressed_name: coreMQTT-${{ github.event.inputs.version_number }} - repository_zip_name: coreMQTT-${{ github.event.inputs.version_number }}.zip + repository_compressed_name: ${{ github.event.repository.name }}-${{ github.event.inputs.version_number }} + repository_zip_name: ${{ github.event.repository.name }}-${{ github.event.inputs.version_number }}.zip # Source folder list for version number updates - source_folder_list: "source test/cbmc test/unit-test" + source_folder_list: "source test" jobs: clean-existing-tag-and-release: @@ -77,7 +76,7 @@ jobs: echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c \ 'find $1 -type f \( -name "*.c" -o -name "*.h" \) \ - -exec sed -i -b -E "0,/^ \* ${{ env.repository_name }}/s/^ \* ${{ env.repository_name }}.*/ \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}/g" {} +' + -exec sed -i -b -E "0,/^ \* ${{ github.event.repository.name }}/s/^ \* ${{ github.event.repository.name }}.*/ \* ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }}/g" {} +' git add . git commit -m '[AUTO][RELEASE]: Update version number in source files' git push -u origin ${{ github.event.inputs.version_number }} @@ -97,7 +96,7 @@ jobs: git push -u origin ${{ github.event.inputs.version_number }} - name : Update MQTT version number macro - if: ${{ env.repository_name == 'coreMQTT' }} + if: ${{ github.event.repository.name == 'coreMQTT' }} run: | sed -i -b 's/^\#define MQTT_LIBRARY_VERSION .*/\#define MQTT_LIBRARY_VERSION "${{ github.event.inputs.version_number }}"/g' source/include/core_mqtt.h git add . @@ -118,7 +117,7 @@ jobs: - name: Tag Commit and Push to remote run: | - git tag ${{ github.event.inputs.version_number }} -a -m "${{ env.repository_name }} Library ${{ github.event.inputs.version_number }}" + git tag ${{ github.event.inputs.version_number }} -a -m "${{ github.event.repository.name }} Library ${{ github.event.inputs.version_number }}" git push origin --tags - name: Verify tag on remote @@ -141,17 +140,17 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.version_number }} - path: ${{ env.repository_name }} + path: ${{ github.event.repository.name }} submodules: recursive - name: Checkout disabled submodules run: | - cd ${{ env.repository_name }} + cd ${{ github.event.repository.name }} git submodule update --init --checkout --recursive - name: Create ZIP run: | - zip -r ${{ env.repository_zip_name }} ${{ env.repository_name }} -x "*.git*" + zip -r ${{ env.repository_zip_name }} ${{ github.event.repository.name }} -x "*.git*" ls ./ - name: Validate created ZIP @@ -161,24 +160,24 @@ jobs: cd zip-check unzip ${{ env.repository_zip_name }} -d ${{ env.repository_compressed_name }} ls ${{ env.repository_compressed_name }} - diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ env.repository_name }}/ ../${{ env.repository_name }}/ + diff -r -x "*.git*" ${{ env.repository_compressed_name }}/${{ github.event.repository.name }}/ ../${{ github.event.repository.name }}/ cd ../ - name: Check version number in source files run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} echo "${{ env.source_folder_list }}" | \ xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' | \ - xargs -I{} grep -l -x " \* ${{ env.repository_name }}.*" {} | \ + xargs -I{} grep -l -x " \* ${{ github.event.repository.name }}.*" {} | \ xargs -I{} sh -c \ - 'grep -x " \* ${{ env.repository_name }} ${{ github.event.inputs.version_number }}" {} && \ - echo {} : match ${{ env.repository_name }} ${{ github.event.inputs.version_number }} || \ - { echo "{} : ${{ env.repository_name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }' + 'grep -x " \* ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }}" {} && \ + echo {} : match ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }} || \ + { echo "{} : ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }' - name: Check version number in doxygen run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} # find "PROJECT_NUMBER = " and compare the with input version number DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*[^ ]*[ ]*" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); @@ -188,7 +187,7 @@ jobs: - name: Check version number in manifest.yml run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} # find the first occurence of "version: " and comare the with input version number MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:[ ]*\".*\"[ ]*" manifest.yml | awk -F: '{ gsub(" ","",$2); gsub("\"","",$2); print $2 }' ); \ @@ -197,9 +196,9 @@ jobs: || { echo "manifest.yml : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } - name: Check MQTT version number macro in header file - if: ${{ env.repository_name == 'coreMQTT' }} + if: ${{ github.event.repository.name == 'coreMQTT' }} run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h and compare the with input version number MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\".*\"[ ]*" source/include/core_mqtt.h | awk '{gsub("\"","",$3); print $3 }'); \ @@ -209,7 +208,7 @@ jobs: - name: Build run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }} + cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} sudo apt-get install -y lcov cmake -S test -B build/ \ -G "Unix Makefiles" \ @@ -220,7 +219,7 @@ jobs: - name: Test run: | - cd zip-check/${{ env.repository_compressed_name }}/${{ env.repository_name }}/build/ + cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }}/build/ ctest -E system --output-on-failure cd .. @@ -258,7 +257,7 @@ jobs: with: tag_name: ${{ github.event.inputs.version_number }} release_name: ${{ github.event.inputs.version_number }} - body: Release ${{ github.event.inputs.version_number }} of the ${{ env.repository_name }} Library. + body: Release ${{ github.event.inputs.version_number }} of the ${{ github.event.repository.name }} Library. draft: false prerelease: false From 2d87ccdd0b2eb584d9278da2d70aaa250fa5429a Mon Sep 17 00:00:00 2001 From: "Ching-Hsin,Lee" Date: Thu, 11 Jul 2024 14:54:32 +0800 Subject: [PATCH 22/22] Update with more comment --- .github/workflows/release.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5810f6ce4..d11bd2566 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -167,10 +167,15 @@ jobs: run: | cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} - echo "${{ env.source_folder_list }}" | \ - xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' | \ - xargs -I{} grep -l -x " \* ${{ github.event.repository.name }}.*" {} | \ - xargs -I{} sh -c \ + # List all the *.h *.c files in + SOURCE_FILE_LIST=$( echo "${{ env.source_folder_list }}" | \ + xargs -n 1 sh -c 'find $1 -type f \( -name "*.c" -o -name "*.h" \)' ) + + # List all the files which contain " * .*" in SOURCE_FILE_LIST + SOURCE_FILE_WITH_VERSION_LIST=$( grep -l " \* ${{ github.event.repository.name }}.*" $SOURCE_FILE_LIST ) + + # Compare the with input version number in files in SOURCE_FILE_LIST + echo $SOURCE_FILE_WITH_VERSION_LIST | xargs -I{} sh -c \ 'grep -x " \* ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }}" {} && \ echo {} : match ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }} || \ { echo "{} : ${{ github.event.repository.name }} ${{ github.event.inputs.version_number }} not found"; exit 255; }' @@ -179,8 +184,10 @@ jobs: run: | cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} - # find "PROJECT_NUMBER = " and compare the with input version number + # find "PROJECT_NUMBER = " DOXYGEN_VERSION_NUMBER=$(grep -x "[ ]*PROJECT_NUMBER[ ]*=[ ]*[^ ]*[ ]*" docs/doxygen/config.doxyfile | awk -F= '{gsub(" ","",$2); print $2 }'); + + # compare the with input version number [[ $DOXYGEN_VERSION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "config.doxyfile : match ${{ github.event.inputs.version_number }}" \ || { echo "config.doxyfile : $DOXYGEN_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } @@ -190,7 +197,9 @@ jobs: cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} # find the first occurence of "version: " and comare the with input version number - MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:[ ]*\".*\"[ ]*" manifest.yml | awk -F: '{ gsub(" ","",$2); gsub("\"","",$2); print $2 }' ); \ + MANIFEST_VESION_NUMBER=$( grep -m 1 -E "^version:[ ]*\".*\"[ ]*" manifest.yml | awk -F: '{ gsub(" ","",$2); gsub("\"","",$2); print $2 }' ); + + # compare the with input version number [[ $MANIFEST_VESION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "manifest.yml : match ${{ github.event.inputs.version_number }}" \ || { echo "manifest.yml : $MANIFEST_VESION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; } @@ -200,8 +209,10 @@ jobs: run: | cd zip-check/${{ env.repository_compressed_name }}/${{ github.event.repository.name }} - # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h and compare the with input version number - MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\".*\"[ ]*" source/include/core_mqtt.h | awk '{gsub("\"","",$3); print $3 }'); \ + # find "#define MQTT_LIBRARY_VERSION " in core_mqtt.h + MACRO_VERSION_NUMBER=$(grep -x "^\#define[ ]*MQTT_LIBRARY_VERSION[ ]*\".*\"[ ]*" source/include/core_mqtt.h | awk '{gsub("\"","",$3); print $3 }'); + + # compare the with input version number [[ $MACRO_VERSION_NUMBER == "${{ github.event.inputs.version_number }}" ]] \ && echo "core_mqtt.h : match ${{ github.event.inputs.version_number }}" \ || { echo "core_mqtt.h : $MACRO_VERSION_NUMBER doesn't match ${{ github.event.inputs.version_number }}"; exit 255; }