From 1059be75c36634dff26a9b8711447a0c66926582 Mon Sep 17 00:00:00 2001 From: Iulian Barbu <14218860+iulianbarbu@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:14:13 +0200 Subject: [PATCH] workflows: add debug input for sync templates act (#7057) # Description Introduce a workflow `debug` input for `misc-sync-templates.yml` and use it instead of the `runner.debug` context variable, which is set to '1' when `ACTIONS_RUNNER_DEBUG` env/secret is set (https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging#enabling-runner-diagnostic-logging). This is useful for controlling when to show debug prints. ## Integration N/A ## Review Notes Using `runner.debug` requires setting the `ACTIONS_RUNNER_DEBUG` env variable, but setting it to false/true is doable through an input, or by importing a variable from the github env file (which requires a code change). This input alone can replace the entire `runner.debug` + `ACTIONS_RUNNER_DEBUG` setup, which simplifies debug printing, but it doesn't look as standard as `runner.debug`. I don't think it is a big deal overall, for this action alone, but happy to account for other opinions. Note: setting the `ACTIONS_RUNNER_DEBUG` whenever we want in a separate branch wouldn't be useful because we can not run the `misc-sync-templates.yml` action from other branch than `master` (due to branch protection rules), so we need to expose this input to be controllable from `master`. --------- Signed-off-by: Iulian Barbu --- .github/workflows/misc-sync-templates.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/misc-sync-templates.yml b/.github/workflows/misc-sync-templates.yml index 7ff0705fe249..8d06d89621d7 100644 --- a/.github/workflows/misc-sync-templates.yml +++ b/.github/workflows/misc-sync-templates.yml @@ -21,6 +21,10 @@ on: stable_release_branch: description: 'Stable release branch, e.g. stable2407' required: true + debug: + description: Enable runner debug logging + required: false + default: false jobs: sync-templates: @@ -86,7 +90,7 @@ jobs: EOF [ ${{ matrix.template }} != "solochain" ] && echo "# Leave out the node compilation from regular template usage." \ - && echo "\"default-members\" = [\"pallets/template\", \"runtime\"]" >> Cargo.toml + && echo "default-members = [\"pallets/template\", \"runtime\"]" >> Cargo.toml [ ${{ matrix.template }} == "solochain" ] && echo "# The node isn't yet replaceable by Omni Node." cat << EOF >> Cargo.toml members = [ @@ -115,8 +119,9 @@ jobs: toml set templates/${{ matrix.template }}/Cargo.toml 'workspace.package.edition' "$(toml get --raw Cargo.toml 'workspace.package.edition')" > Cargo.temp mv Cargo.temp ./templates/${{ matrix.template }}/Cargo.toml working-directory: polkadot-sdk + - name: Print the result Cargo.tomls for debugging - if: runner.debug == '1' + if: ${{ github.event.inputs.debug }} run: find . -type f -name 'Cargo.toml' -exec cat {} \; working-directory: polkadot-sdk/templates/${{ matrix.template }}/ @@ -142,6 +147,12 @@ jobs: done; working-directory: "${{ env.template-path }}" + - name: Print the result Cargo.tomls for debugging after copying required workspace dependencies + if: ${{ github.event.inputs.debug }} + run: find . -type f -name 'Cargo.toml' -exec cat {} \; + working-directory: polkadot-sdk/templates/${{ matrix.template }}/ + + # 3. Verify the build. Push the changes or create a PR. # We've run into out-of-disk error when compiling in the next step, so we free up some space this way.