From 2b4da53dc12f346115cd51fa3d550828dde57653 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:18:52 +0100 Subject: [PATCH 01/36] [ci] ci scripts reference [temp] --- ci_reference/example/build.yml | 89 +++++++++ .../actions/build_helper/action.yml | 139 ++++++++++++++ .../actions/get-commit-version/action.yml | 71 ++++++++ .../workflows/autotag.yml | 54 ++++++ .../hsm-github-workflows/workflows/build.yml | 169 ++++++++++++++++++ .../workflows/check-version.yml | 21 +++ .../workflows/release.yml | 74 ++++++++ .../hsm-github-workflows/workflows/test.yml | 59 ++++++ .../workflows/update-docs.yml | 17 ++ .../workflows/validate-metadata.yml | 41 +++++ .../hsm-github-workflows/workflows/verify.yml | 67 +++++++ 11 files changed, 801 insertions(+) create mode 100644 ci_reference/example/build.yml create mode 100644 ci_reference/hsm-github-workflows/actions/build_helper/action.yml create mode 100644 ci_reference/hsm-github-workflows/actions/get-commit-version/action.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/autotag.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/build.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/check-version.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/release.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/test.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/update-docs.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/validate-metadata.yml create mode 100644 ci_reference/hsm-github-workflows/workflows/verify.yml diff --git a/ci_reference/example/build.yml b/ci_reference/example/build.yml new file mode 100644 index 0000000..a7dc07e --- /dev/null +++ b/ci_reference/example/build.yml @@ -0,0 +1,89 @@ +name: "CI/CD for HSM IDE" + +on: + push: + branches: + - main + - dev + - "**" # allow other branches to trigger build+test + pull_request: + branches: + - main + - dev + +jobs: + # -------------------------------------------------------- + # VERIFY — only on main/dev (push or PR) + # -------------------------------------------------------- + verify: + if: > + github.ref_name == 'main' || + github.ref_name == 'dev' || + github.event_name == 'pull_request' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/verify.yml@main + + # -------------------------------------------------------- + # BUILD — always runs (even if verify is skipped) + # -------------------------------------------------------- + build: + needs: verify + uses: igor-krechetov/hsm-github-workflows/.github/workflows/build.yml@main + if: > + always() && + (needs.verify.result == 'success' || needs.verify.result == 'skipped') + with: + build_type: Release + platforms: "posix,windows" + build_qt: 'ON' + build_tests: 'ON' + + # -------------------------------------------------------- + # TEST — always runs after build + # -------------------------------------------------------- + test: + needs: build + uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@main + if: > + always() && (needs.build.result == 'success') + with: + test_script: "validate.sh" + + # -------------------------------------------------------- + # AUTOTAG — only on push to *dev* + # -------------------------------------------------------- + autotag: + needs: [test, verify] + if: github.event_name == 'push' && github.ref_name == 'dev' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/autotag.yml@main + with: + commit_version: ${{ needs.verify.outputs.commit_version }} + commit_action: ${{ needs.verify.outputs.commit_action }} + commit_sha: ${{ github.sha }} + + # -------------------------------------------------------- + # DOCS — only on push to *main* + # -------------------------------------------------------- + update_documentation: + needs: test + if: github.event_name == 'push' && github.ref_name == 'main' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@main + + # -------------------------------------------------------- + # RELEASE — only on push to main (after docs) + # -------------------------------------------------------- + release: + needs: [verify, update_documentation] + if: > + github.event_name == 'push' && + github.ref_name == 'main' && + needs.verify.outputs.commit_action == 'r' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/release.yml@main + with: + commit_sha: ${{ github.sha }} + tag_version: ${{ needs.update_documentation.outputs.tag_name }} + builds: "build-artifacts-ubuntu,build-artifacts-windows" + release_description: | + Release ${{ needs.update_documentation.outputs.tag_name }} + + - Built on Ubuntu and Windows + - Includes binaries for both platforms diff --git a/ci_reference/hsm-github-workflows/actions/build_helper/action.yml b/ci_reference/hsm-github-workflows/actions/build_helper/action.yml new file mode 100644 index 0000000..b850086 --- /dev/null +++ b/ci_reference/hsm-github-workflows/actions/build_helper/action.yml @@ -0,0 +1,139 @@ +name: "Build Helper" + +inputs: + # values: posix, windows + platform: + required: true + type: string + default: 'posix' + src_dir: + required: true + type: string + build_dir: + required: true + type: string + # values: Release, Debug + build_type: + required: false + type: string + default: 'Release' + build_glib: + required: false + type: string + default: 'OFF' + build_glibmm: + required: false + type: string + default: 'OFF' + build_qt: + required: false + type: string + default: 'OFF' + build_std: + required: false + type: string + default: 'ON' + build_tests: + required: false + type: string + default: 'OFF' + build_examples: + required: false + type: string + default: 'OFF' + codecoverage: + required: false + type: string + default: 'OFF' + only_configure: + required: false + type: boolean + default: false + cmake_args: + required: false + type: string + default: '' + +runs: + using: "composite" + + steps: + # --------------------------------- Ubuntu build --------------------------------- + - uses: awalsh128/cache-apt-pkgs-action@v1.6.0 + if: ${{ (inputs.platform == 'posix') && ((inputs.build_glib == 'ON') || (inputs.build_glibmm == 'ON')) }} + with: + packages: libglibmm-2.4-dev + version: 1.0 + + - name: Install Qt (Ubuntu) + if: ${{ (inputs.platform == 'posix') && (inputs.build_qt == 'ON') }} + uses: jurplel/install-qt-action@v4 + with: + version: '6.4.*' + host: 'linux' + target: 'desktop' + arch: 'gcc_64' + modules: '' + cache: 'true' + cache-key-prefix: 'install-qt-action-linux' + set-env: 'true' + + # -DHSMBUILD_VERBOSE=OFF \ + # -DHSMBUILD_PLATFORM=${{ inputs.platform }} \ + # -DHSMBUILD_DISPATCHER_GLIB=${{ inputs.build_glib }} \ + # -DHSMBUILD_DISPATCHER_GLIBMM=${{ inputs.build_glibmm }} \ + # -DHSMBUILD_DISPATCHER_STD=${{ inputs.build_std }} \ + # -DHSMBUILD_DISPATCHER_QT=${{ inputs.build_qt }} \ + # -DHSMBUILD_TESTS=${{ inputs.build_tests }} \ + # -DHSMBUILD_EXAMPLES=${{ inputs.build_examples }} \ + # -DHSMBUILD_CODECOVERAGE=${{ inputs.codecoverage }} \ + # -DHSMBUILD_DEBUGGING=ON \ + + - name: Configure CMake (Ubuntu) + if: ${{ inputs.platform == 'posix' }} + shell: bash + run: | + cmake -B ${{ inputs.build_dir }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + ${{ inputs.cmake_args }} \ + ${{ inputs.src_dir }} + + - name: Build (Ubuntu) + if: ${{ (inputs.platform == 'posix') && (inputs.only_configure == 'false') }} + shell: bash + run: cmake --build ${{ inputs.build_dir }} --parallel 2 --config ${{ inputs.build_type }} + + # --------------------------------- Windows build --------------------------------- + - name: Install Qt (Windows) + if: ${{ (inputs.platform == 'windows') && (inputs.build_qt == 'ON') }} + uses: jurplel/install-qt-action@v4 + with: + version: '6.4.*' + host: 'windows' + target: 'desktop' + arch: 'win64_msvc2019_64' + modules: '' + cache: 'true' + cache-key-prefix: 'install-qt-action-win32' + set-env: 'true' + + # -DHSMBUILD_VERBOSE=OFF ^ + # -DHSMBUILD_PLATFORM=${{ inputs.platform }} ^ + # -DHSMBUILD_DISPATCHER_GLIB=OFF ^ + # -DHSMBUILD_DISPATCHER_GLIBMM=OFF ^ + # -DHSMBUILD_DISPATCHER_STD=ON ^ + # -DHSMBUILD_DISPATCHER_QT=ON ^ + # -DHSMBUILD_TESTS=ON ^ + # -DHSMBUILD_EXAMPLES=ON ^ + # -DHSMBUILD_DEBUGGING=ON ^ + - name: Configure CMake (Windows) + if: ${{ inputs.platform == 'windows' }} + shell: cmd + run: cmake -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ^ + ${{ inputs.cmake_args }} ^ + ${{ inputs.src_dir }} + + - name: Build (Windows) + if: ${{ (inputs.platform == 'windows') && (inputs.only_configure == 'false') }} + shell: cmd + run: cmake --build ${{github.workspace}}\build --parallel 2 --config ${{ inputs.build_type }} \ No newline at end of file diff --git a/ci_reference/hsm-github-workflows/actions/get-commit-version/action.yml b/ci_reference/hsm-github-workflows/actions/get-commit-version/action.yml new file mode 100644 index 0000000..c115227 --- /dev/null +++ b/ci_reference/hsm-github-workflows/actions/get-commit-version/action.yml @@ -0,0 +1,71 @@ +name: Get commit version + +# TODO: implement commit description validation + +inputs: + repo_dir: + required: true + type: string + commit_sha: + required: false + type: string +outputs: + commit_version: + description: "Version extracted from commit (head if commit_sha was not provided or is empty)" + value: ${{ format('{0}{1}', steps.read_head_version.outputs.head_version, steps.read_commit_version.outputs.commit_version) }} + commit_tag: + description: "Tag extracted from commit (head if commit_sha was not provided or is empty)" + value: ${{ format('{0}{1}', steps.read_head_version.outputs.head_tag, steps.read_commit_version.outputs.commit_tag) }} + commit_action: + description: "Action extracted from commit (head if commit_sha was not provided or is empty). Currently: r - release" + value: ${{ format('{0}{1}', steps.read_head_version.outputs.head_action, steps.read_commit_version.outputs.commit_action) }} + +runs: + using: "composite" + + steps: + - id: read_head_version + shell: bash + if: ${{ inputs.commit_sha == '' }} + run: | + cd "${{ inputs.repo_dir }}" + + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + CHANGE_MSG="${{ github.event.pull_request.title }}" + CHANGE_TAGS="$CHANGE_MSG" + else + COMMIT_SHA="${{ github.sha }}" + CHANGE_MSG=$(git log -1 $COMMIT_SHA --pretty=format:"%s") + CHANGE_TAGS=$(git log -1 $COMMIT_SHA --pretty=format:"%d") + fi + + head_version=$(echo "$CHANGE_MSG" | grep -Po '\[\K([\d.]+)\]' | grep -Po '[^\]]+' || true) + head_action=$(echo "$CHANGE_MSG" | grep -Po '\[([\d.]+)\]\[\K[\w]+\]' | grep -Po '[^\]]+' || true) + head_tag=$(echo "$CHANGE_TAGS" | grep -Po 'tag: \K\d+\.\d+\.\d+' || true) + + # Output values + echo "head_version=$head_version" >> $GITHUB_OUTPUT + echo "head_tag=$head_tag" >> $GITHUB_OUTPUT + echo "head_action=$head_action" >> $GITHUB_OUTPUT + - if: ${{ inputs.commit_sha == '' }} + shell: bash + run: | + echo "VERSION: '${{ steps.read_head_version.outputs.head_version }}'" + echo "TAG: '${{ steps.read_head_version.outputs.head_tag }}'" + echo "ACTION: '${{ steps.read_head_version.outputs.head_action }}'" + + + - id: read_commit_version + shell: bash + if: ${{ inputs.commit_sha != '' }} + run: | + cd "${{ inputs.repo_dir }}" + echo "commit_version=$(git log -1 ${{ inputs.commit_sha }} --pretty=format:"%s" | grep -Po '\[\K([\d.]+)\]' | grep -Po '[^\]]+')" >> $GITHUB_OUTPUT + echo "commit_tag=$(git log -1 ${{ inputs.commit_sha }} --pretty=format:"%d" | grep -Po 'tag: \K\d+\.\d+\.\d+')" >> $GITHUB_OUTPUT + echo "commit_action=$(git log -1 ${{ inputs.commit_sha }} --pretty=format:"%s" | grep -Po '\[([\d.]+)\]\[\K[\w]+\]' | grep -Po '[^\]]+')" >> $GITHUB_OUTPUT + - if: ${{ inputs.commit_sha != '' }} + shell: bash + run: | + echo "VERSION: '${{ steps.read_commit_version.outputs.commit_version }}'" + echo "TAG: '${{ steps.read_commit_version.outputs.commit_tag }}'" + echo "ACTION: '${{ steps.read_commit_version.outputs.commit_action }}'" diff --git a/ci_reference/hsm-github-workflows/workflows/autotag.yml b/ci_reference/hsm-github-workflows/workflows/autotag.yml new file mode 100644 index 0000000..3400b3a --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/autotag.yml @@ -0,0 +1,54 @@ +name: "Auto Tagging (Reusable)" +on: + workflow_call: + inputs: + commit_sha: + required: true + type: string + commit_version: + required: true + type: string + commit_action: + required: true + type: string + +# Required Secrets +# - BOT_GPG_PRIVATE_KEY +# - BOT_GPG_PASSPHRASE + +jobs: + # check_version: + # uses: ./.github/workflows/check-version.yml + + create_release_tag: + # needs: check_version + if: > + github.ref_name == 'main' && + inputs.commit_version != '' && + inputs.commit_action == 'r' + + outputs: + tag_name: ${{ steps.create_tag.outputs.tag_name }} # reference step output + + name: "Create Tags" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} + git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true + workdir: ${{ github.workspace }} + - name: Create git tag + id: create_tag + run: | + TAG=${{ needs.check_version.outputs.commit_version }} + git tag $TAG ${{ inputs.commit_sha }} + git push origin $TAG + echo "tag_name=$TAG" >> $GITHUB_OUTPUT + diff --git a/ci_reference/hsm-github-workflows/workflows/build.yml b/ci_reference/hsm-github-workflows/workflows/build.yml new file mode 100644 index 0000000..1aac6eb --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/build.yml @@ -0,0 +1,169 @@ +name: "Build Ubuntu with Qt (Reusable)" +on: + workflow_call: + inputs: + platforms: + description: "Comma-separated list of platforms: windows,posix" + required: false + type: string + default: "posix" + src_dir: + required: false + type: string + build_dir: + required: false + type: string + # values: Release, Debug + build_type: + required: false + type: string + default: 'Release' + build_glib: + required: false + type: string + default: 'OFF' + build_glibmm: + required: false + type: string + default: 'OFF' + build_qt: + required: false + type: string + default: 'OFF' + build_std: + required: false + type: string + default: 'ON' + build_tests: + required: false + type: string + default: 'OFF' + build_examples: + required: false + type: string + default: 'OFF' + codecoverage: + required: false + type: string + default: 'OFF' + cmake_args: + required: false + type: string + default: '' +jobs: + # -------------------------------------------------------- + # 1) COMMON JOB — Parse "platforms" + # -------------------------------------------------------- + prepare_args: + name: "Parse Build Arguments" + runs-on: ubuntu-latest + outputs: + platforms_json: ${{ steps.parse.outputs.platforms_json }} + build_dir: ${{ steps.resolve_build_dir.outputs.dir }} + src_dir: ${{ steps.resolve_src_dir.outputs.dir }} + steps: + - name: Parse platforms input + id: parse + run: | + platforms="${{ inputs.platforms }}" + + # Convert comma-separated string → JSON list + json="[$(printf '"%s",' ${platforms//,/ })]" + json="${json%,}" # trim last comma + json="${json}]" + + echo "Parsed platforms: $json" + echo "platforms_json=$json" >> $GITHUB_OUTPUT + + - name: Resolve build directory + id: resolve_build_dir + run: | + echo "dir=${{ inputs.build_dir || format('{0}/build', github.workspace) }}" >> $GITHUB_OUTPUT + + - name: Resolve src directory + id: resolve_src_dir + run: | + echo "dir=${{ inputs.src_dir || github.workspace }}" >> $GITHUB_OUTPUT + + # # -------------------------------------------------------- + # # 2) CHECK VERSION — Always runs + # # -------------------------------------------------------- + # check_version: + # uses: ./.github/workflows/check-version.yml +# + # # -------------------------------------------------------- + # # 3) VALIDATE METADATA — Always runs (change if needed) + # # -------------------------------------------------------- + # validate_metadata: + # needs: check_version + # uses: ./.github/workflows/validate-metadata.yml + # with: + # commit_version: ${{ needs.check_version.outputs.commit_version }} + + # -------------------------------------------------------- + # 4) BUILD UBUNTU — Only runs if "posix" enabled + # -------------------------------------------------------- + build_project_ubuntu: + name: "Ubuntu" + needs: prepare_args + if: contains(needs.prepare_args.outputs.platforms_json, 'posix') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Build project (Ubuntu) + uses: igor-krechetov/hsm-github-workflows/.github/actions/build_helper@main + with: + platform: 'posix' + build_type: ${{ inputs.build_type }} + src_dir: ${{ needs.prepare_args.outputs.src_dir }} + build_dir: ${{ needs.prepare_args.outputs.build_dir }} + build_glib: ${{ inputs.build_glib }} + build_glibmm: ${{ inputs.build_glibmm }} + build_qt: ${{ inputs.build_qt }} + build_std: ${{ inputs.build_std }} + build_tests: ${{ inputs.build_tests }} + build_examples: ${{ inputs.build_examples }} + codecoverage: ${{ inputs.codecoverage }} + cmake_args: ${{ inputs.cmake_args }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts-ubuntu + path: ${{ needs.prepare_args.outputs.build_dir }} + + # -------------------------------------------------------- + # 5) BUILD WIDNOWS — Only runs if "windows" enabled + # -------------------------------------------------------- + build_project_windows: + name: "Windows" + needs: prepare_args + if: contains(needs.prepare_args.outputs.platforms_json, 'windows') + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Build project (Windows) + uses: igor-krechetov/hsm-github-workflows/.github/actions/build_helper@main + with: + platform: 'windows' + build_type: ${{ inputs.build_type }} + src_dir: ${{ needs.prepare_args.outputs.src_dir }} + build_dir: ${{ needs.prepare_args.outputs.build_dir }} + build_glib: ${{ inputs.build_glib }} + build_glibmm: ${{ inputs.build_glibmm }} + build_qt: ${{ inputs.build_qt }} + build_std: ${{ inputs.build_std }} + build_tests: ${{ inputs.build_tests }} + build_examples: ${{ inputs.build_examples }} + codecoverage: ${{ inputs.codecoverage }} + cmake_args: ${{ inputs.cmake_args }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts-windows + path: ${{ needs.prepare_args.outputs.build_dir }} diff --git a/ci_reference/hsm-github-workflows/workflows/check-version.yml b/ci_reference/hsm-github-workflows/workflows/check-version.yml new file mode 100644 index 0000000..13b4cd0 --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/check-version.yml @@ -0,0 +1,21 @@ +name: "Check Version (Reusable)" +on: + workflow_call: + outputs: + commit_version: + description: "Commit version" + value: ${{ jobs.check_version.outputs.commit_version }} + +jobs: + check_version: + name: "Extract Version" + runs-on: ubuntu-latest + outputs: + commit_version: ${{ steps.get_version.outputs.commit_version }} + steps: + - uses: actions/checkout@v3 + - uses: igor-krechetov/hsm-github-workflows/.github/actions/get-commit-version@main + id: get_version + with: + repo_dir: ${{ env.GITHUB_WORKSPACE }} + commit_sha: ${{ github.event.workflow_run.head_sha }} diff --git a/ci_reference/hsm-github-workflows/workflows/release.yml b/ci_reference/hsm-github-workflows/workflows/release.yml new file mode 100644 index 0000000..879a396 --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/release.yml @@ -0,0 +1,74 @@ +name: "Release Binaries (Reusable)" + +on: + workflow_call: + inputs: + commit_sha: + required: true + type: string + tag_version: + required: false + type: string + builds: + description: "Comma-separated list of artifact names to release" + required: true + type: string + release_description: + description: "Release notes / description (multiline allowed)" + required: false + type: string + repo_dir: + required: false + type: string + default: ${{ github.workspace }} + +# Secrets: +# - GITHUB_TOKEN + +jobs: + release: + runs-on: ubuntu-latest + steps: + + # Checkout the repo (needed if scripts rely on repo content) + - uses: actions/checkout@v4 + + # Determine release tag + - name: Determine release tag + id: tag + run: | + if [ -z "${{ inputs.tag_version }}" ]; then + TAG="v$(date +'%Y%m%d-%H%M%S')" + else + TAG="${{ inputs.tag_version }}" + fi + echo "tag=$TAG" >> $GITHUB_OUTPUT + + # Create GitHub release + - name: Create release + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.tag.outputs.tag }} + name: ${{ steps.tag.outputs.tag }} + body: ${{ inputs.release_description }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Upload all artifacts from the builds list + - name: Upload artifacts + run: | + IFS=',' read -ra ARTIFACT_NAMES <<< "${{ inputs.builds }}" + for ARTIFACT in "${ARTIFACT_NAMES[@]}"; do + echo "Downloading artifact: $ARTIFACT" + # Download artifact from the same workflow run + gh run download --name "$ARTIFACT" --dir ./tmp + + # Assuming each artifact contains a single archive file + FILE=$(ls ./tmp) + echo "Uploading $FILE to release ${{ steps.tag.outputs.tag }}" + gh release upload "${{ steps.tag.outputs.tag }}" ./tmp/"$FILE" --clobber --repo ${{ github.repository }} + rm -rf ./tmp + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/ci_reference/hsm-github-workflows/workflows/test.yml b/ci_reference/hsm-github-workflows/workflows/test.yml new file mode 100644 index 0000000..8a92bfb --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/test.yml @@ -0,0 +1,59 @@ +name: "Run Tests (Reusable)" +on: + workflow_call: + inputs: + test_script: + description: "Path to the shell script that runs unit tests" + required: true + type: string + artifact_name: + description: "Name of build artifact produced by build.yml" + required: false + type: string + default: "build-artifacts-ubuntu" + artifacts_dir: + description: "Directory where build artifacts will be downloaded" + required: false + type: string + default: "build" + +jobs: + unit_tests_ubuntu: + name: "Unit Tests (Ubuntu)" + runs-on: ubuntu-latest + steps: + - name: Install Qt (Ubuntu) + uses: jurplel/install-qt-action@v4 + with: + version: '6.4.*' + host: 'linux' + target: 'desktop' + arch: 'gcc_64' + modules: '' + cache: 'true' + cache-key-prefix: 'install-qt-action-linux' + set-env: 'true' + + - uses: actions/checkout@v3 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact_name }} + path: ${{ inputs.artifacts_dir }} + + - name: Run unit tests + shell: bash + run: | + repo_root="${{ github.workspace }}" + script_path="${{ github.workspace }}/${{ inputs.test_script }}" + + if [[ ! -f "$script_path" ]]; then + echo "Test script not found: $script_path" + exit 1 + fi + + chmod +x "$script_path" + + cd "${{ inputs.artifacts_dir }}" + "$script_path" "$repo_root" diff --git a/ci_reference/hsm-github-workflows/workflows/update-docs.yml b/ci_reference/hsm-github-workflows/workflows/update-docs.yml new file mode 100644 index 0000000..fc84e99 --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/update-docs.yml @@ -0,0 +1,17 @@ +name: "Update Documentation (Reusable)" +on: + workflow_call: + +jobs: + update_docs: + name: "Update Documentation" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # - name: Install Doxygen and PlantUML + # run: sudo apt-get update && sudo apt-get install -y doxygen plantuml + + - name: Generate docs + run: | + echo "GENERATE DOCUMENTATION" \ No newline at end of file diff --git a/ci_reference/hsm-github-workflows/workflows/validate-metadata.yml b/ci_reference/hsm-github-workflows/workflows/validate-metadata.yml new file mode 100644 index 0000000..cd45d74 --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/validate-metadata.yml @@ -0,0 +1,41 @@ +name: "Validate Metadata (Reusable)" +on: + workflow_call: + inputs: + commit_version: + required: true + type: string + +jobs: +# steps: +# - uses: actions/checkout@v3 +# - name: Validate metadata +# if: ${{ (inputs.commit_version != '') }} +# run: ./scripts/validate_metadata.py ${{ inputs.commit_version }} ./ + + validate_metadata: + name: "Verify Commit" + runs-on: ubuntu-latest + steps: + # 1️⃣ Checkout the target project + - name: Checkout caller repository + uses: actions/checkout@v3 + with: + repository: ${{ github.repository }} + ref: ${{ github.sha }} + path: repoProject + fetch-depth: 0 # important to have full git history if needed + + # 2️⃣ Checkout reusable workflow repo + - name: Checkout scripts repository + uses: actions/checkout@v3 + with: + repository: igor-krechetov/hsm-github-workflows + path: repoWorkflows + fetch-depth: 0 + + # 3️⃣ Run the Python script from Repo A, pointing to Repo B + - name: Validate metadata + if: ${{ inputs.commit_version != '' }} + run: | + python3 ./repoWorkflows/scripts/validate_metadata.py ${{ inputs.commit_version }} ./repoProject/ diff --git a/ci_reference/hsm-github-workflows/workflows/verify.yml b/ci_reference/hsm-github-workflows/workflows/verify.yml new file mode 100644 index 0000000..c5f276b --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/verify.yml @@ -0,0 +1,67 @@ +name: "Validate commit (Reusable)" + +on: + workflow_call: + outputs: + commit_version: + value: ${{ jobs.check_version.outputs.commit_version }} + commit_action: + value: ${{ jobs.check_version.outputs.commit_action }} + +jobs: + # -------------------------------------------------------- + # 1) CHECK VERSION + # -------------------------------------------------------- + check_version: + # uses: ./.github/workflows/check-version.yml + name: "Extract Version" + runs-on: ubuntu-latest + outputs: + commit_version: ${{ steps.get_version.outputs.commit_version }} + commit_action: ${{ steps.get_version.outputs.commit_action }} + steps: + - uses: actions/checkout@v3 + - uses: igor-krechetov/hsm-github-workflows/.github/actions/get-commit-version@main + id: get_version + with: + repo_dir: ${{ env.GITHUB_WORKSPACE }} + commit_sha: ${{ github.event.workflow_run.head_sha }} + + # -------------------------------------------------------- + # 2) VALIDATE METADATA + # -------------------------------------------------------- + verify_metadata: + name: "Verify Commit" + needs: check_version + # Skip metadata checks if no version change was defined + if: needs.check_version.outputs.commit_version != '' + + runs-on: ubuntu-latest + steps: + # Checkout the target project + - name: Checkout caller repository + uses: actions/checkout@v3 + with: + repository: ${{ github.repository }} + ref: ${{ github.sha }} + path: repoProject + fetch-depth: 0 # important to have full git history if needed + + # Checkout reusable workflow repo + - name: Checkout scripts repository + uses: actions/checkout@v3 + with: + repository: igor-krechetov/hsm-github-workflows + path: repoWorkflows + fetch-depth: 0 + + - name: Validate metadata + if: ${{ needs.check_version.outputs.commit_version != '' }} + run: | + python3 ./repoWorkflows/scripts/validate_metadata.py ${{ needs.check_version.outputs.commit_version }} ./repoProject/ + + - name: Fail if version is missing + if: ${{ needs.check_version.outputs.commit_version == '' }} + run: | + echo "Missing commit_version!" + exit 1 \ No newline at end of file From 6bb3665e240ad44eb3988e4b8b98a60dd53a327f Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Sun, 29 Mar 2026 19:08:25 +0100 Subject: [PATCH 02/36] Refine CI migration per review feedback --- .github/workflows/build.yml | 239 +++++------------- .github/workflows/deploy-arduinoide.yml | 90 ++----- .github/workflows/deploy-platformio.yml | 111 ++------ .../hsm-github-workflows/workflows/build.yml | 143 ++++++++--- .../hsm-github-workflows/workflows/deploy.yml | 121 +++++++++ 5 files changed, 326 insertions(+), 378 deletions(-) create mode 100644 ci_reference/hsm-github-workflows/workflows/deploy.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1687440..0404b24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,186 +7,61 @@ on: pull_request: branches: [ main, dev ] -env: - BUILD_TYPE: Release - jobs: - # check if it's a version update - check-hsmcpp-version: - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.get_version.outputs.commit_version }} - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - - # validate that all metadata was updated correctly - validate-metadata: - needs: check-hsmcpp-version - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && (needs.check-hsmcpp-version.outputs.commit_version != '') }} - run: ./scripts/validate_metadata.py ${{ needs.check-hsmcpp-version.outputs.commit_version }} ./ - - # ----------------------------------------------------------------- - build-ubuntu: - needs: validate-metadata - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Build project - uses: ./.github/workflows/build_helper - with: - build_type: ${{env.BUILD_TYPE}} - src_dir: ${{github.workspace}} - build_dir: ${{github.workspace}}/build - platform: 'posix' - - # ----------------------------------------------------------------- - build-windows: - needs: validate-metadata - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Build project - uses: ./.github/workflows/build_helper - with: - build_type: ${{env.BUILD_TYPE}} - src_dir: ${{github.workspace}} - build_dir: ${{github.workspace}}/build - platform: 'windows' - - # ----------------------------------------------------------------- - build-platformio: - needs: validate-metadata - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - uses: ./.github/workflows/install_platformio - - # deploy files - - name: Generate package - run: | - cmake -S ./ -B ./build -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino - cmake --build ./build --target install - - - name: Copy package to examples folder - run: | - mkdir -p ./examples/09_arduino/01_blink/lib/hsmcpp - cp -Rv ./build/deploy/platformio/* ./examples/09_arduino/01_blink/lib/hsmcpp - mkdir -p ./examples/09_arduino/02_blink_button/lib/hsmcpp - cp -Rv ./build/deploy/platformio/* ./examples/09_arduino/02_blink_button/lib/hsmcpp - - # build examples - - name: Build 01_blink - run: | - cd ./examples/09_arduino/01_blink/ - pio run - - - name: Build 02_blink_button - run: | - cd ./examples/09_arduino/02_blink_button/ - pio run - - # ----------------------------------------------------------------- - build-arduinoide: - needs: validate-metadata - runs-on: ubuntu-latest - - env: - library_dir: ./build/deploy/arduinoide - example1_dir: ./build/deploy/arduinoide/examples/01_blink - example2_dir: ./build/deploy/arduinoide/examples/02_blink_button - scxml2gen_dir: ./build/deploy/arduinoide/tools/scxml2gen - hsmcpp_library: ./build/deploy/hsmcpp.zip - - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - name: Generate hsmcpp library package - run: | - cmake -S ./ -B ./build -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino - cmake --build ./build --target install - cp -Rv ${{ env.library_dir }} ./build/deploy/hsmcpp - cd ./build/deploy/ - zip -r ./hsmcpp.zip ./hsmcpp - - - name: Generate HSM files - run: | - python3 ${{ env.scxml2gen_dir }}/scxml2gen.py -code -scxml ${{ env.example1_dir }}/blink.scxml \ - -class_name BlinkHsm \ - -class_suffix Base \ - -template_hpp ${{ env.scxml2gen_dir }}/template.hpp \ - -template_cpp ${{ env.scxml2gen_dir }}/template.cpp \ - -dest_dir ${{ env.example1_dir }}/ - python3 ${{ env.scxml2gen_dir }}/scxml2gen.py -code -scxml ${{ env.example2_dir }}/blink_button.scxml \ - -class_name BlinkButtonHsm \ - -class_suffix Base \ - -template_hpp ${{ env.scxml2gen_dir }}/template.hpp \ - -template_cpp ${{ env.scxml2gen_dir }}/template.cpp \ - -dest_dir ${{ env.example2_dir }}/ - - - name: Setup Arduino CLI - uses: arduino/setup-arduino-cli@v1.1.1 - - - name: Install platform files - run: | - arduino-cli core update-index --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json - arduino-cli core install esp8266:esp8266 --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json - - - name: Install hsmcpp library - run: | - arduino-cli config init - arduino-cli config set library.enable_unsafe_install true - arduino-cli lib install --zip-path ${{ env.hsmcpp_library }} - - - name: Compile Sketch 01 - run: arduino-cli compile --fqbn esp8266:esp8266:d1_mini ${{ env.example1_dir }}/ --warnings more - - - name: Compile Sketch 02 - run: arduino-cli compile --fqbn esp8266:esp8266:d1_mini ${{ env.example2_dir }}/ --warnings more - - # ----------------------------------------------------------------- - build-freertos: - needs: validate-metadata - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - path: './source' - submodules: 'recursive' - - - uses: actions/checkout@v3 - with: - repository: 'FreeRTOS/FreeRTOS' - ref: '202212.00' - submodules: 'recursive' - path: './FreeRTOS' - - # build FreeRTOS example - - name: Build 08_freertos - run: | - cd ./source/examples/08_freertos - ./build.sh '${{github.workspace}}/FreeRTOS' + verify: + if: > + github.ref_name == 'main' || + github.ref_name == 'dev' || + github.event_name == 'pull_request' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/verify.yml@main + + build: + needs: verify + uses: igor-krechetov/hsm-github-workflows/.github/workflows/build.yml@main + if: > + always() && + (needs.verify.result == 'success' || needs.verify.result == 'skipped') + with: + build_type: Release + platforms: "posix,windows,platformio,arduinoide,freertos" + build_qt: 'ON' + build_tests: 'ON' + + test: + needs: build + uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@main + if: > + always() && (needs.build.result == 'success') + with: + test_script: "validate.sh" + + autotag: + needs: [test, verify] + if: github.event_name == 'push' && github.ref_name == 'dev' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/autotag.yml@main + with: + commit_version: ${{ needs.verify.outputs.commit_version }} + commit_action: ${{ needs.verify.outputs.commit_action }} + commit_sha: ${{ github.sha }} + + update_documentation: + needs: test + if: github.event_name == 'push' && github.ref_name == 'main' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@main + + release: + needs: [verify, update_documentation] + if: > + github.event_name == 'push' && + github.ref_name == 'main' && + needs.verify.outputs.commit_action == 'r' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/release.yml@main + with: + commit_sha: ${{ github.sha }} + tag_version: ${{ needs.update_documentation.outputs.tag_name }} + builds: "build-artifacts-ubuntu,build-artifacts-windows" + release_description: | + Release ${{ needs.update_documentation.outputs.tag_name }} + + - Built on Ubuntu and Windows + - Includes binaries for both platforms diff --git a/.github/workflows/deploy-arduinoide.yml b/.github/workflows/deploy-arduinoide.yml index 017daf6..d5896d3 100644 --- a/.github/workflows/deploy-arduinoide.yml +++ b/.github/workflows/deploy-arduinoide.yml @@ -2,7 +2,6 @@ name: "Deploy ArduinoIDE library" on: workflow_dispatch: - # Start only after Build was finished workflow_run: workflows: [Build] branches: [main] @@ -10,89 +9,32 @@ on: jobs: check-hsmcpp-version: - # only run for successful build after push event - # avoid running this action on forks if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && ((github.event.workflow_run == null) || ((github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.event == 'push'))) }} - runs-on: ubuntu-latest outputs: commit_version: ${{ steps.get_version.outputs.commit_version }} commit_action: ${{ steps.get_version.outputs.commit_action }} - + commit_sha: ${{ steps.commit_sha.outputs.value }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/workflows/get-commit-version id: get_version with: repo_dir: ${{ env.GITHUB_WORKSPACE }} commit_sha: ${{ github.event.workflow_run.head_sha }} + - id: commit_sha + run: echo "value=${{ github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT" - deploy-arduinoide: + deploy: needs: check-hsmcpp-version - # only if commit has version defined and is a release commit - if: ${{ (needs.check-hsmcpp-version.outputs.commit_version != '') && (needs.check-hsmcpp-version.outputs.commit_action == 'r') }} - - runs-on: ubuntu-latest - - env: - target_dir: './arduinoide_deploy/' - library_dir: './main/build/deploy/hsmcpp' - - steps: - # need to checkout current repo because workflow is not related with push event - - uses: actions/checkout@v3 - - # checkout repositories - - uses: actions/checkout@v3 - with: - path: './main' - - uses: actions/checkout@v3 - with: - repository: 'igor-krechetov/hsmcpp-arduinoide' - token: ${{ secrets.HSMCPP_BOT_TOKEN }} - ref: main - path: ${{ env.target_dir }} - - # prepare gpg for commit signing - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} - git_config_global: true - git_user_signingkey: true - git_commit_gpgsign: true - workdir: ${{ env.target_dir }} - - # deploy files - - name: Generate hsmcpp package - run: | - cmake -S ./main -B ./main/build -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino - cmake --build ./main/build --target install - mv ./main/build/deploy/arduinoide ${{ env.library_dir }} - - - name: Install arduino-lint - run: | - curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh | BINDIR=./ sh - - - name: Validate arduino library structure - run: | - ./arduino-lint --compliance strict --recursive --library-manager update ${{ env.library_dir }} - - - name: Copy package files to target repository - run: cp -Rv ${{ env.library_dir }}/* "$target_dir" - - - name: Prepare commit message - run: | - cd ./main - git log -1 --format=%B ${{ github.event.workflow_run.head_sha }} > ../commit.txt - - - name: Publish ArduinoIDE package - run: | - cd "$target_dir" - git add -A - git commit -S -F ../commit.txt - git tag ${{needs.check-hsmcpp-version.outputs.commit_version}} - git push - git push --tags \ No newline at end of file + if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} + uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@main + with: + deploy_target: arduinoide + commit_sha: ${{ needs.check-hsmcpp-version.outputs.commit_sha }} + commit_version: ${{ needs.check-hsmcpp-version.outputs.commit_version }} + commit_action: ${{ needs.check-hsmcpp-version.outputs.commit_action }} + target_repo: igor-krechetov/hsmcpp-arduinoide + target_branch: main + publish_registry: false + secrets: inherit diff --git a/.github/workflows/deploy-platformio.yml b/.github/workflows/deploy-platformio.yml index f1f6f43..cacfb5d 100644 --- a/.github/workflows/deploy-platformio.yml +++ b/.github/workflows/deploy-platformio.yml @@ -5,7 +5,6 @@ on: inputs: version: type: string - # Start only after Build was finished workflow_run: workflows: [Build] branches: [main] @@ -13,105 +12,39 @@ on: jobs: check-hsmcpp-version: - # only run for successful build after push event - # avoid running this action on forks if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && ((github.event.workflow_run == null) || ((github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.event == 'push'))) }} - runs-on: ubuntu-latest outputs: commit_version: ${{ steps.finalize_version.outputs.commit_version }} commit_action: ${{ steps.get_version.outputs.commit_action }} - + commit_sha: ${{ steps.commit_sha.outputs.value }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ./.github/workflows/get-commit-version id: get_version with: repo_dir: ${{ env.GITHUB_WORKSPACE }} commit_sha: ${{ github.event.workflow_run.head_sha }} - - - name: Check user input - if: ${{ github.event.inputs.version != '' }}" - id: check_user_input - run: | - echo "TEMP_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV - - - name: Check commit version - id: check_commit - if: ${{ github.event.inputs.version == '' }} - run: | - echo "TEMP_VERSION=${{ steps.get_version.outputs.commit_version }}" >> $GITHUB_ENV - - - name: Final - id: finalize_version + - id: commit_sha + run: echo "value=${{ github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT" + - id: finalize_version run: | - echo "commit_version=$TEMP_VERSION" >> $GITHUB_OUTPUT + if [ -n "${{ github.event.inputs.version }}" ]; then + echo "commit_version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" + else + echo "commit_version=${{ steps.get_version.outputs.commit_version }}" >> "$GITHUB_OUTPUT" + fi - deploy-platformio: - runs-on: ubuntu-latest + deploy: needs: check-hsmcpp-version - - # only run for successful build after push event - # avoid running this action on forks - if: ${{ (needs.check-hsmcpp-version.outputs.commit_version != '') }} - - env: - target_dir: './platformio_deploy/' - - steps: - # need to checkout current repo because workflow is not related with push event - - uses: actions/checkout@v3 - - uses: ./.github/workflows/install_platformio - - # checkout repositories - - uses: actions/checkout@v3 - with: - ref: main - path: './main' - - uses: actions/checkout@v3 - with: - ref: platformio_library - path: ${{ env.target_dir }} - - # prepare gpg for commit signing - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} - git_config_global: true - git_user_signingkey: true - git_commit_gpgsign: true - workdir: ${{ env.target_dir }} - - # deploy files - - name: Generate package - run: | - cmake -S ./main -B ./main/build -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino - cmake --build ./main/build --target install - - - name: Copy package files to target repository - run: cp -Rv ./main/build/deploy/platformio/* "$target_dir" - - - name: Publish PlatformIO package - # only publish release versions or when started manually - if: ${{ (needs.check-hsmcpp-version.outputs.commit_action == 'r') || (github.event.inputs.version != '') }} - env: - PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_TOKEN }} - # $PWD is needed due to an issue in "pio pkg publish". It usese os.path.isdir() and sometimes it doesn't not - # recognize relative path as a directory - run: | - pio pkg publish --type library --no-interactive $PWD/main/build/deploy/platformio/ - - - name: Prepare commit message - run: | - cd ./main - git log -1 --format=%B ${{ github.event.workflow_run.head_sha }} > ../commit.txt - - - name: Commit new files - run: | - cd "$target_dir" - git add -A - git commit -S -F ../commit.txt - git push + uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@main + if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} + with: + deploy_target: platformio + commit_sha: ${{ needs.check-hsmcpp-version.outputs.commit_sha }} + commit_version: ${{ needs.check-hsmcpp-version.outputs.commit_version }} + commit_action: ${{ needs.check-hsmcpp-version.outputs.commit_action }} + target_repo: igor-krechetov/hsmcpp + target_branch: platformio_library + publish_registry: ${{ (needs.check-hsmcpp-version.outputs.commit_action == 'r') || (github.event.inputs.version != '') }} + secrets: inherit diff --git a/ci_reference/hsm-github-workflows/workflows/build.yml b/ci_reference/hsm-github-workflows/workflows/build.yml index 1aac6eb..c6ab9ec 100644 --- a/ci_reference/hsm-github-workflows/workflows/build.yml +++ b/ci_reference/hsm-github-workflows/workflows/build.yml @@ -1,9 +1,9 @@ -name: "Build Ubuntu with Qt (Reusable)" +name: "Build (Reusable)" on: workflow_call: inputs: platforms: - description: "Comma-separated list of platforms: windows,posix" + description: "Comma-separated list of platforms: windows,posix,platformio,arduinoide,freertos" required: false type: string default: "posix" @@ -13,7 +13,6 @@ on: build_dir: required: false type: string - # values: Release, Debug build_type: required: false type: string @@ -50,10 +49,11 @@ on: required: false type: string default: '' + freertos_ref: + required: false + type: string + default: '202212.00' jobs: - # -------------------------------------------------------- - # 1) COMMON JOB — Parse "platforms" - # -------------------------------------------------------- prepare_args: name: "Parse Build Arguments" runs-on: ubuntu-latest @@ -66,13 +66,8 @@ jobs: id: parse run: | platforms="${{ inputs.platforms }}" - - # Convert comma-separated string → JSON list json="[$(printf '"%s",' ${platforms//,/ })]" - json="${json%,}" # trim last comma - json="${json}]" - - echo "Parsed platforms: $json" + json="${json%,}]" echo "platforms_json=$json" >> $GITHUB_OUTPUT - name: Resolve build directory @@ -85,24 +80,6 @@ jobs: run: | echo "dir=${{ inputs.src_dir || github.workspace }}" >> $GITHUB_OUTPUT - # # -------------------------------------------------------- - # # 2) CHECK VERSION — Always runs - # # -------------------------------------------------------- - # check_version: - # uses: ./.github/workflows/check-version.yml -# - # # -------------------------------------------------------- - # # 3) VALIDATE METADATA — Always runs (change if needed) - # # -------------------------------------------------------- - # validate_metadata: - # needs: check_version - # uses: ./.github/workflows/validate-metadata.yml - # with: - # commit_version: ${{ needs.check_version.outputs.commit_version }} - - # -------------------------------------------------------- - # 4) BUILD UBUNTU — Only runs if "posix" enabled - # -------------------------------------------------------- build_project_ubuntu: name: "Ubuntu" needs: prepare_args @@ -134,9 +111,6 @@ jobs: name: build-artifacts-ubuntu path: ${{ needs.prepare_args.outputs.build_dir }} - # -------------------------------------------------------- - # 5) BUILD WIDNOWS — Only runs if "windows" enabled - # -------------------------------------------------------- build_project_windows: name: "Windows" needs: prepare_args @@ -167,3 +141,106 @@ jobs: with: name: build-artifacts-windows path: ${{ needs.prepare_args.outputs.build_dir }} + + build_platformio: + name: "PlatformIO" + needs: prepare_args + if: contains(needs.prepare_args.outputs.platforms_json, 'platformio') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Install PlatformIO + run: pip3 install --user platformio + - name: Generate package + run: | + cmake -S ./ -B ./build -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino + cmake --build ./build --target install + - name: Copy package to examples folder + run: | + mkdir -p ./examples/09_arduino/01_blink/lib/hsmcpp + cp -Rv ./build/deploy/platformio/* ./examples/09_arduino/01_blink/lib/hsmcpp + mkdir -p ./examples/09_arduino/02_blink_button/lib/hsmcpp + cp -Rv ./build/deploy/platformio/* ./examples/09_arduino/02_blink_button/lib/hsmcpp + - name: Build 01_blink + run: | + export PATH="$HOME/.local/bin:$PATH" + cd ./examples/09_arduino/01_blink/ + pio run + - name: Build 02_blink_button + run: | + export PATH="$HOME/.local/bin:$PATH" + cd ./examples/09_arduino/02_blink_button/ + pio run + + build_arduinoide: + name: "ArduinoIDE" + needs: prepare_args + if: contains(needs.prepare_args.outputs.platforms_json, 'arduinoide') + runs-on: ubuntu-latest + env: + library_dir: ./build/deploy/arduinoide + example1_dir: ./build/deploy/arduinoide/examples/01_blink + example2_dir: ./build/deploy/arduinoide/examples/02_blink_button + scxml2gen_dir: ./build/deploy/arduinoide/tools/scxml2gen + hsmcpp_library: ./build/deploy/hsmcpp.zip + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + - name: Generate hsmcpp library package + run: | + cmake -S ./ -B ./build -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino + cmake --build ./build --target install + cp -Rv ${{ env.library_dir }} ./build/deploy/hsmcpp + cd ./build/deploy/ + zip -r ./hsmcpp.zip ./hsmcpp + - name: Generate HSM files + run: | + python3 ${{ env.scxml2gen_dir }}/scxml2gen.py -code -scxml ${{ env.example1_dir }}/blink.scxml \ + -class_name BlinkHsm -class_suffix Base \ + -template_hpp ${{ env.scxml2gen_dir }}/template.hpp \ + -template_cpp ${{ env.scxml2gen_dir }}/template.cpp \ + -dest_dir ${{ env.example1_dir }}/ + python3 ${{ env.scxml2gen_dir }}/scxml2gen.py -code -scxml ${{ env.example2_dir }}/blink_button.scxml \ + -class_name BlinkButtonHsm -class_suffix Base \ + -template_hpp ${{ env.scxml2gen_dir }}/template.hpp \ + -template_cpp ${{ env.scxml2gen_dir }}/template.cpp \ + -dest_dir ${{ env.example2_dir }}/ + - name: Setup Arduino CLI + uses: arduino/setup-arduino-cli@v2 + - name: Install platform files + run: | + arduino-cli core update-index --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json + arduino-cli core install esp8266:esp8266 --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json + - name: Install hsmcpp library + run: | + arduino-cli config init + arduino-cli config set library.enable_unsafe_install true + arduino-cli lib install --zip-path ${{ env.hsmcpp_library }} + - name: Compile Sketch 01 + run: arduino-cli compile --fqbn esp8266:esp8266:d1_mini ${{ env.example1_dir }}/ --warnings more + - name: Compile Sketch 02 + run: arduino-cli compile --fqbn esp8266:esp8266:d1_mini ${{ env.example2_dir }}/ --warnings more + + build_freertos: + name: "FreeRTOS" + needs: prepare_args + if: contains(needs.prepare_args.outputs.platforms_json, 'freertos') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + path: './source' + submodules: 'recursive' + - uses: actions/checkout@v3 + with: + repository: 'FreeRTOS/FreeRTOS' + ref: ${{ inputs.freertos_ref }} + submodules: 'recursive' + path: './FreeRTOS' + - name: Build 08_freertos + run: | + cd ./source/examples/08_freertos + ./build.sh '${{github.workspace}}/FreeRTOS' diff --git a/ci_reference/hsm-github-workflows/workflows/deploy.yml b/ci_reference/hsm-github-workflows/workflows/deploy.yml new file mode 100644 index 0000000..a71e19a --- /dev/null +++ b/ci_reference/hsm-github-workflows/workflows/deploy.yml @@ -0,0 +1,121 @@ +name: "Deploy Package (Reusable)" + +on: + workflow_call: + inputs: + deploy_target: + description: "Target platform: platformio or arduinoide" + required: true + type: string + commit_sha: + required: true + type: string + commit_version: + required: false + type: string + default: '' + commit_action: + required: false + type: string + default: '' + target_repo: + description: "Target repo in owner/name format" + required: true + type: string + target_branch: + required: false + type: string + default: 'main' + publish_registry: + description: "Publish to external registry if supported" + required: false + type: boolean + default: false + +jobs: + deploy: + runs-on: ubuntu-latest + if: > + inputs.commit_version != '' && + (inputs.deploy_target == 'platformio' || inputs.commit_action == 'r') + env: + target_dir: ./deploy_target + library_dir: ./main/build/deploy/hsmcpp + steps: + - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + with: + path: ./main + - uses: actions/checkout@v4 + with: + repository: ${{ inputs.target_repo }} + token: ${{ secrets.HSMCPP_BOT_TOKEN }} + ref: ${{ inputs.target_branch }} + path: ${{ env.target_dir }} + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} + git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true + workdir: ${{ env.target_dir }} + + - name: Install PlatformIO + if: inputs.deploy_target == 'platformio' + run: pip3 install --user platformio + + - name: Generate package for PlatformIO + if: inputs.deploy_target == 'platformio' + run: | + cmake -S ./main -B ./main/build -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino + cmake --build ./main/build --target install + + - name: Generate package for ArduinoIDE + if: inputs.deploy_target == 'arduinoide' + run: | + cmake -S ./main -B ./main/build -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino + cmake --build ./main/build --target install + mv ./main/build/deploy/arduinoide ${{ env.library_dir }} + + - name: Validate arduino library structure + if: inputs.deploy_target == 'arduinoide' + run: | + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh | BINDIR=./ sh + ./arduino-lint --compliance strict --recursive --library-manager update ${{ env.library_dir }} + + - name: Copy package files to target repository + run: | + if [ "${{ inputs.deploy_target }}" = "platformio" ]; then + cp -Rv ./main/build/deploy/platformio/* "$target_dir" + else + cp -Rv ${{ env.library_dir }}/* "$target_dir" + fi + + - name: Publish PlatformIO package + if: inputs.deploy_target == 'platformio' && inputs.publish_registry + env: + PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_TOKEN }} + run: | + export PATH="$HOME/.local/bin:$PATH" + pio pkg publish --type library --no-interactive $PWD/main/build/deploy/platformio/ + + - name: Prepare commit message + run: | + cd ./main + git log -1 --format=%B ${{ inputs.commit_sha }} > ../commit.txt + + - name: Commit and push files + run: | + cd "$target_dir" + git add -A + git commit -S -F ../commit.txt + if [ "${{ inputs.deploy_target }}" = "arduinoide" ]; then + git tag ${{ inputs.commit_version }} + git push + git push --tags + else + git push + fi From 95ee87b6622b90a0e75cc3c7f70e947a23c99371 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Sun, 29 Mar 2026 22:34:02 +0100 Subject: [PATCH 03/36] Adjust build workflow behavior by event type --- .github/workflows/build.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0404b24..f42a9d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,16 +3,16 @@ name: "Build" on: workflow_dispatch: push: - branches: [ main, dev ] + branches: + - "**" pull_request: branches: [ main, dev ] jobs: verify: if: > - github.ref_name == 'main' || - github.ref_name == 'dev' || - github.event_name == 'pull_request' + github.event_name == 'pull_request' || + (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev')) uses: igor-krechetov/hsm-github-workflows/.github/workflows/verify.yml@main build: @@ -30,23 +30,17 @@ jobs: test: needs: build uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@main - if: > - always() && (needs.build.result == 'success') + if: always() && (needs.build.result == 'success') with: test_script: "validate.sh" - autotag: - needs: [test, verify] - if: github.event_name == 'push' && github.ref_name == 'dev' - uses: igor-krechetov/hsm-github-workflows/.github/workflows/autotag.yml@main - with: - commit_version: ${{ needs.verify.outputs.commit_version }} - commit_action: ${{ needs.verify.outputs.commit_action }} - commit_sha: ${{ github.sha }} - update_documentation: - needs: test - if: github.event_name == 'push' && github.ref_name == 'main' + needs: [verify, test] + if: > + github.event_name == 'push' && + github.ref_name == 'main' && + needs.verify.result == 'success' && + needs.test.result == 'success' uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@main release: @@ -54,7 +48,9 @@ jobs: if: > github.event_name == 'push' && github.ref_name == 'main' && - needs.verify.outputs.commit_action == 'r' + needs.verify.outputs.commit_action == 'r' && + needs.verify.result == 'success' && + needs.update_documentation.result == 'success' uses: igor-krechetov/hsm-github-workflows/.github/workflows/release.yml@main with: commit_sha: ${{ github.sha }} From 8eff0d8b7be3bcd57273c4da1d9a6ac0501d1a6f Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Mon, 30 Mar 2026 23:05:40 +0100 Subject: [PATCH 04/36] Refactor reusable build helper to use per-platform scripts --- .github/workflows/build.yml | 2 +- ci_reference/example/build.yml | 2 +- .../actions/build_helper/action.yml | 82 +++++++++---------- .../scripts/build/arduino/build.sh | 7 ++ .../scripts/build/arduino/configure.sh | 12 +++ .../scripts/build/freertos/build.sh | 7 ++ .../scripts/build/freertos/configure.sh | 12 +++ .../scripts/build/platformio/build.sh | 7 ++ .../scripts/build/platformio/configure.sh | 12 +++ .../scripts/build/posix/build.sh | 7 ++ .../scripts/build/posix/configure.sh | 14 ++++ .../scripts/build/windows/build.cmd | 5 ++ .../scripts/build/windows/configure.cmd | 8 ++ .../hsm-github-workflows/workflows/build.yml | 6 +- 14 files changed, 133 insertions(+), 50 deletions(-) create mode 100755 ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/posix/build.sh create mode 100755 ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh create mode 100644 ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd create mode 100644 ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f42a9d6..b69b737 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: with: build_type: Release platforms: "posix,windows,platformio,arduinoide,freertos" - build_qt: 'ON' + install_qt: 'ON' build_tests: 'ON' test: diff --git a/ci_reference/example/build.yml b/ci_reference/example/build.yml index a7dc07e..20803a9 100644 --- a/ci_reference/example/build.yml +++ b/ci_reference/example/build.yml @@ -34,7 +34,7 @@ jobs: with: build_type: Release platforms: "posix,windows" - build_qt: 'ON' + install_qt: 'ON' build_tests: 'ON' # -------------------------------------------------------- diff --git a/ci_reference/hsm-github-workflows/actions/build_helper/action.yml b/ci_reference/hsm-github-workflows/actions/build_helper/action.yml index b850086..a294aa0 100644 --- a/ci_reference/hsm-github-workflows/actions/build_helper/action.yml +++ b/ci_reference/hsm-github-workflows/actions/build_helper/action.yml @@ -1,7 +1,7 @@ name: "Build Helper" inputs: - # values: posix, windows + # values: posix, windows, platformio, arduino, freertos platform: required: true type: string @@ -25,7 +25,7 @@ inputs: required: false type: string default: 'OFF' - build_qt: + install_qt: required: false type: string default: 'OFF' @@ -58,7 +58,15 @@ runs: using: "composite" steps: - # --------------------------------- Ubuntu build --------------------------------- + - name: Validate platform scripts directory + shell: bash + run: | + scripts_dir="$GITHUB_ACTION_PATH/../../../scripts/build/${{ inputs.platform }}" + if [ ! -d "$scripts_dir" ]; then + echo "Missing scripts directory: $scripts_dir" + exit 1 + fi + - uses: awalsh128/cache-apt-pkgs-action@v1.6.0 if: ${{ (inputs.platform == 'posix') && ((inputs.build_glib == 'ON') || (inputs.build_glibmm == 'ON')) }} with: @@ -66,7 +74,7 @@ runs: version: 1.0 - name: Install Qt (Ubuntu) - if: ${{ (inputs.platform == 'posix') && (inputs.build_qt == 'ON') }} + if: ${{ (inputs.platform == 'posix') && (inputs.install_qt == 'ON') }} uses: jurplel/install-qt-action@v4 with: version: '6.4.*' @@ -78,34 +86,8 @@ runs: cache-key-prefix: 'install-qt-action-linux' set-env: 'true' - # -DHSMBUILD_VERBOSE=OFF \ - # -DHSMBUILD_PLATFORM=${{ inputs.platform }} \ - # -DHSMBUILD_DISPATCHER_GLIB=${{ inputs.build_glib }} \ - # -DHSMBUILD_DISPATCHER_GLIBMM=${{ inputs.build_glibmm }} \ - # -DHSMBUILD_DISPATCHER_STD=${{ inputs.build_std }} \ - # -DHSMBUILD_DISPATCHER_QT=${{ inputs.build_qt }} \ - # -DHSMBUILD_TESTS=${{ inputs.build_tests }} \ - # -DHSMBUILD_EXAMPLES=${{ inputs.build_examples }} \ - # -DHSMBUILD_CODECOVERAGE=${{ inputs.codecoverage }} \ - # -DHSMBUILD_DEBUGGING=ON \ - - - name: Configure CMake (Ubuntu) - if: ${{ inputs.platform == 'posix' }} - shell: bash - run: | - cmake -B ${{ inputs.build_dir }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - ${{ inputs.cmake_args }} \ - ${{ inputs.src_dir }} - - - name: Build (Ubuntu) - if: ${{ (inputs.platform == 'posix') && (inputs.only_configure == 'false') }} - shell: bash - run: cmake --build ${{ inputs.build_dir }} --parallel 2 --config ${{ inputs.build_type }} - - # --------------------------------- Windows build --------------------------------- - name: Install Qt (Windows) - if: ${{ (inputs.platform == 'windows') && (inputs.build_qt == 'ON') }} + if: ${{ (inputs.platform == 'windows') && (inputs.install_qt == 'ON') }} uses: jurplel/install-qt-action@v4 with: version: '6.4.*' @@ -117,23 +99,33 @@ runs: cache-key-prefix: 'install-qt-action-win32' set-env: 'true' - # -DHSMBUILD_VERBOSE=OFF ^ - # -DHSMBUILD_PLATFORM=${{ inputs.platform }} ^ - # -DHSMBUILD_DISPATCHER_GLIB=OFF ^ - # -DHSMBUILD_DISPATCHER_GLIBMM=OFF ^ - # -DHSMBUILD_DISPATCHER_STD=ON ^ - # -DHSMBUILD_DISPATCHER_QT=ON ^ - # -DHSMBUILD_TESTS=ON ^ - # -DHSMBUILD_EXAMPLES=ON ^ - # -DHSMBUILD_DEBUGGING=ON ^ - - name: Configure CMake (Windows) + - name: Configure (POSIX platforms) + if: ${{ inputs.platform != 'windows' }} + shell: bash + run: | + $GITHUB_ACTION_PATH/../../../scripts/build/${{ inputs.platform }}/configure.sh \ + "${{ inputs.build_dir }}" \ + "${{ inputs.build_type }}" \ + "${{ inputs.cmake_args }}" \ + "${{ inputs.src_dir }}" \ + "${{ inputs.build_tests }}" + + - name: Configure (Windows) if: ${{ inputs.platform == 'windows' }} shell: cmd - run: cmake -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} ^ - ${{ inputs.cmake_args }} ^ - ${{ inputs.src_dir }} + run: | + call "%GITHUB_ACTION_PATH%\..\..\..\scripts\build\windows\configure.cmd" "${{ inputs.build_dir }}" "${{ inputs.build_type }}" "${{ inputs.cmake_args }}" "${{ inputs.src_dir }}" "${{ inputs.build_tests }}" + + - name: Build (POSIX platforms) + if: ${{ (inputs.platform != 'windows') && (inputs.only_configure == 'false') }} + shell: bash + run: | + $GITHUB_ACTION_PATH/../../../scripts/build/${{ inputs.platform }}/build.sh \ + "${{ inputs.build_dir }}" \ + "${{ inputs.build_type }}" - name: Build (Windows) if: ${{ (inputs.platform == 'windows') && (inputs.only_configure == 'false') }} shell: cmd - run: cmake --build ${{github.workspace}}\build --parallel 2 --config ${{ inputs.build_type }} \ No newline at end of file + run: | + call "%GITHUB_ACTION_PATH%\..\..\..\scripts\build\windows\build.cmd" "${{ inputs.build_dir }}" "${{ inputs.build_type }}" diff --git a/ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh b/ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh new file mode 100755 index 0000000..b37fa2a --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --config "$build_type" --target install diff --git a/ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh new file mode 100755 index 0000000..b99b4d8 --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args diff --git a/ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh b/ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh new file mode 100755 index 0000000..773751d --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --config "$build_type" diff --git a/ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh new file mode 100755 index 0000000..9a52d7d --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_PLATFORM=freertos -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args diff --git a/ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh b/ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh new file mode 100755 index 0000000..b37fa2a --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --config "$build_type" --target install diff --git a/ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh new file mode 100755 index 0000000..4dfec91 --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args diff --git a/ci_reference/hsm-github-workflows/scripts/build/posix/build.sh b/ci_reference/hsm-github-workflows/scripts/build/posix/build.sh new file mode 100755 index 0000000..1776375 --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/posix/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --parallel 2 --config "$build_type" diff --git a/ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh new file mode 100755 index 0000000..50d0263 --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args \ + "$src_dir" diff --git a/ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd b/ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd new file mode 100644 index 0000000..e380785 --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd @@ -0,0 +1,5 @@ +@echo off +set BUILD_DIR=%1 +set BUILD_TYPE=%2 + +cmake --build "%BUILD_DIR%" --parallel 2 --config %BUILD_TYPE% diff --git a/ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd b/ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd new file mode 100644 index 0000000..b75615b --- /dev/null +++ b/ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd @@ -0,0 +1,8 @@ +@echo off +set BUILD_DIR=%1 +set BUILD_TYPE=%2 +set CMAKE_ARGS=%3 +set SRC_DIR=%4 +set BUILD_TESTS=%5 + +cmake -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DHSMBUILD_TESTS=%BUILD_TESTS% %CMAKE_ARGS% "%SRC_DIR%" diff --git a/ci_reference/hsm-github-workflows/workflows/build.yml b/ci_reference/hsm-github-workflows/workflows/build.yml index c6ab9ec..93b7fb0 100644 --- a/ci_reference/hsm-github-workflows/workflows/build.yml +++ b/ci_reference/hsm-github-workflows/workflows/build.yml @@ -25,7 +25,7 @@ on: required: false type: string default: 'OFF' - build_qt: + install_qt: required: false type: string default: 'OFF' @@ -98,7 +98,7 @@ jobs: build_dir: ${{ needs.prepare_args.outputs.build_dir }} build_glib: ${{ inputs.build_glib }} build_glibmm: ${{ inputs.build_glibmm }} - build_qt: ${{ inputs.build_qt }} + install_qt: ${{ inputs.install_qt }} build_std: ${{ inputs.build_std }} build_tests: ${{ inputs.build_tests }} build_examples: ${{ inputs.build_examples }} @@ -129,7 +129,7 @@ jobs: build_dir: ${{ needs.prepare_args.outputs.build_dir }} build_glib: ${{ inputs.build_glib }} build_glibmm: ${{ inputs.build_glibmm }} - build_qt: ${{ inputs.build_qt }} + install_qt: ${{ inputs.install_qt }} build_std: ${{ inputs.build_std }} build_tests: ${{ inputs.build_tests }} build_examples: ${{ inputs.build_examples }} From 53cce8c1fc0c2b633942820f215f56276b01c305 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Mon, 30 Mar 2026 23:26:14 +0100 Subject: [PATCH 05/36] [ci] scripts test --- .github/workflows/build.yml | 10 +++++----- .github/workflows/deploy-arduinoide.yml | 2 +- .github/workflows/deploy-platformio.yml | 2 +- .../scripts/build/arduino/build.sh | 7 ------- .../scripts/build/arduino/configure.sh | 12 ------------ .../scripts/build/freertos/build.sh | 7 ------- .../scripts/build/freertos/configure.sh | 12 ------------ .../scripts/build/platformio/build.sh | 7 ------- .../scripts/build/platformio/configure.sh | 12 ------------ .../scripts/build/posix/build.sh | 7 ------- .../scripts/build/posix/configure.sh | 14 -------------- .../scripts/build/windows/build.cmd | 5 ----- .../scripts/build/windows/configure.cmd | 8 -------- 13 files changed, 7 insertions(+), 98 deletions(-) delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/posix/build.sh delete mode 100755 ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh delete mode 100644 ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd delete mode 100644 ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b69b737..d40adbb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,11 +13,11 @@ jobs: if: > github.event_name == 'pull_request' || (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev')) - uses: igor-krechetov/hsm-github-workflows/.github/workflows/verify.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/verify.yml@feature/hsmcpp-ci-integration build: needs: verify - uses: igor-krechetov/hsm-github-workflows/.github/workflows/build.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/build.yml@feature/hsmcpp-ci-integration if: > always() && (needs.verify.result == 'success' || needs.verify.result == 'skipped') @@ -29,7 +29,7 @@ jobs: test: needs: build - uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration if: always() && (needs.build.result == 'success') with: test_script: "validate.sh" @@ -41,7 +41,7 @@ jobs: github.ref_name == 'main' && needs.verify.result == 'success' && needs.test.result == 'success' - uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@feature/hsmcpp-ci-integration release: needs: [verify, update_documentation] @@ -51,7 +51,7 @@ jobs: needs.verify.outputs.commit_action == 'r' && needs.verify.result == 'success' && needs.update_documentation.result == 'success' - uses: igor-krechetov/hsm-github-workflows/.github/workflows/release.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/release.yml@feature/hsmcpp-ci-integration with: commit_sha: ${{ github.sha }} tag_version: ${{ needs.update_documentation.outputs.tag_name }} diff --git a/.github/workflows/deploy-arduinoide.yml b/.github/workflows/deploy-arduinoide.yml index d5896d3..21754a9 100644 --- a/.github/workflows/deploy-arduinoide.yml +++ b/.github/workflows/deploy-arduinoide.yml @@ -28,7 +28,7 @@ jobs: deploy: needs: check-hsmcpp-version if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} - uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@feature/hsmcpp-ci-integration with: deploy_target: arduinoide commit_sha: ${{ needs.check-hsmcpp-version.outputs.commit_sha }} diff --git a/.github/workflows/deploy-platformio.yml b/.github/workflows/deploy-platformio.yml index cacfb5d..34defcb 100644 --- a/.github/workflows/deploy-platformio.yml +++ b/.github/workflows/deploy-platformio.yml @@ -37,7 +37,7 @@ jobs: deploy: needs: check-hsmcpp-version - uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@main + uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@feature/hsmcpp-ci-integration if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} with: deploy_target: platformio diff --git a/ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh b/ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh deleted file mode 100755 index b37fa2a..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/arduino/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" - -cmake --build "$build_dir" --config "$build_type" --target install diff --git a/ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh deleted file mode 100755 index b99b4d8..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/arduino/configure.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" -cmake_args="$3" -src_dir="$4" -build_tests="$5" - -cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ - -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino -DHSMBUILD_TESTS="$build_tests" \ - $cmake_args diff --git a/ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh b/ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh deleted file mode 100755 index 773751d..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/freertos/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" - -cmake --build "$build_dir" --config "$build_type" diff --git a/ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh deleted file mode 100755 index 9a52d7d..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/freertos/configure.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" -cmake_args="$3" -src_dir="$4" -build_tests="$5" - -cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ - -DHSMBUILD_PLATFORM=freertos -DHSMBUILD_TESTS="$build_tests" \ - $cmake_args diff --git a/ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh b/ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh deleted file mode 100755 index b37fa2a..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/platformio/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" - -cmake --build "$build_dir" --config "$build_type" --target install diff --git a/ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh deleted file mode 100755 index 4dfec91..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/platformio/configure.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" -cmake_args="$3" -src_dir="$4" -build_tests="$5" - -cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ - -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino -DHSMBUILD_TESTS="$build_tests" \ - $cmake_args diff --git a/ci_reference/hsm-github-workflows/scripts/build/posix/build.sh b/ci_reference/hsm-github-workflows/scripts/build/posix/build.sh deleted file mode 100755 index 1776375..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/posix/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" - -cmake --build "$build_dir" --parallel 2 --config "$build_type" diff --git a/ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh b/ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh deleted file mode 100755 index 50d0263..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/posix/configure.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -build_dir="$1" -build_type="$2" -cmake_args="$3" -src_dir="$4" -build_tests="$5" - -cmake -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -DHSMBUILD_TESTS="$build_tests" \ - $cmake_args \ - "$src_dir" diff --git a/ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd b/ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd deleted file mode 100644 index e380785..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/windows/build.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -set BUILD_DIR=%1 -set BUILD_TYPE=%2 - -cmake --build "%BUILD_DIR%" --parallel 2 --config %BUILD_TYPE% diff --git a/ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd b/ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd deleted file mode 100644 index b75615b..0000000 --- a/ci_reference/hsm-github-workflows/scripts/build/windows/configure.cmd +++ /dev/null @@ -1,8 +0,0 @@ -@echo off -set BUILD_DIR=%1 -set BUILD_TYPE=%2 -set CMAKE_ARGS=%3 -set SRC_DIR=%4 -set BUILD_TESTS=%5 - -cmake -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DHSMBUILD_TESTS=%BUILD_TESTS% %CMAKE_ARGS% "%SRC_DIR%" From b5901354facc77e80ad8ce0b0fa82f8881680ed4 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Mon, 30 Mar 2026 23:33:10 +0100 Subject: [PATCH 06/36] [ci] add scripts --- scripts/build/arduino/build.sh | 7 +++++++ scripts/build/arduino/configure.sh | 12 ++++++++++++ scripts/build/freertos/build.sh | 7 +++++++ scripts/build/freertos/configure.sh | 12 ++++++++++++ scripts/build/platformio/build.sh | 7 +++++++ scripts/build/platformio/configure.sh | 12 ++++++++++++ scripts/build/posix/build.sh | 7 +++++++ scripts/build/posix/configure.sh | 23 +++++++++++++++++++++++ scripts/build/windows/build.cmd | 5 +++++ scripts/build/windows/configure.cmd | 8 ++++++++ 10 files changed, 100 insertions(+) create mode 100755 scripts/build/arduino/build.sh create mode 100755 scripts/build/arduino/configure.sh create mode 100755 scripts/build/freertos/build.sh create mode 100755 scripts/build/freertos/configure.sh create mode 100755 scripts/build/platformio/build.sh create mode 100755 scripts/build/platformio/configure.sh create mode 100755 scripts/build/posix/build.sh create mode 100755 scripts/build/posix/configure.sh create mode 100644 scripts/build/windows/build.cmd create mode 100644 scripts/build/windows/configure.cmd diff --git a/scripts/build/arduino/build.sh b/scripts/build/arduino/build.sh new file mode 100755 index 0000000..b37fa2a --- /dev/null +++ b/scripts/build/arduino/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --config "$build_type" --target install diff --git a/scripts/build/arduino/configure.sh b/scripts/build/arduino/configure.sh new file mode 100755 index 0000000..b99b4d8 --- /dev/null +++ b/scripts/build/arduino/configure.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_TARGET=arduinoide -DHSMBUILD_PLATFORM=arduino -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args diff --git a/scripts/build/freertos/build.sh b/scripts/build/freertos/build.sh new file mode 100755 index 0000000..773751d --- /dev/null +++ b/scripts/build/freertos/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --config "$build_type" diff --git a/scripts/build/freertos/configure.sh b/scripts/build/freertos/configure.sh new file mode 100755 index 0000000..9a52d7d --- /dev/null +++ b/scripts/build/freertos/configure.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_PLATFORM=freertos -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args diff --git a/scripts/build/platformio/build.sh b/scripts/build/platformio/build.sh new file mode 100755 index 0000000..b37fa2a --- /dev/null +++ b/scripts/build/platformio/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --config "$build_type" --target install diff --git a/scripts/build/platformio/configure.sh b/scripts/build/platformio/configure.sh new file mode 100755 index 0000000..4dfec91 --- /dev/null +++ b/scripts/build/platformio/configure.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -S "$src_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_TARGET=platformio -DHSMBUILD_PLATFORM=arduino -DHSMBUILD_TESTS="$build_tests" \ + $cmake_args diff --git a/scripts/build/posix/build.sh b/scripts/build/posix/build.sh new file mode 100755 index 0000000..1776375 --- /dev/null +++ b/scripts/build/posix/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" + +cmake --build "$build_dir" --parallel 2 --config "$build_type" diff --git a/scripts/build/posix/configure.sh b/scripts/build/posix/configure.sh new file mode 100755 index 0000000..f3d2e9a --- /dev/null +++ b/scripts/build/posix/configure.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" +build_type="$2" +cmake_args="$3" +src_dir="$4" +build_tests="$5" + +cmake -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ + -DHSMBUILD_VERBOSE=OFF \ + -DHSMBUILD_PLATFORM=posix \ + -DHSMBUILD_DISPATCHER_GLIB=ON \ + -DHSMBUILD_DISPATCHER_GLIBMM=ON \ + -DHSMBUILD_DISPATCHER_STD=ON \ + -DHSMBUILD_DISPATCHER_QT=ON \ + -DHSMBUILD_EXAMPLES=ON \ + -DHSMBUILD_TESTS="$build_tests" \ + -DHSMBUILD_CODECOVERAGE=ON \ + -DHSMBUILD_DEBUGGING=ON \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + $cmake_args \ + "$src_dir" diff --git a/scripts/build/windows/build.cmd b/scripts/build/windows/build.cmd new file mode 100644 index 0000000..e380785 --- /dev/null +++ b/scripts/build/windows/build.cmd @@ -0,0 +1,5 @@ +@echo off +set BUILD_DIR=%1 +set BUILD_TYPE=%2 + +cmake --build "%BUILD_DIR%" --parallel 2 --config %BUILD_TYPE% diff --git a/scripts/build/windows/configure.cmd b/scripts/build/windows/configure.cmd new file mode 100644 index 0000000..b75615b --- /dev/null +++ b/scripts/build/windows/configure.cmd @@ -0,0 +1,8 @@ +@echo off +set BUILD_DIR=%1 +set BUILD_TYPE=%2 +set CMAKE_ARGS=%3 +set SRC_DIR=%4 +set BUILD_TESTS=%5 + +cmake -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DHSMBUILD_TESTS=%BUILD_TESTS% %CMAKE_ARGS% "%SRC_DIR%" From d55bd35c8c87e0302e1d92629ccbfe5f6c16dc10 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Mon, 30 Mar 2026 23:39:48 +0100 Subject: [PATCH 07/36] [ci] fixes --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d40adbb..684b2df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,7 @@ jobs: build_type: Release platforms: "posix,windows,platformio,arduinoide,freertos" install_qt: 'ON' + install_glibmm: 'ON' build_tests: 'ON' test: From c7030922df918b8be59d81545c7abc5d95c775a4 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 00:14:44 +0100 Subject: [PATCH 08/36] [ci] fixes --- scripts/build/windows/configure.cmd | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/build/windows/configure.cmd b/scripts/build/windows/configure.cmd index b75615b..8b7299a 100644 --- a/scripts/build/windows/configure.cmd +++ b/scripts/build/windows/configure.cmd @@ -5,4 +5,15 @@ set CMAKE_ARGS=%3 set SRC_DIR=%4 set BUILD_TESTS=%5 -cmake -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DHSMBUILD_TESTS=%BUILD_TESTS% %CMAKE_ARGS% "%SRC_DIR%" +cmake -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^ + -DHSMBUILD_VERBOSE=OFF ^ + -DHSMBUILD_PLATFORM=windows ^ + -DHSMBUILD_DISPATCHER_GLIB=OFF ^ + -DHSMBUILD_DISPATCHER_GLIBMM=OFF ^ + -DHSMBUILD_DISPATCHER_STD=ON ^ + -DHSMBUILD_DISPATCHER_QT=ON ^ + -DHSMBUILD_TESTS=%BUILD_TESTS% ^ + -DHSMBUILD_EXAMPLES=ON ^ + -DHSMBUILD_DEBUGGING=ON ^ + %CMAKE_ARGS% ^ + "%SRC_DIR%" From e068414fe7897442757799ca02c2efb0d1edf33a Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 00:48:57 +0100 Subject: [PATCH 09/36] [ci] fixes --- .github/workflows/build.yml | 15 +++++++++++-- scripts/{ => local}/apply_clang_format.sh | 0 scripts/{ => local}/build.sh | 0 scripts/{ => local}/buildFreeRTOS.sh | 0 scripts/{ => local}/build_vs.cmd | 0 scripts/{ => local}/coverity/COPYING | 0 .../{ => local}/coverity/coverity-submit.py | 0 .../cppcheck/cppcheck-misra-parsetexts.py | 0 .../{ => local}/cppcheck/cppcheck_review.py | 0 .../cppcheck/cppcheck_suppress.txt | 0 scripts/{ => local}/cppcheck/misra.json | 0 scripts/{ => local}/packageArduinoIDE.sh | 0 scripts/{ => local}/packagePlatformio.sh | 0 scripts/{ => local}/validate.sh | 0 scripts/{ => local}/validate_metadata.py | 0 scripts/test/ubuntu/coverage.sh | 18 +++++++++++++++ scripts/test/ubuntu/test.sh | 22 +++++++++++++++++++ 17 files changed, 53 insertions(+), 2 deletions(-) rename scripts/{ => local}/apply_clang_format.sh (100%) rename scripts/{ => local}/build.sh (100%) rename scripts/{ => local}/buildFreeRTOS.sh (100%) rename scripts/{ => local}/build_vs.cmd (100%) rename scripts/{ => local}/coverity/COPYING (100%) rename scripts/{ => local}/coverity/coverity-submit.py (100%) rename scripts/{ => local}/cppcheck/cppcheck-misra-parsetexts.py (100%) rename scripts/{ => local}/cppcheck/cppcheck_review.py (100%) rename scripts/{ => local}/cppcheck/cppcheck_suppress.txt (100%) rename scripts/{ => local}/cppcheck/misra.json (100%) rename scripts/{ => local}/packageArduinoIDE.sh (100%) rename scripts/{ => local}/packagePlatformio.sh (100%) rename scripts/{ => local}/validate.sh (100%) rename scripts/{ => local}/validate_metadata.py (100%) create mode 100755 scripts/test/ubuntu/coverage.sh create mode 100755 scripts/test/ubuntu/test.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 684b2df..857ce38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,10 +33,21 @@ jobs: uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration if: always() && (needs.build.result == 'success') with: - test_script: "validate.sh" + platform: "ubuntu" + + sca: + needs: test + # uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration + if: always() && (needs.test.result == 'success') + runs-on: ubuntu-latest + # with: + # test_script: "validate.sh" + steps: + - name: DUMMY + run: echo "Static Code Analises" update_documentation: - needs: [verify, test] + needs: [verify, test, sca] if: > github.event_name == 'push' && github.ref_name == 'main' && diff --git a/scripts/apply_clang_format.sh b/scripts/local/apply_clang_format.sh similarity index 100% rename from scripts/apply_clang_format.sh rename to scripts/local/apply_clang_format.sh diff --git a/scripts/build.sh b/scripts/local/build.sh similarity index 100% rename from scripts/build.sh rename to scripts/local/build.sh diff --git a/scripts/buildFreeRTOS.sh b/scripts/local/buildFreeRTOS.sh similarity index 100% rename from scripts/buildFreeRTOS.sh rename to scripts/local/buildFreeRTOS.sh diff --git a/scripts/build_vs.cmd b/scripts/local/build_vs.cmd similarity index 100% rename from scripts/build_vs.cmd rename to scripts/local/build_vs.cmd diff --git a/scripts/coverity/COPYING b/scripts/local/coverity/COPYING similarity index 100% rename from scripts/coverity/COPYING rename to scripts/local/coverity/COPYING diff --git a/scripts/coverity/coverity-submit.py b/scripts/local/coverity/coverity-submit.py similarity index 100% rename from scripts/coverity/coverity-submit.py rename to scripts/local/coverity/coverity-submit.py diff --git a/scripts/cppcheck/cppcheck-misra-parsetexts.py b/scripts/local/cppcheck/cppcheck-misra-parsetexts.py similarity index 100% rename from scripts/cppcheck/cppcheck-misra-parsetexts.py rename to scripts/local/cppcheck/cppcheck-misra-parsetexts.py diff --git a/scripts/cppcheck/cppcheck_review.py b/scripts/local/cppcheck/cppcheck_review.py similarity index 100% rename from scripts/cppcheck/cppcheck_review.py rename to scripts/local/cppcheck/cppcheck_review.py diff --git a/scripts/cppcheck/cppcheck_suppress.txt b/scripts/local/cppcheck/cppcheck_suppress.txt similarity index 100% rename from scripts/cppcheck/cppcheck_suppress.txt rename to scripts/local/cppcheck/cppcheck_suppress.txt diff --git a/scripts/cppcheck/misra.json b/scripts/local/cppcheck/misra.json similarity index 100% rename from scripts/cppcheck/misra.json rename to scripts/local/cppcheck/misra.json diff --git a/scripts/packageArduinoIDE.sh b/scripts/local/packageArduinoIDE.sh similarity index 100% rename from scripts/packageArduinoIDE.sh rename to scripts/local/packageArduinoIDE.sh diff --git a/scripts/packagePlatformio.sh b/scripts/local/packagePlatformio.sh similarity index 100% rename from scripts/packagePlatformio.sh rename to scripts/local/packagePlatformio.sh diff --git a/scripts/validate.sh b/scripts/local/validate.sh similarity index 100% rename from scripts/validate.sh rename to scripts/local/validate.sh diff --git a/scripts/validate_metadata.py b/scripts/local/validate_metadata.py similarity index 100% rename from scripts/validate_metadata.py rename to scripts/local/validate_metadata.py diff --git a/scripts/test/ubuntu/coverage.sh b/scripts/test/ubuntu/coverage.sh new file mode 100755 index 0000000..47ddc2c --- /dev/null +++ b/scripts/test/ubuntu/coverage.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" + +cd $build_dir + +echo "Generate code coverage" +lcov --add-tracefile ./coverage_std.info \ + -a ./coverage_glib.info \ + -a ./coverage_qt.info \ + -a ./coverage_glibmm.info \ + -o ./coverage.info +lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info +lcov -r ./coverage.info \*/build/\* . -o ./coverage.info +lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info +lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info +lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info \ No newline at end of file diff --git a/scripts/test/ubuntu/test.sh b/scripts/test/ubuntu/test.sh new file mode 100755 index 0000000..2ec8662 --- /dev/null +++ b/scripts/test/ubuntu/test.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail + +build_dir="$1" + +cd $build_dir + +echo "Run Tests (STD)" +timeout 2m ./tests/hsmUnitTestsSTD > ./tests_result_std.log +lcov -c -d . -o ./coverage_std.info + +echo "Run Tests (GLib)" +timeout 2m ./tests/hsmUnitTestsGLib > ./tests_result_glib.log +lcov -c -d . -o ./coverage_glib.info + +echo "Run Tests (GLibmm)" +timeout 2m ./tests/hsmUnitTestsGLibmm > ./tests_result_glibmm.log +lcov -c -d . -o ./coverage_glibmm.info + +echo "Run Tests (Qt)" +timeout 2m ./tests/hsmUnitTestsQt > ./tests_result_qt.log +lcov -c -d . -o ./coverage_qt.info \ No newline at end of file From d40fd185c6c06bb97f60033e4b67b2a73eafaf1b Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:02:46 +0100 Subject: [PATCH 10/36] [ci] fixes --- .github/workflows/{build.yml => ci_pipeline.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{build.yml => ci_pipeline.yml} (99%) diff --git a/.github/workflows/build.yml b/.github/workflows/ci_pipeline.yml similarity index 99% rename from .github/workflows/build.yml rename to .github/workflows/ci_pipeline.yml index 857ce38..954f017 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/ci_pipeline.yml @@ -1,4 +1,4 @@ -name: "Build" +name: "CI/CD" on: workflow_dispatch: From d56ce24a595b41f2e13d1508e4de24184e45f910 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:10:30 +0100 Subject: [PATCH 11/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 954f017..c7a8be4 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -44,7 +44,7 @@ jobs: # test_script: "validate.sh" steps: - name: DUMMY - run: echo "Static Code Analises" + run: echo "Static Code Analises 2" update_documentation: needs: [verify, test, sca] From bf80b87f07b029c669a92b77bc994e2eb63f2516 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:19:14 +0100 Subject: [PATCH 12/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index c7a8be4..fd892a5 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -23,7 +23,8 @@ jobs: (needs.verify.result == 'success' || needs.verify.result == 'skipped') with: build_type: Release - platforms: "posix,windows,platformio,arduinoide,freertos" + # platforms: "posix,windows,platformio,arduinoide,freertos" + platforms: "posix" install_qt: 'ON' install_glibmm: 'ON' build_tests: 'ON' From b9e1674d105645c471f9433cdd6f18f28388033f Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:26:03 +0100 Subject: [PATCH 13/36] [ci] fixes --- scripts/test/ubuntu/test.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/test/ubuntu/test.sh b/scripts/test/ubuntu/test.sh index 2ec8662..faed6e8 100755 --- a/scripts/test/ubuntu/test.sh +++ b/scripts/test/ubuntu/test.sh @@ -6,17 +6,21 @@ build_dir="$1" cd $build_dir echo "Run Tests (STD)" +chmod +x ./tests/hsmUnitTestsSTD timeout 2m ./tests/hsmUnitTestsSTD > ./tests_result_std.log lcov -c -d . -o ./coverage_std.info echo "Run Tests (GLib)" +chmod +x ./tests/hsmUnitTestsGLib timeout 2m ./tests/hsmUnitTestsGLib > ./tests_result_glib.log lcov -c -d . -o ./coverage_glib.info echo "Run Tests (GLibmm)" +chmod +x ./tests/hsmUnitTestsGLibmm timeout 2m ./tests/hsmUnitTestsGLibmm > ./tests_result_glibmm.log lcov -c -d . -o ./coverage_glibmm.info echo "Run Tests (Qt)" +chmod +x ./tests/hsmUnitTestsQt timeout 2m ./tests/hsmUnitTestsQt > ./tests_result_qt.log lcov -c -d . -o ./coverage_qt.info \ No newline at end of file From f7d121f546412aabfc0e136876f16d347147527e Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:35:40 +0100 Subject: [PATCH 14/36] [ci] fixes --- scripts/test/ubuntu/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/test/ubuntu/test.sh b/scripts/test/ubuntu/test.sh index faed6e8..dd6d06c 100755 --- a/scripts/test/ubuntu/test.sh +++ b/scripts/test/ubuntu/test.sh @@ -8,19 +8,19 @@ cd $build_dir echo "Run Tests (STD)" chmod +x ./tests/hsmUnitTestsSTD timeout 2m ./tests/hsmUnitTestsSTD > ./tests_result_std.log -lcov -c -d . -o ./coverage_std.info +lcov -c -d . -o ./coverage_std.info --ignore-errors mismatch echo "Run Tests (GLib)" chmod +x ./tests/hsmUnitTestsGLib timeout 2m ./tests/hsmUnitTestsGLib > ./tests_result_glib.log -lcov -c -d . -o ./coverage_glib.info +lcov -c -d . -o ./coverage_glib.info --ignore-errors mismatch echo "Run Tests (GLibmm)" chmod +x ./tests/hsmUnitTestsGLibmm timeout 2m ./tests/hsmUnitTestsGLibmm > ./tests_result_glibmm.log -lcov -c -d . -o ./coverage_glibmm.info +lcov -c -d . -o ./coverage_glibmm.info --ignore-errors mismatch echo "Run Tests (Qt)" chmod +x ./tests/hsmUnitTestsQt timeout 2m ./tests/hsmUnitTestsQt > ./tests_result_qt.log -lcov -c -d . -o ./coverage_qt.info \ No newline at end of file +lcov -c -d . -o ./coverage_qt.info --ignore-errors mismatch \ No newline at end of file From baa8c439096e4bb1a7ae444e7492e374083476be Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:43:19 +0100 Subject: [PATCH 15/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index fd892a5..a743f74 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -45,7 +45,7 @@ jobs: # test_script: "validate.sh" steps: - name: DUMMY - run: echo "Static Code Analises 2" + run: echo "Static Code Analises 3" update_documentation: needs: [verify, test, sca] From bb57ffd25d832c612994b9e5238e786a930d55e4 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:51:16 +0100 Subject: [PATCH 16/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index a743f74..dcaa61a 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -34,7 +34,9 @@ jobs: uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration if: always() && (needs.build.result == 'success') with: - platform: "ubuntu" + platform: 'ubuntu' + install_qt: 'ON' + install_glibmm: 'ON' sca: needs: test From eda8a0992f1befb2cb3c260bc6dee486934b6f54 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 01:59:49 +0100 Subject: [PATCH 17/36] [ci] fixes --- scripts/test/ubuntu/coverage.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/test/ubuntu/coverage.sh b/scripts/test/ubuntu/coverage.sh index 47ddc2c..f54225b 100755 --- a/scripts/test/ubuntu/coverage.sh +++ b/scripts/test/ubuntu/coverage.sh @@ -11,8 +11,8 @@ lcov --add-tracefile ./coverage_std.info \ -a ./coverage_qt.info \ -a ./coverage_glibmm.info \ -o ./coverage.info -lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info -lcov -r ./coverage.info \*/build/\* . -o ./coverage.info -lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info -lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info -lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info \ No newline at end of file +lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info --ignore-errors empty +lcov -r ./coverage.info \*/build/\* . -o ./coverage.info --ignore-errors empty +lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info --ignore-errors empty +lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info --ignore-errors empty +lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info --ignore-errors empty \ No newline at end of file From 14a6e38399ca613f6116974613ccc20c2f6d44cb Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 23:06:51 +0100 Subject: [PATCH 18/36] fixes --- scripts/build/posix/build.sh | 4 ++++ scripts/local/validate.sh | 10 +++++----- scripts/test/ubuntu/coverage.sh | 10 +++++----- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/scripts/build/posix/build.sh b/scripts/build/posix/build.sh index 1776375..827621d 100755 --- a/scripts/build/posix/build.sh +++ b/scripts/build/posix/build.sh @@ -4,4 +4,8 @@ set -euo pipefail build_dir="$1" build_type="$2" +gcc --version +gcov --version +lcov --version + cmake --build "$build_dir" --parallel 2 --config "$build_type" diff --git a/scripts/local/validate.sh b/scripts/local/validate.sh index fd8e321..ad1ee35 100755 --- a/scripts/local/validate.sh +++ b/scripts/local/validate.sh @@ -1,10 +1,10 @@ #!/bin/sh -python3 ./scripts/validate_metadata.py $1 ./ -if [ $? != 0 ] -then - exit 1 -fi +# python3 ./scripts/local/validate_metadata.py $1 ./ +# if [ $? != 0 ] +# then +# exit 1 +# fi mkdir ./build cd ./build diff --git a/scripts/test/ubuntu/coverage.sh b/scripts/test/ubuntu/coverage.sh index f54225b..6762e95 100755 --- a/scripts/test/ubuntu/coverage.sh +++ b/scripts/test/ubuntu/coverage.sh @@ -11,8 +11,8 @@ lcov --add-tracefile ./coverage_std.info \ -a ./coverage_qt.info \ -a ./coverage_glibmm.info \ -o ./coverage.info -lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info --ignore-errors empty -lcov -r ./coverage.info \*/build/\* . -o ./coverage.info --ignore-errors empty -lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info --ignore-errors empty -lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info --ignore-errors empty -lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info --ignore-errors empty \ No newline at end of file +lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +lcov -r ./coverage.info \*/build/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused \ No newline at end of file From 3865ddc33d5125f4f6539b8c705b21028816a968 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 23:09:41 +0100 Subject: [PATCH 19/36] [ci] fixes --- scripts/build/posix/build.sh | 4 ---- scripts/test/ubuntu/test.sh | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build/posix/build.sh b/scripts/build/posix/build.sh index 827621d..1776375 100755 --- a/scripts/build/posix/build.sh +++ b/scripts/build/posix/build.sh @@ -4,8 +4,4 @@ set -euo pipefail build_dir="$1" build_type="$2" -gcc --version -gcov --version -lcov --version - cmake --build "$build_dir" --parallel 2 --config "$build_type" diff --git a/scripts/test/ubuntu/test.sh b/scripts/test/ubuntu/test.sh index dd6d06c..0bcdef4 100755 --- a/scripts/test/ubuntu/test.sh +++ b/scripts/test/ubuntu/test.sh @@ -5,6 +5,10 @@ build_dir="$1" cd $build_dir +gcc --version +gcov --version +lcov --version + echo "Run Tests (STD)" chmod +x ./tests/hsmUnitTestsSTD timeout 2m ./tests/hsmUnitTestsSTD > ./tests_result_std.log From d1776c35de42959d34da6e87b938e82a49c742be Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 23:21:32 +0100 Subject: [PATCH 20/36] [ci] fixes --- scripts/test/ubuntu/test.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/test/ubuntu/test.sh b/scripts/test/ubuntu/test.sh index 0bcdef4..3583548 100755 --- a/scripts/test/ubuntu/test.sh +++ b/scripts/test/ubuntu/test.sh @@ -2,6 +2,7 @@ set -euo pipefail build_dir="$1" +source_dir="$2" cd $build_dir @@ -12,19 +13,19 @@ lcov --version echo "Run Tests (STD)" chmod +x ./tests/hsmUnitTestsSTD timeout 2m ./tests/hsmUnitTestsSTD > ./tests_result_std.log -lcov -c -d . -o ./coverage_std.info --ignore-errors mismatch +lcov -c -d . -b "$source_dir" -o ./coverage_std.info --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch,gcov,source echo "Run Tests (GLib)" chmod +x ./tests/hsmUnitTestsGLib timeout 2m ./tests/hsmUnitTestsGLib > ./tests_result_glib.log -lcov -c -d . -o ./coverage_glib.info --ignore-errors mismatch +lcov -c -d . -b "$source_dir" -o ./coverage_glib.info --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch,gcov,source echo "Run Tests (GLibmm)" chmod +x ./tests/hsmUnitTestsGLibmm timeout 2m ./tests/hsmUnitTestsGLibmm > ./tests_result_glibmm.log -lcov -c -d . -o ./coverage_glibmm.info --ignore-errors mismatch +lcov -c -d . -b "$source_dir" -o ./coverage_glibmm.info --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch,gcov,source echo "Run Tests (Qt)" chmod +x ./tests/hsmUnitTestsQt timeout 2m ./tests/hsmUnitTestsQt > ./tests_result_qt.log -lcov -c -d . -o ./coverage_qt.info --ignore-errors mismatch \ No newline at end of file +lcov -c -d . -b "$source_dir" -o ./coverage_qt.info --rc geninfo_unexecuted_blocks=1 --ignore-errors mismatch,gcov,source \ No newline at end of file From 35b306f5d3b51fb79e773b560bb844217371b697 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Tue, 31 Mar 2026 23:34:56 +0100 Subject: [PATCH 21/36] [ci] fixes --- scripts/test/ubuntu/coverage.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/test/ubuntu/coverage.sh b/scripts/test/ubuntu/coverage.sh index 6762e95..883a867 100755 --- a/scripts/test/ubuntu/coverage.sh +++ b/scripts/test/ubuntu/coverage.sh @@ -11,8 +11,23 @@ lcov --add-tracefile ./coverage_std.info \ -a ./coverage_qt.info \ -a ./coverage_glibmm.info \ -o ./coverage.info -lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -lcov -r ./coverage.info \*/build/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused \ No newline at end of file + +lcov -r ./coverage.info \ + '/usr/include/*' \ + '*/build/*' \ + '*/tests/*' \ + '*/gcc_64/include/QtCore/*' \ + '*/thirdparty/*' \ + -o ./coverage.info + +# lcov -r ./coverage.info '/usr/include/*' -o ./coverage.info +# lcov -r ./coverage.info '*/build/*' -o ./coverage.info +# lcov -r ./coverage.info '*/tests/*' -o ./coverage.info +# lcov -r ./coverage.info '*/gcc_64/include/QtCore/*' -o ./coverage.info +# lcov -r ./coverage.info '*/thirdparty/*' -o ./coverage.info + +# lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +# lcov -r ./coverage.info \*/build/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +# lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +# lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused +# lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused \ No newline at end of file From 9a9b89c177e56bad970764efe017e20560b2814d Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:08:11 +0100 Subject: [PATCH 22/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 14 ++++---------- scripts/test/ubuntu/coverage.sh | 12 ------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index dcaa61a..51cde7d 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -31,23 +31,17 @@ jobs: test: needs: build - uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration if: always() && (needs.build.result == 'success') + uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration with: platform: 'ubuntu' install_qt: 'ON' install_glibmm: 'ON' sca: - needs: test - # uses: igor-krechetov/hsm-github-workflows/.github/workflows/test.yml@feature/hsmcpp-ci-integration - if: always() && (needs.test.result == 'success') - runs-on: ubuntu-latest - # with: - # test_script: "validate.sh" - steps: - - name: DUMMY - run: echo "Static Code Analises 3" + needs: build + if: always() && (needs.build.result == 'success') + uses: igor-krechetov/hsm-github-workflows/.github/workflows/sca.yml@feature/hsmcpp-ci-integration update_documentation: needs: [verify, test, sca] diff --git a/scripts/test/ubuntu/coverage.sh b/scripts/test/ubuntu/coverage.sh index 883a867..dd693f2 100755 --- a/scripts/test/ubuntu/coverage.sh +++ b/scripts/test/ubuntu/coverage.sh @@ -19,15 +19,3 @@ lcov -r ./coverage.info \ '*/gcc_64/include/QtCore/*' \ '*/thirdparty/*' \ -o ./coverage.info - -# lcov -r ./coverage.info '/usr/include/*' -o ./coverage.info -# lcov -r ./coverage.info '*/build/*' -o ./coverage.info -# lcov -r ./coverage.info '*/tests/*' -o ./coverage.info -# lcov -r ./coverage.info '*/gcc_64/include/QtCore/*' -o ./coverage.info -# lcov -r ./coverage.info '*/thirdparty/*' -o ./coverage.info - -# lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -# lcov -r ./coverage.info \*/build/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -# lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -# lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused -# lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info --ignore-errors empty --ignore-errors unused \ No newline at end of file From 665b5616b30bfd0277e7b818f8e4dfde461a8f00 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:16:01 +0100 Subject: [PATCH 23/36] [ci] fixes --- scripts/{local => sca}/coverity/COPYING | 0 scripts/{local => sca}/coverity/coverity-submit.py | 0 scripts/{local => sca}/cppcheck/cppcheck-misra-parsetexts.py | 0 scripts/{local => sca}/cppcheck/cppcheck_review.py | 0 scripts/{local => sca}/cppcheck/cppcheck_suppress.txt | 0 scripts/{local => sca}/cppcheck/misra.json | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename scripts/{local => sca}/coverity/COPYING (100%) rename scripts/{local => sca}/coverity/coverity-submit.py (100%) rename scripts/{local => sca}/cppcheck/cppcheck-misra-parsetexts.py (100%) rename scripts/{local => sca}/cppcheck/cppcheck_review.py (100%) rename scripts/{local => sca}/cppcheck/cppcheck_suppress.txt (100%) rename scripts/{local => sca}/cppcheck/misra.json (100%) diff --git a/scripts/local/coverity/COPYING b/scripts/sca/coverity/COPYING similarity index 100% rename from scripts/local/coverity/COPYING rename to scripts/sca/coverity/COPYING diff --git a/scripts/local/coverity/coverity-submit.py b/scripts/sca/coverity/coverity-submit.py similarity index 100% rename from scripts/local/coverity/coverity-submit.py rename to scripts/sca/coverity/coverity-submit.py diff --git a/scripts/local/cppcheck/cppcheck-misra-parsetexts.py b/scripts/sca/cppcheck/cppcheck-misra-parsetexts.py similarity index 100% rename from scripts/local/cppcheck/cppcheck-misra-parsetexts.py rename to scripts/sca/cppcheck/cppcheck-misra-parsetexts.py diff --git a/scripts/local/cppcheck/cppcheck_review.py b/scripts/sca/cppcheck/cppcheck_review.py similarity index 100% rename from scripts/local/cppcheck/cppcheck_review.py rename to scripts/sca/cppcheck/cppcheck_review.py diff --git a/scripts/local/cppcheck/cppcheck_suppress.txt b/scripts/sca/cppcheck/cppcheck_suppress.txt similarity index 100% rename from scripts/local/cppcheck/cppcheck_suppress.txt rename to scripts/sca/cppcheck/cppcheck_suppress.txt diff --git a/scripts/local/cppcheck/misra.json b/scripts/sca/cppcheck/misra.json similarity index 100% rename from scripts/local/cppcheck/misra.json rename to scripts/sca/cppcheck/misra.json From 63f79cf88da794367314273bd37980d7cc905eda Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:38:53 +0100 Subject: [PATCH 24/36] [ci] fixes --- .github/workflows/tests.yml | 129 ------------------------------------ 1 file changed, 129 deletions(-) delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index d718034..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: "Unit Tests" - -on: - workflow_dispatch: - push: - branches: [ main ] - -env: - BUILD_TYPE: Debug - -jobs: - check-hsmcpp-version: - if: ${{ (github.repository == 'igor-krechetov/hsmcpp') }} - - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.get_version.outputs.commit_version }} - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - - run-tests: - needs: check-hsmcpp-version - # only run when started manually or if there is a version change - if: ${{ (needs.check-hsmcpp-version.outputs.commit_version != '') || (github.event_name == 'workflow_dispatch') }} - runs-on: ubuntu-latest - - env: - artifacts_dir: "${{github.workspace}}/build_artifacts/" - # For debuging Coveralls - # NODE_COVERALLS_DEBUG: 1 - - steps: - - uses: awalsh128/cache-apt-pkgs-action@v1.2.2 - with: - packages: lcov - version: 1.0 - - # checkout repositories - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - ref: ${{ github.ref }} - - # build tests - - name: Build tests - uses: ./.github/workflows/build_helper - with: - src_dir: ${{github.workspace}} - build_dir: ${{github.workspace}}/build - platform: 'posix' - build_examples: 'OFF' - codecoverage: 'ON' - - - name: Run Tests (STD) - run: | - cd ${{github.workspace}}/build/ - timeout 2m ./tests/hsmUnitTestsSTD > ./tests_result_std.log - lcov -c -d . -o ./coverage_std.info - - name: Run Tests (GLib) - run: | - cd ${{github.workspace}}/build/ - timeout 2m ./tests/hsmUnitTestsGLib > ./tests_result_glib.log - lcov -c -d . -o ./coverage_glib.info - - name: Run Tests (GLibmm) - run: | - cd ${{github.workspace}}/build/ - timeout 2m ./tests/hsmUnitTestsGLibmm > ./tests_result_glibmm.log - lcov -c -d . -o ./coverage_glibmm.info - - name: Run Tests (Qt) - run: | - cd ${{github.workspace}}/build/ - timeout 2m ./tests/hsmUnitTestsQt > ./tests_result_qt.log - lcov -c -d . -o ./coverage_qt.info - - - name: Generate Coverage - run: | - cd ${{github.workspace}}/build/ - lcov --add-tracefile ./coverage_std.info \ - -a ./coverage_glib.info \ - -a ./coverage_qt.info \ - -a ./coverage_glibmm.info \ - -o ./coverage.info - lcov -r ./coverage.info /usr/include/\* . -o ./coverage.info - lcov -r ./coverage.info \*/build/\* . -o ./coverage.info - lcov -r ./coverage.info \*/tests/\* . -o ./coverage.info - lcov -r ./coverage.info \*/gcc_64/include/QtCore/\* . -o ./coverage.info - lcov -r ./coverage.info \*/thirdparty/\* . -o ./coverage.info - - - name: Push test coverage to Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: ${{github.workspace}}/build/coverage.info - - # checkout artifacts branch - - uses: actions/checkout@v3 - with: - ref: build_artifacts - path: './build_artifacts' - - # prepare GPG - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} - git_config_global: true - git_user_signingkey: true - git_commit_gpgsign: true - workdir: './build_artifacts' - - # Upload test artifacts - - name: Copy test results to artifacts folder - run: | - cp ${{github.workspace}}/build/tests_result_* ${{ env.artifacts_dir }} - - - name: Push test artifacts to branch - run: | - cd ${{ env.artifacts_dir }} - git add -A ./ - git commit -S -am "[auto] build artifacts for commit ${{ github.sha }}" - git push - From f915f6af6648c5ca3c5174cbf18b2ceb94df5554 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:45:58 +0100 Subject: [PATCH 25/36] [ci] fixes --- .../workflows/{update-doc.yml => update-documentation/action.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{update-doc.yml => update-documentation/action.yml} (100%) diff --git a/.github/workflows/update-doc.yml b/.github/workflows/update-documentation/action.yml similarity index 100% rename from .github/workflows/update-doc.yml rename to .github/workflows/update-documentation/action.yml From 61d46c8079757e9b6c4e1c5ef6f0ad87dfe552c5 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 01:17:58 +0100 Subject: [PATCH 26/36] [ci] fixes --- .github/workflows/sca_misra.yml | 49 --------------------------------- scripts/local/validate.sh | 4 +-- 2 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/sca_misra.yml diff --git a/.github/workflows/sca_misra.yml b/.github/workflows/sca_misra.yml deleted file mode 100644 index d43181a..0000000 --- a/.github/workflows/sca_misra.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: "SCA: MISRA-C-2012" - -# TODO: run only on successfull builds -on: - workflow_dispatch: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -env: - BUILD_TYPE: Release - -jobs: - sca-misra: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Install cppcheck - uses: awalsh128/cache-apt-pkgs-action@v1.2.2 - with: - packages: cppcheck - version: 1.0 - - - name: Build project - uses: ./.github/workflows/build_helper - with: - build_type: ${{env.BUILD_TYPE}} - src_dir: ${{github.workspace}} - build_dir: ${{github.workspace}}/build - platform: 'posix' - build_tests: 'OFF' - build_examples: 'ON' - - - name: Run MISRA check - run: | - cppcheck --addon=${{github.workspace}}/scripts/cppcheck/misra.json \ - --enable=warning,performance,portability,information \ - --inline-suppr \ - --xml \ - --suppressions-list=${{github.workspace}}/scripts/cppcheck/cppcheck_suppress.txt \ - --project=${{github.workspace}}/build/compile_commands.json \ - -DSTL_AVAILABLE -D__GNU__=1 -D__LITTLE_ENDIAN__ -D__GNUC__ 2> ${{github.workspace}}/sca_misra.txt - - - name: Validate cppcheck report - run: | - ${{github.workspace}}/scripts/cppcheck/cppcheck_review.py ${{github.workspace}}/sca_misra.txt diff --git a/scripts/local/validate.sh b/scripts/local/validate.sh index ad1ee35..64dd244 100755 --- a/scripts/local/validate.sh +++ b/scripts/local/validate.sh @@ -67,11 +67,11 @@ then -DHSMBUILD_CLANGTIDY=OFF \ .. - cppcheck --addon=../scripts/cppcheck/misra.json \ + cppcheck --addon=../scripts/sca/cppcheck/misra.json \ --enable=warning,performance,portability,information \ --inline-suppr \ --xml \ - --suppressions-list=../scripts/cppcheck/cppcheck_suppress.txt --project=./compile_commands.json \ + --suppressions-list=../scripts/sca/cppcheck/cppcheck_suppress.txt --project=./compile_commands.json \ -DSTL_AVAILABLE -D__GNU__=1 -D__LITTLE_ENDIAN__ -D__GNUC__ lcov --add-tracefile ./coverage_std.info \ From 7cc2a418473340657365052fbe0134de6fbc3f83 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 01:43:10 +0100 Subject: [PATCH 27/36] [ci] fixes --- scripts/build/posix/configure.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build/posix/configure.sh b/scripts/build/posix/configure.sh index f3d2e9a..c128bbe 100755 --- a/scripts/build/posix/configure.sh +++ b/scripts/build/posix/configure.sh @@ -6,6 +6,7 @@ build_type="$2" cmake_args="$3" src_dir="$4" build_tests="$5" +build_examples="$6" cmake -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ -DHSMBUILD_VERBOSE=OFF \ @@ -14,7 +15,7 @@ cmake -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ -DHSMBUILD_DISPATCHER_GLIBMM=ON \ -DHSMBUILD_DISPATCHER_STD=ON \ -DHSMBUILD_DISPATCHER_QT=ON \ - -DHSMBUILD_EXAMPLES=ON \ + -DHSMBUILD_EXAMPLES="$build_tests" \ -DHSMBUILD_TESTS="$build_tests" \ -DHSMBUILD_CODECOVERAGE=ON \ -DHSMBUILD_DEBUGGING=ON \ From 78e1bdfc71199042176f87b0130bbe9767ece6cb Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 01:50:56 +0100 Subject: [PATCH 28/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 1 + .github/workflows/update-documentation/action.yml | 6 ++++++ scripts/build/posix/configure.sh | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 51cde7d..7724f9e 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -8,6 +8,7 @@ on: pull_request: branches: [ main, dev ] + jobs: verify: if: > diff --git a/.github/workflows/update-documentation/action.yml b/.github/workflows/update-documentation/action.yml index 38e7028..33a5b23 100644 --- a/.github/workflows/update-documentation/action.yml +++ b/.github/workflows/update-documentation/action.yml @@ -8,6 +8,12 @@ on: branches: [main] types: [completed] +inputs: + commit_version: + description: "Commit version" + required: true + type: string + jobs: check-hsmcpp-version: # only run for successful build after push event diff --git a/scripts/build/posix/configure.sh b/scripts/build/posix/configure.sh index c128bbe..ccc6627 100755 --- a/scripts/build/posix/configure.sh +++ b/scripts/build/posix/configure.sh @@ -15,7 +15,7 @@ cmake -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_type" \ -DHSMBUILD_DISPATCHER_GLIBMM=ON \ -DHSMBUILD_DISPATCHER_STD=ON \ -DHSMBUILD_DISPATCHER_QT=ON \ - -DHSMBUILD_EXAMPLES="$build_tests" \ + -DHSMBUILD_EXAMPLES="$build_examples" \ -DHSMBUILD_TESTS="$build_tests" \ -DHSMBUILD_CODECOVERAGE=ON \ -DHSMBUILD_DEBUGGING=ON \ From dc1b82cad74c03b48c6f83b142b1a9a4114fe4f1 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 02:01:25 +0100 Subject: [PATCH 29/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 7724f9e..7b85be9 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -39,25 +39,37 @@ jobs: install_qt: 'ON' install_glibmm: 'ON' - sca: + sast: needs: build if: always() && (needs.build.result == 'success') - uses: igor-krechetov/hsm-github-workflows/.github/workflows/sca.yml@feature/hsmcpp-ci-integration + uses: igor-krechetov/hsm-github-workflows/.github/workflows/sast.yml@feature/hsmcpp-ci-integration + + # -------------------------------------------------------- + # AUTOTAG — only on push to *dev* + # -------------------------------------------------------- + autotag: + needs: [verify, build, test, sast] + if: > + (github.event_name == 'push' && github.ref_name == 'main') && + needs.build.result == 'success' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/autotag.yml@main + with: + commit_version: ${{ needs.verify.outputs.commit_version }} + commit_action: ${{ needs.verify.outputs.commit_action }} + commit_sha: ${{ github.sha }} update_documentation: - needs: [verify, test, sca] + needs: [verify, autotag] if: > - github.event_name == 'push' && - github.ref_name == 'main' && + (github.event_name == 'push' && github.ref_name == 'main') && needs.verify.result == 'success' && - needs.test.result == 'success' + needs.autotag.result == 'success' uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@feature/hsmcpp-ci-integration release: needs: [verify, update_documentation] if: > - github.event_name == 'push' && - github.ref_name == 'main' && + (github.event_name == 'push' && github.ref_name == 'main') && needs.verify.outputs.commit_action == 'r' && needs.verify.result == 'success' && needs.update_documentation.result == 'success' From aefa67a51d6a299f8f06e4638e5b69d2ec511827 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Wed, 1 Apr 2026 02:04:17 +0100 Subject: [PATCH 30/36] [ci] fixes --- .github/workflows/ci_pipeline.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 7b85be9..4cc58d7 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -51,7 +51,9 @@ jobs: needs: [verify, build, test, sast] if: > (github.event_name == 'push' && github.ref_name == 'main') && - needs.build.result == 'success' + needs.build.result == 'success' && + needs.test.result == 'success' && + needs.sast.result == 'success' uses: igor-krechetov/hsm-github-workflows/.github/workflows/autotag.yml@main with: commit_version: ${{ needs.verify.outputs.commit_version }} From 23a4e813dd2077a985499171510b388e0847fd0f Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Thu, 2 Apr 2026 23:25:46 +0100 Subject: [PATCH 31/36] fixes --- .../workflows/update-documentation/action.yml | 37 +++---------------- .../cppcheck-misra-parsetexts.py | 0 .../cppcheck_review.py | 0 .../cppcheck_suppress.txt | 0 .../sca/{cppcheck => del_cppcheck}/misra.json | 0 5 files changed, 5 insertions(+), 32 deletions(-) rename scripts/sca/{cppcheck => del_cppcheck}/cppcheck-misra-parsetexts.py (100%) rename scripts/sca/{cppcheck => del_cppcheck}/cppcheck_review.py (100%) rename scripts/sca/{cppcheck => del_cppcheck}/cppcheck_suppress.txt (100%) rename scripts/sca/{cppcheck => del_cppcheck}/misra.json (100%) diff --git a/.github/workflows/update-documentation/action.yml b/.github/workflows/update-documentation/action.yml index 33a5b23..f74ea1f 100644 --- a/.github/workflows/update-documentation/action.yml +++ b/.github/workflows/update-documentation/action.yml @@ -1,13 +1,5 @@ name: "Update Documentation" -on: - workflow_dispatch: - # Start only after Build was finished - workflow_run: - workflows: [Build] - branches: [main] - types: [completed] - inputs: commit_version: description: "Commit version" @@ -15,36 +7,17 @@ inputs: type: string jobs: - check-hsmcpp-version: - # only run for successful build after push event - # avoid running this action on forks - if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && ((github.event.workflow_run == null) || ((github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.event == 'push'))) }} - - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.get_version.outputs.commit_version }} - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - update-doc-src: - runs-on: ubuntu-latest - needs: check-hsmcpp-version - # only run for commits which have version defined - if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} + if: ${{ inputs.commit_version != '' }} + runs-on: ubuntu-latest env: target_dir: './hsmcpp_doc' steps: # checkout docs repository - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'igor-krechetov/hsmcpp-doc' token: ${{ secrets.HSMCPP_BOT_TOKEN }} @@ -72,6 +45,6 @@ jobs: - name: Update documentation run: | cd ${{ env.target_dir }} - echo "Found new hsmcpp version '${{ needs.check-hsmcpp-version.outputs.commit_version }}'" - git commit -S -am "[auto] hsmcpp library updated to ${{ needs.check-hsmcpp-version.outputs.commit_version }}" + echo "Found new hsmcpp version '${{ inputs.commit_version }}'" + git commit -S -am "[auto] hsmcpp library updated to ${{ inputs.commit_version }}" git push diff --git a/scripts/sca/cppcheck/cppcheck-misra-parsetexts.py b/scripts/sca/del_cppcheck/cppcheck-misra-parsetexts.py similarity index 100% rename from scripts/sca/cppcheck/cppcheck-misra-parsetexts.py rename to scripts/sca/del_cppcheck/cppcheck-misra-parsetexts.py diff --git a/scripts/sca/cppcheck/cppcheck_review.py b/scripts/sca/del_cppcheck/cppcheck_review.py similarity index 100% rename from scripts/sca/cppcheck/cppcheck_review.py rename to scripts/sca/del_cppcheck/cppcheck_review.py diff --git a/scripts/sca/cppcheck/cppcheck_suppress.txt b/scripts/sca/del_cppcheck/cppcheck_suppress.txt similarity index 100% rename from scripts/sca/cppcheck/cppcheck_suppress.txt rename to scripts/sca/del_cppcheck/cppcheck_suppress.txt diff --git a/scripts/sca/cppcheck/misra.json b/scripts/sca/del_cppcheck/misra.json similarity index 100% rename from scripts/sca/cppcheck/misra.json rename to scripts/sca/del_cppcheck/misra.json From 23a880b8541eded432629d9e3b4bbc91d800fd9b Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Thu, 2 Apr 2026 23:43:53 +0100 Subject: [PATCH 32/36] fixes --- .../del_cppcheck/cppcheck-misra-parsetexts.py | 123 ------------------ scripts/sca/del_cppcheck/cppcheck_review.py | 27 ---- .../sca/del_cppcheck/cppcheck_suppress.txt | 8 -- scripts/sca/del_cppcheck/misra.json | 9 -- 4 files changed, 167 deletions(-) delete mode 100644 scripts/sca/del_cppcheck/cppcheck-misra-parsetexts.py delete mode 100755 scripts/sca/del_cppcheck/cppcheck_review.py delete mode 100644 scripts/sca/del_cppcheck/cppcheck_suppress.txt delete mode 100644 scripts/sca/del_cppcheck/misra.json diff --git a/scripts/sca/del_cppcheck/cppcheck-misra-parsetexts.py b/scripts/sca/del_cppcheck/cppcheck-misra-parsetexts.py deleted file mode 100644 index 1e49218..0000000 --- a/scripts/sca/del_cppcheck/cppcheck-misra-parsetexts.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/python3 -# Author: https://github.com/ChisholmKyle/SublimeLinter-cppcheck-misra - -"""Generate MISRA C 2012 rule texts from pdf. - -Arguments: - filename -- text file from parsed MISRA pdf file - -Example: - python3 cppcheck-misra-parsetexts.py "/path/to/MISRA_C_2012.pdf" - -""" - -import os -import re -import sys -import json -import tempfile -import subprocess - -# rules -_appendixa_regex = re.compile(r'Appendix A Summary of guidelines\n') -_appendixb_regex = re.compile(r'Appendix B Guideline attributes\n') -_rule_regex = re.compile( - r'(Rule|Dir).(\d+)\.(\d+)\n\n(Advisory|Required|Mandatory)\n\n([^\n]+)\n') -_line_regex = re.compile(r'([^\n]+)\n') - - -def misra_dict_to_text(misra_dict): - """Convert dict to string readable by cppcheck's misra.py addon.""" - misra_str = '' - for num1 in misra_dict: - for num2 in misra_dict[num1]: - misra_str += '\n{} {}.{} {}\n'.format( - misra_dict[num1][num2]['type'], num1, num2, misra_dict[num1][num2]['category']) - misra_str += '{}\n'.format(misra_dict[num1][num2]['text']) - return misra_str - - -def parse_misra_xpdf_output(misra_file): - """Extract misra rules texts from xPDF output.""" - misra_dict = {} - - with open(misra_file, 'r', encoding="utf-8") as fp: - fp_text = fp.read() - - # end of appendix A - appb_end_res = _appendixb_regex.search(fp_text) - last_index = appb_end_res.regs[0][0] - - appres = _appendixa_regex.search(fp_text) - if appres: - start_index = appres.regs[0][1] - res = _rule_regex.search(fp_text, start_index) - while res: - start_index = res.regs[0][1] - ruletype = res.group(1) - rulenum1 = res.group(2) - rulenum2 = res.group(3) - category = res.group(4) - ruletext = res.group(5).strip() - statereadingrule = True - while statereadingrule: - lineres = _line_regex.match(fp_text, start_index) - if lineres: - start_index = lineres.regs[0][1] - stripped_line = lineres.group(1).strip() - ruletext += ' ' + stripped_line - else: - # empty line, stop reading text and save to dict - if rulenum1 not in misra_dict: - misra_dict[rulenum1] = {} - misra_dict[rulenum1][rulenum2] = { - 'type': ruletype, - 'category': category, - 'text': ruletext - } - statereadingrule = False - res = _rule_regex.search(fp_text, start_index) - if res and (last_index < res.regs[0][0]): - break - fp.close() - - return misra_dict - - -def misra_parse_pdf(misra_pdf): - """Extract misra rules texts from Misra-C-2012 pdf.""" - - if not os.path.isfile(misra_pdf): - print('Fatal error: PDF file is not found: ' + misra_pdf) - sys.exit(1) - f = tempfile.NamedTemporaryFile(delete=False) - f.close() - subprocess.call([ - 'pdftotext', - '-enc', 'UTF-8', - '-eol', 'unix', - misra_pdf, - f.name - ]) - misra_dict = parse_misra_xpdf_output(f.name) - os.remove(f.name) - - return misra_dict - - -misra_pdf_filename = sys.argv[1] - -misra_dict = misra_parse_pdf(misra_pdf_filename) -misra_text = 'Appendix A Summary of guidelines\n\n' + \ - misra_dict_to_text(misra_dict) - -misra_json_fout = os.path.splitext(misra_pdf_filename)[0] + '_Rules.json' -misra_text_fout = os.path.splitext(misra_pdf_filename)[0] + '_Rules.txt' - -with open(misra_json_fout, 'w', encoding='utf-8') as fp: - fp.write(json.dumps(misra_dict, indent=4)) -print('Done creating "' + misra_json_fout + '"') - -with open(misra_text_fout, 'w', encoding='utf-8') as fp: - fp.write(misra_text) -print('Done creating "' + misra_text_fout + '"') \ No newline at end of file diff --git a/scripts/sca/del_cppcheck/cppcheck_review.py b/scripts/sca/del_cppcheck/cppcheck_review.py deleted file mode 100755 index 867a722..0000000 --- a/scripts/sca/del_cppcheck/cppcheck_review.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python3 -import sys -import xml.etree.ElementTree as ET - - -if __name__ == "__main__": - REPORT_FILE = sys.argv[1].strip(" \n\r[]") - print(f"{REPORT_FILE=:}") - tree = ET.parse(REPORT_FILE) - - if tree: - root = tree.getroot() - errors = root.find("errors") - issuesCount = 0 - - for currentError in errors.iter("error"): - # NOTE: there is a crash in misra.py. fixed in 2.8+ (b444c00) - # misra plugin couldn't handle passing string literal to a function with variadic arguments - if ("id" not in currentError.attrib) or (currentError.attrib["id"] != "internalError"): - issuesCount += 1 - ET.dump(currentError) - - if issuesCount > 0: - print("cppcheck: FOUND ISSUES") - exit(1) - else: - print("cppcheck: no issues found") diff --git a/scripts/sca/del_cppcheck/cppcheck_suppress.txt b/scripts/sca/del_cppcheck/cppcheck_suppress.txt deleted file mode 100644 index 2125c65..0000000 --- a/scripts/sca/del_cppcheck/cppcheck_suppress.txt +++ /dev/null @@ -1,8 +0,0 @@ -*:/usr/include/* -*:gen/ -*:*/glib-2.0/include/* -misra-c2012-17.8:*/include/hsmcpp/hsm.hpp -misra-c2012-17.8:*/src/HsmImpl.hpp -misra-c2012-17.8:*/src/HsmImplTypes.hpp -preprocessorErrorDirective:* -missingIncludeSystem:* \ No newline at end of file diff --git a/scripts/sca/del_cppcheck/misra.json b/scripts/sca/del_cppcheck/misra.json deleted file mode 100644 index 978e510..0000000 --- a/scripts/sca/del_cppcheck/misra.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "script": "misra.py", - "args": [ - "--severity=information", - "--suppress-rules=12.3,8.2,8.10,2.7,20.5,13.4", - "--no-summary" - ], - "args_disable": "--rule-texts=../scripts/cppcheck/MISRA-C_2012_Rules.txt" -} \ No newline at end of file From ab09e1976fa71b0635006aa2b0b287bf60ed2109 Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Fri, 3 Apr 2026 00:59:10 +0100 Subject: [PATCH 33/36] fixes --- .github/workflows/auto_tag.yml | 55 -------- .github/workflows/build_helper/action.yml | 132 ------------------ .github/workflows/ci_pipeline.yml | 24 +++- .github/workflows/deploy-arduinoide.yml | 40 ------ .github/workflows/deploy-platformio.yml | 50 ------- .../workflows/get-commit-version/action.yml | 54 ------- .../workflows/install_platformio/action.yml | 25 ---- .github/workflows/sca_codeql.yml | 72 ---------- .github/workflows/sca_coverity.yml | 98 ------------- .../workflows/update-documentation/action.yml | 50 ------- scripts/sca/coverity/COPYING | 55 -------- scripts/sca/coverity/coverity-submit.py | 131 ----------------- 12 files changed, 22 insertions(+), 764 deletions(-) delete mode 100644 .github/workflows/auto_tag.yml delete mode 100644 .github/workflows/build_helper/action.yml delete mode 100644 .github/workflows/deploy-arduinoide.yml delete mode 100644 .github/workflows/deploy-platformio.yml delete mode 100644 .github/workflows/get-commit-version/action.yml delete mode 100644 .github/workflows/install_platformio/action.yml delete mode 100644 .github/workflows/sca_codeql.yml delete mode 100644 .github/workflows/sca_coverity.yml delete mode 100644 .github/workflows/update-documentation/action.yml delete mode 100644 scripts/sca/coverity/COPYING delete mode 100755 scripts/sca/coverity/coverity-submit.py diff --git a/.github/workflows/auto_tag.yml b/.github/workflows/auto_tag.yml deleted file mode 100644 index cb7f194..0000000 --- a/.github/workflows/auto_tag.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: "Create Tags" - -on: - # Start only after Build was finished - workflow_run: - workflows: [Build] - branches: [main] - types: [completed] - -jobs: - check-hsmcpp-version: - # only run for successful build after push event - # avoid running this action on forks - if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && ((github.event.workflow_run == null) || ((github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.event == 'push'))) }} - - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.get_version.outputs.commit_version }} - commit_action: ${{ steps.get_version.outputs.commit_action }} - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - - create-release-tag: - needs: check-hsmcpp-version - if: ${{ (needs.check-hsmcpp-version.outputs.commit_version != '') && (needs.check-hsmcpp-version.outputs.commit_action == 'r') }} - - runs-on: ubuntu-latest - - steps: - # need to checkout current repo because workflow is not related with push event - - uses: actions/checkout@v3 - - # prepare gpg for commit signing - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} - git_config_global: true - git_user_signingkey: true - git_commit_gpgsign: true - workdir: ${{github.workspace}} - - - name: Commit new files - run: | - git tag ${{needs.check-hsmcpp-version.outputs.commit_version}} ${{ github.event.workflow_run.head_sha }} - git push origin ${{needs.check-hsmcpp-version.outputs.commit_version}} - diff --git a/.github/workflows/build_helper/action.yml b/.github/workflows/build_helper/action.yml deleted file mode 100644 index 17c6aaf..0000000 --- a/.github/workflows/build_helper/action.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: "Build Helper" - -inputs: - # values: posix, windows - platform: - required: true - type: string - default: 'posix' - src_dir: - required: true - type: string - build_dir: - required: true - type: string - # values: Release, Debug - build_type: - required: false - type: string - default: 'Release' - build_glib: - required: false - type: string - default: 'ON' - build_glibmm: - required: false - type: string - default: 'ON' - build_qt: - required: false - type: string - default: 'ON' - build_std: - required: false - type: string - default: 'ON' - build_tests: - required: false - type: string - default: 'ON' - build_examples: - required: false - type: string - default: 'ON' - codecoverage: - required: false - type: string - default: 'OFF' - only_configure: - required: false - type: boolean - default: false - -runs: - using: "composite" - - steps: - # --------------------------------- Ubuntu build --------------------------------- - - uses: awalsh128/cache-apt-pkgs-action@v1.2.2 - if: ${{ (inputs.platform == 'posix') && ((inputs.build_glib == 'ON') || (inputs.build_glibmm == 'ON')) }} - with: - packages: libglibmm-2.4-dev - version: 1.0 - - - name: Install Qt (Ubuntu) - if: ${{ (inputs.platform == 'posix') && (inputs.build_qt == 'ON') }} - uses: jurplel/install-qt-action@v3 - with: - version: '6.4.*' - host: 'linux' - target: 'desktop' - arch: 'gcc_64' - modules: '' - cache: 'true' - cache-key-prefix: 'install-qt-action-linux' - set-env: 'true' - - - name: Configure CMake (Ubuntu) - if: ${{ inputs.platform == 'posix' }} - shell: bash - run: | - cmake -B ${{ inputs.build_dir }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ - -DHSMBUILD_VERBOSE=OFF \ - -DHSMBUILD_PLATFORM=${{ inputs.platform }} \ - -DHSMBUILD_DISPATCHER_GLIB=${{ inputs.build_glib }} \ - -DHSMBUILD_DISPATCHER_GLIBMM=${{ inputs.build_glibmm }} \ - -DHSMBUILD_DISPATCHER_STD=${{ inputs.build_std }} \ - -DHSMBUILD_DISPATCHER_QT=${{ inputs.build_qt }} \ - -DHSMBUILD_TESTS=${{ inputs.build_tests }} \ - -DHSMBUILD_EXAMPLES=${{ inputs.build_examples }} \ - -DHSMBUILD_CODECOVERAGE=${{ inputs.codecoverage }} \ - -DHSMBUILD_DEBUGGING=ON \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - ${{ inputs.src_dir }} - - - name: Build (Ubuntu) - if: ${{ (inputs.platform == 'posix') && (inputs.only_configure == 'false') }} - shell: bash - run: cmake --build ${{ inputs.build_dir }} --parallel 2 --config ${{ inputs.build_type }} - - # --------------------------------- Windows build --------------------------------- - - name: Install Qt (Windows) - if: ${{ (inputs.platform == 'windows') && (inputs.build_qt == 'ON') }} - uses: jurplel/install-qt-action@v3 - with: - version: '6.4.*' - host: 'windows' - target: 'desktop' - arch: 'win64_msvc2019_64' - modules: '' - cache: 'true' - cache-key-prefix: 'install-qt-action-win32' - set-env: 'true' - - - name: Configure CMake (Windows) - if: ${{ inputs.platform == 'windows' }} - shell: cmd - run: cmake -B ${{github.workspace}}\build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ^ - -DHSMBUILD_VERBOSE=OFF ^ - -DHSMBUILD_PLATFORM=${{ inputs.platform }} ^ - -DHSMBUILD_DISPATCHER_GLIB=OFF ^ - -DHSMBUILD_DISPATCHER_GLIBMM=OFF ^ - -DHSMBUILD_DISPATCHER_STD=ON ^ - -DHSMBUILD_DISPATCHER_QT=ON ^ - -DHSMBUILD_TESTS=ON ^ - -DHSMBUILD_EXAMPLES=ON ^ - -DHSMBUILD_DEBUGGING=ON ^ - ${{ inputs.src_dir }} - - - name: Build (Windows) - if: ${{ (inputs.platform == 'windows') && (inputs.only_configure == 'false') }} - shell: cmd - run: cmake --build ${{github.workspace}}\build --parallel 2 --config ${{env.BUILD_TYPE}} \ No newline at end of file diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 4cc58d7..1fe761f 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -24,8 +24,8 @@ jobs: (needs.verify.result == 'success' || needs.verify.result == 'skipped') with: build_type: Release - # platforms: "posix,windows,platformio,arduinoide,freertos" - platforms: "posix" + platforms: "posix,windows,platformio,arduinoide,freertos" + # platforms: "posix" install_qt: 'ON' install_glibmm: 'ON' build_tests: 'ON' @@ -67,6 +67,13 @@ jobs: needs.verify.result == 'success' && needs.autotag.result == 'success' uses: igor-krechetov/hsm-github-workflows/.github/workflows/update-docs.yml@feature/hsmcpp-ci-integration + with: + library_name: hsmcpp + commit_version: ${{ needs.verify.outputs.commit_version }} + secrets: + HSMCPP_BOT_TOKEN: ${{ secrets.HSMCPP_BOT_TOKEN }} + BOT_GPG_PRIVATE_KEY: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + BOT_GPG_PASSPHRASE: ${{ secrets.BOT_GPG_PASSPHRASE }} release: needs: [verify, update_documentation] @@ -85,3 +92,16 @@ jobs: - Built on Ubuntu and Windows - Includes binaries for both platforms + + deploy: + needs: [verify, release] + if: > + (github.event_name == 'push' && github.ref_name == 'main') && + needs.release.result == 'success' + uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@feature/hsmcpp-ci-integration + with: + deploy_target: "platformio,arduinoide" + commit_sha: ${{ needs.check-hsmcpp-version.outputs.commit_sha }} + commit_version: ${{ needs.check-hsmcpp-version.outputs.commit_version }} + target_repo: igor-krechetov/hsmcpp + platformio_target_branch: platformio_library diff --git a/.github/workflows/deploy-arduinoide.yml b/.github/workflows/deploy-arduinoide.yml deleted file mode 100644 index 21754a9..0000000 --- a/.github/workflows/deploy-arduinoide.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: "Deploy ArduinoIDE library" - -on: - workflow_dispatch: - workflow_run: - workflows: [Build] - branches: [main] - types: [completed] - -jobs: - check-hsmcpp-version: - if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && ((github.event.workflow_run == null) || ((github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.event == 'push'))) }} - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.get_version.outputs.commit_version }} - commit_action: ${{ steps.get_version.outputs.commit_action }} - commit_sha: ${{ steps.commit_sha.outputs.value }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - - id: commit_sha - run: echo "value=${{ github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT" - - deploy: - needs: check-hsmcpp-version - if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} - uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@feature/hsmcpp-ci-integration - with: - deploy_target: arduinoide - commit_sha: ${{ needs.check-hsmcpp-version.outputs.commit_sha }} - commit_version: ${{ needs.check-hsmcpp-version.outputs.commit_version }} - commit_action: ${{ needs.check-hsmcpp-version.outputs.commit_action }} - target_repo: igor-krechetov/hsmcpp-arduinoide - target_branch: main - publish_registry: false - secrets: inherit diff --git a/.github/workflows/deploy-platformio.yml b/.github/workflows/deploy-platformio.yml deleted file mode 100644 index 34defcb..0000000 --- a/.github/workflows/deploy-platformio.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Deploy PlatformIO library" - -on: - workflow_dispatch: - inputs: - version: - type: string - workflow_run: - workflows: [Build] - branches: [main] - types: [completed] - -jobs: - check-hsmcpp-version: - if: ${{ (github.repository == 'igor-krechetov/hsmcpp') && ((github.event.workflow_run == null) || ((github.event.workflow_run.conclusion == 'success') && (github.event.workflow_run.event == 'push'))) }} - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.finalize_version.outputs.commit_version }} - commit_action: ${{ steps.get_version.outputs.commit_action }} - commit_sha: ${{ steps.commit_sha.outputs.value }} - steps: - - uses: actions/checkout@v4 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - - id: commit_sha - run: echo "value=${{ github.event.workflow_run.head_sha || github.sha }}" >> "$GITHUB_OUTPUT" - - id: finalize_version - run: | - if [ -n "${{ github.event.inputs.version }}" ]; then - echo "commit_version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" - else - echo "commit_version=${{ steps.get_version.outputs.commit_version }}" >> "$GITHUB_OUTPUT" - fi - - deploy: - needs: check-hsmcpp-version - uses: igor-krechetov/hsm-github-workflows/.github/workflows/deploy.yml@feature/hsmcpp-ci-integration - if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} - with: - deploy_target: platformio - commit_sha: ${{ needs.check-hsmcpp-version.outputs.commit_sha }} - commit_version: ${{ needs.check-hsmcpp-version.outputs.commit_version }} - commit_action: ${{ needs.check-hsmcpp-version.outputs.commit_action }} - target_repo: igor-krechetov/hsmcpp - target_branch: platformio_library - publish_registry: ${{ (needs.check-hsmcpp-version.outputs.commit_action == 'r') || (github.event.inputs.version != '') }} - secrets: inherit diff --git a/.github/workflows/get-commit-version/action.yml b/.github/workflows/get-commit-version/action.yml deleted file mode 100644 index 3b58bd2..0000000 --- a/.github/workflows/get-commit-version/action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Get commit version - -inputs: - repo_dir: - required: true - type: string - commit_sha: - required: false - type: string -outputs: - commit_version: - description: "Version extracted from commit (head if commit_sha was not provided or is empty)" - value: ${{ format('{0}{1}', steps.read_head_version.outputs.head_version, steps.read_commit_version.outputs.commit_version) }} - commit_tag: - description: "Tag extracted from commit (head if commit_sha was not provided or is empty)" - value: ${{ format('{0}{1}', steps.read_head_version.outputs.head_tag, steps.read_commit_version.outputs.commit_tag) }} - commit_action: - description: "Action extracted from commit (head if commit_sha was not provided or is empty)" - value: ${{ format('{0}{1}', steps.read_head_version.outputs.head_action, steps.read_commit_version.outputs.commit_action) }} - -runs: - using: "composite" - - steps: - - id: read_head_version - shell: bash - if: ${{ inputs.commit_sha == '' }} - run: | - cd "${{ inputs.repo_dir }}" - git log -1 --pretty=format:"%s %d" - echo "head_version=$(git log -1 --pretty=format:"%s" | grep -Po '\[\K([\d.]+)\]' | grep -Po '[^\]]+')" >> $GITHUB_OUTPUT - echo "head_tag=$(git log -1 --pretty=format:"%d" | grep -Po 'tag: \K\d+\.\d+\.\d+')" >> $GITHUB_OUTPUT - echo "head_action=$(git log -1 --pretty=format:"%s" | grep -Po '\[([\d.]+)\]\[\K[\w]+\]' | grep -Po '[^\]]+')" >> $GITHUB_OUTPUT - - if: ${{ inputs.commit_sha == '' }} - shell: bash - run: | - echo "VERSION: '${{ steps.read_head_version.outputs.head_version }}'" - echo "TAG: '${{ steps.read_head_version.outputs.head_tag }}'" - echo "ACTION: '${{ steps.read_head_version.outputs.head_action }}'" - - - id: read_commit_version - shell: bash - if: ${{ inputs.commit_sha != '' }} - run: | - cd "${{ inputs.repo_dir }}" - echo "commit_version=$(git log -1 ${{ inputs.commit_sha }} --pretty=format:"%s" | grep -Po '\[\K([\d.]+)\]' | grep -Po '[^\]]+')" >> $GITHUB_OUTPUT - echo "commit_tag=$(git log -1 ${{ inputs.commit_sha }} --pretty=format:"%d" | grep -Po 'tag: \K\d+\.\d+\.\d+')" >> $GITHUB_OUTPUT - echo "commit_action=$(git log -1 ${{ inputs.commit_sha }} --pretty=format:"%s" | grep -Po '\[([\d.]+)\]\[\K[\w]+\]' | grep -Po '[^\]]+')" >> $GITHUB_OUTPUT - - if: ${{ inputs.commit_sha != '' }} - shell: bash - run: | - echo "VERSION: '${{ steps.read_commit_version.outputs.commit_version }}'" - echo "TAG: '${{ steps.read_commit_version.outputs.commit_tag }}'" - echo "ACTION: '${{ steps.read_commit_version.outputs.commit_action }}'" diff --git a/.github/workflows/install_platformio/action.yml b/.github/workflows/install_platformio/action.yml deleted file mode 100644 index ec50751..0000000 --- a/.github/workflows/install_platformio/action.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: "Install PlatformIO" - -runs: - using: "composite" - - steps: - - name: Cache pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Cache PlatformIO - uses: actions/cache@v3 - with: - path: ~/.platformio - key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} - - name: Set up Python - uses: actions/setup-python@v4 - - name: Install PlatformIO - shell: bash - run: | - python -m pip install --upgrade pip - pip install --upgrade platformio diff --git a/.github/workflows/sca_codeql.yml b/.github/workflows/sca_codeql.yml deleted file mode 100644 index c0c8786..0000000 --- a/.github/workflows/sca_codeql.yml +++ /dev/null @@ -1,72 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "SCA: CodeQL" - -# TODO: run only on successfull builds -on: - workflow_dispatch: - push: - branches: [ main, dev ] - pull_request: - branches: [ main, dev ] - -env: - BUILD_TYPE: Release - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: cpp - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - name: Build project - uses: ./.github/workflows/build_helper - with: - src_dir: ${{github.workspace}} - build_dir: ${{github.workspace}}/build - platform: 'posix' - build_tests: 'OFF' - build_examples: 'ON' - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:cpp" diff --git a/.github/workflows/sca_coverity.yml b/.github/workflows/sca_coverity.yml deleted file mode 100644 index 60ea4a7..0000000 --- a/.github/workflows/sca_coverity.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: "SCA: Coverity" - -on: - workflow_dispatch: - inputs: - version: - type: string - push: - branches: [ main ] - -env: - BUILD_TYPE: Release - -jobs: - check-hsmcpp-version: - runs-on: ubuntu-latest - outputs: - commit_version: ${{ steps.finalize_version.outputs.commit_version }} - - steps: - - uses: actions/checkout@v3 - - uses: ./.github/workflows/get-commit-version - id: get_version - with: - repo_dir: ${{ env.GITHUB_WORKSPACE }} - commit_sha: ${{ github.event.workflow_run.head_sha }} - - - name: Check user input - if: ${{ github.event.inputs.version != '' }}" - id: check_user_input - run: | - echo "TEMP_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV - - - name: Check commit version - id: check_commit - if: ${{ github.event.inputs.version == '' }} - run: | - echo "TEMP_VERSION=${{ steps.get_version.outputs.commit_version }}" >> $GITHUB_ENV - - - name: Final - id: finalize_version - run: | - echo "commit_version=$TEMP_VERSION" >> $GITHUB_OUTPUT - - sca-coverity: - needs: check-hsmcpp-version - # only run when started manually or if there is a version change - if: ${{ needs.check-hsmcpp-version.outputs.commit_version != '' }} - runs-on: ubuntu-latest - - env: - COVERITY_NAME: 'Igor Krechetov' - COVERITY_VERSION: 'cov-analysis-linux64-2023.6.2' - COVERITY_PROJECT_DESCRIPTION: 'C++ library for hierarchical state machines / finite state machines. Provides a code-free visual approach for defining state machine logic using GUI editors with automatic code and diagram generation. Check out https://hsmcpp.readthedocs.io for detailed documentation.' - COVERITY_PROJECT: 'igor-krechetov/hsmcpp' - COVERITY_PROJECT_URL: 'igor-krechetov%2Fhsmcpp' - BUILDCMD: 'cmake --build ./build --parallel 2 --config Release' - - steps: - - uses: actions/checkout@v3 - with: - submodules: 'recursive' - - - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: 11 - - name: Cache Coverity - id: cache-coverity - uses: actions/cache@v3 - with: - path: ~/coverity - key: coverity-tool - restore-keys: coverity-tool - - - name: Coverity Download & Install - if: ${{ steps.cache-coverity.outputs.cache-hit != 'true' }} - run: | - mkdir -p ~/download - mkdir -p ~/coverity - wget https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_TOKEN }}&project=$COVERITY_PROJECT_URL" -O ~/download/coverity_tool.tgz - cd ~/coverity - tar -xvzf ~/download/coverity_tool.tgz - - - name: Configure project build - uses: ./.github/workflows/build_helper - with: - src_dir: ${{github.workspace}} - build_dir: ${{github.workspace}}/build - platform: 'posix' - build_tests: 'OFF' - only_configure: true - - - name: Coverity Full Scan - run: | - export PATH=$PATH:~/coverity/$COVERITY_VERSION/bin/ - cov-configure --config ./coverity.xml --template --compiler c++ --comptype gcc --xml-option=skip_file:"/usr/include/.*" --xml-option=skip_file:".*/build/hsmcpp_qt_autogen/.*" --xml-option=skip_file:".*/build/include/hsmcpp/.*" --xml-option=skip_file:".*/thirdparty/.*" - python3 ./scripts/coverity/coverity-submit.py -u "$COVERITY_NAME" -b ${{ needs.check-hsmcpp-version.outputs.commit_version }} -config ./coverity.xml -t "$COVERITY_PROJECT_DESCRIPTION" -p "$COVERITY_PROJECT" -pu "$COVERITY_PROJECT_URL" -token "${{ secrets.COVERITY_TOKEN }}" -email "${{ secrets.COVERITY_EMAIL }}" -build "$BUILDCMD" diff --git a/.github/workflows/update-documentation/action.yml b/.github/workflows/update-documentation/action.yml deleted file mode 100644 index f74ea1f..0000000 --- a/.github/workflows/update-documentation/action.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Update Documentation" - -inputs: - commit_version: - description: "Commit version" - required: true - type: string - -jobs: - update-doc-src: - # only run for commits which have version defined - if: ${{ inputs.commit_version != '' }} - runs-on: ubuntu-latest - - env: - target_dir: './hsmcpp_doc' - - steps: - # checkout docs repository - - uses: actions/checkout@v4 - with: - repository: 'igor-krechetov/hsmcpp-doc' - token: ${{ secrets.HSMCPP_BOT_TOKEN }} - ref: main - submodules: 'recursive' - path: ${{ env.target_dir }} - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }} - git_config_global: true - git_user_signingkey: true - git_commit_gpgsign: true - workdir: ${{ env.target_dir }} - - - name: Update to latest hsmcpp - run: | - cd ${{ env.target_dir }} - git submodule foreach git fetch --all - git submodule foreach git reset --hard origin/main - git add ./source/hsmcpp - - # Update documentation only if commit had version defined - - name: Update documentation - run: | - cd ${{ env.target_dir }} - echo "Found new hsmcpp version '${{ inputs.commit_version }}'" - git commit -S -am "[auto] hsmcpp library updated to ${{ inputs.commit_version }}" - git push diff --git a/scripts/sca/coverity/COPYING b/scripts/sca/coverity/COPYING deleted file mode 100644 index bdaa98f..0000000 --- a/scripts/sca/coverity/COPYING +++ /dev/null @@ -1,55 +0,0 @@ - BSD LICENSE - -Copyright (c) 2015, Eric S. Raymond -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - BSD LICENSE - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -Neither name of the this project nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/scripts/sca/coverity/coverity-submit.py b/scripts/sca/coverity/coverity-submit.py deleted file mode 100755 index f516530..0000000 --- a/scripts/sca/coverity/coverity-submit.py +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env python -# -# coverity-submit - submit project to Coverity for scanning -# -# By Eric S. Raymond, May 2012. -# SPDX-License-Identifier: BSD-2-Clause -# -# Version 2.0 by Igor Krechetov, Feb 2023 -# Improved to be used inside GitHub actions. -# -# This code runs under both Python 2 and Python 3. Preserve this property! -from __future__ import print_function - -import os, pwd, sys, stat -import tempfile, shutil, datetime, subprocess -import argparse - -version = "2.0" - - -def do_or_die(cmd): - if verbose: - print(cmd) - if not dryrun: - if os.system(cmd) != 0: - sys.stderr.write("Command failed.\n") - sys.exit(1) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='coverity-submit - submit project to Coverity for scanning') - - parser.add_argument('-user', '-u', type=str, required=True, help='build version') - parser.add_argument('-build_version', '-b', type=str, required=True, help='build version') - parser.add_argument('-dryrun', action="store_true", required=False, default=False, help='dry run of all commands') - parser.add_argument('-description', '-t', type=str, required=True, help='project description') - parser.add_argument('-verbose', '-v', action="store_true", required=False, default=False, help='verbose execution') - parser.add_argument('-project', '-p', type=str, required=True, help='project name') - parser.add_argument('-project_url', '-pu', type=str, required=False, help='project url name') - parser.add_argument('-token', type=str, required=True, help='Coverity token') - parser.add_argument('-email', type=str, required=True, help='user email') - parser.add_argument('-prebuild', type=str, required=False, help='prebuild command') - parser.add_argument('-build', type=str, required=True, help='build command') - parser.add_argument('-postbuild', type=str, required=False, help='post-build command') - parser.add_argument('-config', type=str, required=True, help='coverity config') - - args = parser.parse_args() - name = args.user - build_version = args.build_version - dryrun = args.dryrun - description = args.description - verbose = args.verbose - - covname = args.project - covname_url = args.project_url - if covname_url is None: - covname_url = covname - token = args.token - email = args.email - prebuild = args.prebuild - build = args.build - postbuild = args.postbuild - cov_config = args.config - - # Announce self - print("coverity-submit version %s..." % version) - - # Work around a known bug in environment restoration under cov-build. - # Without this, xmlto won't run. - os.environ["XML_CATALOG_FILES"] = '/etc/xml/catalog' - - # Build local stuff - print("Rebuilding and scanning...") - if prebuild: - do_or_die(prebuild) - do_or_die("rm -fr cov-int && cov-build --config " + cov_config + " --dir cov-int " + build) - if postbuild: - do_or_die(postbuild) - - # Create the tarball - if verbose: - print("Bundling up required metadata...") - - readme = """\ - Name: %(name)s - Email: %(email)s - Project: %(covname)s - Build-Version: %(build_version)s - Description: %(description)s - Submitted-by: coverity-submit %(version)s - """ % globals() - - if verbose: - sys.stdout.write(readme) - - tmpdir = tempfile.mkdtemp() - - if not dryrun: - with open(os.path.join(tmpdir, "README"), "w") as wfp: - wfp.write(readme) - - tarball = "%s-scan.tgz" % covname - tarball = tarball.replace('/', '-') - - if verbose and not dryrun: - shutil.copy("cov-int/build-log.txt", "build-log.txt") - - do_or_die("mv cov-int %s; (cd %s; tar -czf %s README cov-int; rm -fr README cov-int)" % (tmpdir, tmpdir, tarball)) - print("Posting the analysis request...") - do_or_die('''curl \ - --form file=@%(tmpdir)s/%(tarball)s \ - --form project="%(covname)s" \ - --form token=%(token)s \ - --form email=%(email)s \ - --form version="%(build_version)s" \ - --form description="%(description)s" \ - https://scan.coverity.com/builds?project=%(covname_url)s \ - ''' % globals()) - - try: - os.remove(os.path.join(tmpdir, tarball)) - os.rmdir(tmpdir) - except OSError: - pass - - print("Finished") - -# The following sets edit modes for GNU EMACS -# Local Variables: -# mode:python -# End: From 790ac4930c36232540c2c1da553724f5080d371b Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:00:48 +0100 Subject: [PATCH 34/36] fixes --- .github/workflows/ci_pipeline.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 1fe761f..8ec596d 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -105,3 +105,10 @@ jobs: commit_version: ${{ needs.check-hsmcpp-version.outputs.commit_version }} target_repo: igor-krechetov/hsmcpp platformio_target_branch: platformio_library + secrets: + HSMCPP_BOT_TOKEN: ${{ secrets.HSMCPP_BOT_TOKEN }} + BOT_GPG_PRIVATE_KEY: ${{ secrets.BOT_GPG_PRIVATE_KEY }} + BOT_GPG_PASSPHRASE: ${{ secrets.BOT_GPG_PASSPHRASE }} + PLATFORMIO_TOKEN: ${{ secrets.PLATFORMIO_TOKEN }} + + From 72f4f8efc0225dfcf9cf38fbf3288da247e2603b Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:12:17 +0100 Subject: [PATCH 35/36] fixes --- .github/workflows/ci_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 8ec596d..b8e8f28 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -111,4 +111,4 @@ jobs: BOT_GPG_PASSPHRASE: ${{ secrets.BOT_GPG_PASSPHRASE }} PLATFORMIO_TOKEN: ${{ secrets.PLATFORMIO_TOKEN }} - + From 4cbfcb00a624c5d647fd27686e10f51bd8360e1b Mon Sep 17 00:00:00 2001 From: igor-krechetov <58586005+igor-krechetov@users.noreply.github.com> Date: Fri, 3 Apr 2026 01:18:15 +0100 Subject: [PATCH 36/36] fixes --- .github/workflows/ci_pipeline.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index b8e8f28..651c2f5 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -16,6 +16,7 @@ jobs: (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev')) uses: igor-krechetov/hsm-github-workflows/.github/workflows/verify.yml@feature/hsmcpp-ci-integration + # -------------------------------------------------------- build: needs: verify uses: igor-krechetov/hsm-github-workflows/.github/workflows/build.yml@feature/hsmcpp-ci-integration @@ -25,11 +26,11 @@ jobs: with: build_type: Release platforms: "posix,windows,platformio,arduinoide,freertos" - # platforms: "posix" install_qt: 'ON' install_glibmm: 'ON' build_tests: 'ON' + # -------------------------------------------------------- test: needs: build if: always() && (needs.build.result == 'success') @@ -39,13 +40,12 @@ jobs: install_qt: 'ON' install_glibmm: 'ON' + # -------------------------------------------------------- sast: needs: build if: always() && (needs.build.result == 'success') uses: igor-krechetov/hsm-github-workflows/.github/workflows/sast.yml@feature/hsmcpp-ci-integration - # -------------------------------------------------------- - # AUTOTAG — only on push to *dev* # -------------------------------------------------------- autotag: needs: [verify, build, test, sast] @@ -60,6 +60,7 @@ jobs: commit_action: ${{ needs.verify.outputs.commit_action }} commit_sha: ${{ github.sha }} + # -------------------------------------------------------- update_documentation: needs: [verify, autotag] if: > @@ -75,6 +76,7 @@ jobs: BOT_GPG_PRIVATE_KEY: ${{ secrets.BOT_GPG_PRIVATE_KEY }} BOT_GPG_PASSPHRASE: ${{ secrets.BOT_GPG_PASSPHRASE }} + # -------------------------------------------------------- release: needs: [verify, update_documentation] if: > @@ -93,6 +95,7 @@ jobs: - Built on Ubuntu and Windows - Includes binaries for both platforms + # -------------------------------------------------------- deploy: needs: [verify, release] if: >