From 4d69e43c72fa52101c417c306efb19ccb04682e7 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Mon, 1 Sep 2025 09:41:26 +0100 Subject: [PATCH 1/5] chore(cicd): automating pipeline progression of dependabot bumps --- ...e-dependabot-prs-into-collected-branch.yml | 26 ++++++++++++++++--- ...collected-dependabot-staging-to-master.yml | 1 + .../collected-dependabot-to-staging.yml | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml index 6021872..9e3d50b 100644 --- a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml +++ b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml @@ -1,19 +1,38 @@ +# qqqq in development # This script seperate major and minor but we do merge them into the same branch. # Having two steps allows us to easily turn off major changes in future and then script them to their own branch and pipeline. name: Auto-merge Dependabot PRs into collected branch on: pull_request: - types: [opened, synchronize] + # synchronize + types: [opened] branches: [Automatic_version_update_dependabot] # Make sure this matches your actual branch name - + check_suite: + types: [completed] + workflow_dispatch: permissions: contents: write pull-requests: write jobs: + debug: + runs-on: ubuntu-latest + steps: + - name: Debug info + run: | + echo "Actor: ${{ github.actor }}" + echo "PR Title: ${{ github.event.pull_request.title }}" + echo "Target Branch: ${{ github.event.pull_request.base.ref }}" + echo "Source Branch: ${{ github.event.pull_request.head.ref }}" + - name: Wait for other checks to start + - name: Delay for check + run: | + # drop later qqqq shouldnt need but its running before auto + echo "Waiting 4 minutes for other checks to start running..." + sleep 240 auto-merge: runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' + if: github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' steps: - name: Extract update type id: extract @@ -27,6 +46,7 @@ jobs: - name: Auto-merge minor and patch updates if: steps.extract.outputs.update_type == 'minor_or_patch' + # Auto should set the the request to merge once checks complete run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/collected-dependabot-staging-to-master.yml b/.github/workflows/collected-dependabot-staging-to-master.yml index 822ba31..fbb0e0f 100644 --- a/.github/workflows/collected-dependabot-staging-to-master.yml +++ b/.github/workflows/collected-dependabot-staging-to-master.yml @@ -1,3 +1,4 @@ +# qqqq in development name: Collected Dependabot Promotion From Staging To Master on: schedule: diff --git a/.github/workflows/collected-dependabot-to-staging.yml b/.github/workflows/collected-dependabot-to-staging.yml index 4306f22..c0a0376 100644 --- a/.github/workflows/collected-dependabot-to-staging.yml +++ b/.github/workflows/collected-dependabot-to-staging.yml @@ -1,3 +1,4 @@ +# qqqq in development name: Dependabot Collected Promotion To Staging # this logic will require branch ruleset checks of running the dev pipeline on: From 59b6a1faca3c976fdf77265b54931dc19db308a7 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Mon, 1 Sep 2025 10:53:21 +0100 Subject: [PATCH 2/5] chore(checks): fail due to artifact --- ...e-dependabot-prs-into-collected-branch.yml | 7 +- .../collected-dependabot-to-staging.yml | 84 +++++++++---------- .github/workflows/reuseable-ci-checks.yml | 4 +- .github/workflows/workflow-readme.md | 33 +++++++- 4 files changed, 82 insertions(+), 46 deletions(-) diff --git a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml index 9e3d50b..0c420fc 100644 --- a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml +++ b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml @@ -5,7 +5,7 @@ name: Auto-merge Dependabot PRs into collected branch on: pull_request: # synchronize - types: [opened] + types: [opened, synchronize] branches: [Automatic_version_update_dependabot] # Make sure this matches your actual branch name check_suite: types: [completed] @@ -13,6 +13,7 @@ on: permissions: contents: write pull-requests: write + checks: read jobs: debug: @@ -32,7 +33,8 @@ jobs: sleep 240 auto-merge: runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' + # if dependabot and checks ran + if: (github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch')&& (github.event_name != 'check_suite' || github.event.check_suite.conclusion == 'success') steps: - name: Extract update type id: extract @@ -53,6 +55,7 @@ jobs: - name: Auto-merge major updates if: steps.extract.outputs.update_type == 'major' + # Auto should set the the request to merge once checks complete run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/collected-dependabot-to-staging.yml b/.github/workflows/collected-dependabot-to-staging.yml index c0a0376..eb067b9 100644 --- a/.github/workflows/collected-dependabot-to-staging.yml +++ b/.github/workflows/collected-dependabot-to-staging.yml @@ -1,46 +1,46 @@ -# qqqq in development -name: Dependabot Collected Promotion To Staging -# this logic will require branch ruleset checks of running the dev pipeline -on: - schedule: - # Promotion from staging to release should be a week apart so alternating weeks (also live updates dangerous) - - cron: '0 9 1-7 * 1' # First Monday of month - - cron: '0 9 15-21 * 1' # Third Monday of month - workflow_dispatch: # Allow manual trigger +# # qqqq in development +# name: Dependabot Collected Promotion To Staging +# # this logic will require branch ruleset checks of running the dev pipeline +# on: + # schedule: + # # Promotion from staging to release should be a week apart so alternating weeks (also live updates dangerous) + # - cron: '0 9 1-7 * 1' # First Monday of month + # - cron: '0 9 15-21 * 1' # Third Monday of month + # workflow_dispatch: # Allow manual trigger -jobs: - promote-to-automatic-collected-dependabot-staging: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 +# jobs: + # promote-to-automatic-collected-dependabot-staging: + # runs-on: ubuntu-latest + # permissions: + # contents: write + # pull-requests: write + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Check for changes - id: changes - run: | - git fetch origin Automatic_version_update_dependabot:Automatic_version_update_dependabot - git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging + # - name: Check for changes + # id: changes + # run: | + # git fetch origin Automatic_version_update_dependabot:Automatic_version_update_dependabot + # git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging - if git diff --quiet Automatic_collected_dependabot_staging Automatic_version_update_dependabot; then - echo "has_changes=false" >> $GITHUB_OUTPUT - else - echo "has_changes=true" >> $GITHUB_OUTPUT - fi + # if git diff --quiet Automatic_collected_dependabot_staging Automatic_version_update_dependabot; then + # echo "has_changes=false" >> $GITHUB_OUTPUT + # else + # echo "has_changes=true" >> $GITHUB_OUTPUT + # fi - - name: Create PR to Automatic_collected_dependabot_staging - if: steps.changes.outputs.has_changes == 'true' - run: | - gh pr create \ - --base Automatic_collected_dependabot_staging \ - --head Automatic_version_update_dependabot \ - --title "Fortnightly dependabot collected to staging - $(date +%Y-%m-%d)" \ - --body "Automated Fortnightly promotion of dependency updates from dependabot" \ - --auto-merge \ - --merge - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + # - name: Create PR to Automatic_collected_dependabot_staging + # if: steps.changes.outputs.has_changes == 'true' + # run: | + # gh pr create \ + # --base Automatic_collected_dependabot_staging \ + # --head Automatic_version_update_dependabot \ + # --title "Fortnightly dependabot collected to staging - $(date +%Y-%m-%d)" \ + # --body "Automated Fortnightly promotion of dependency updates from dependabot" \ + # --auto-merge \ + # --merge + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/reuseable-ci-checks.yml b/.github/workflows/reuseable-ci-checks.yml index 172443c..9523b66 100644 --- a/.github/workflows/reuseable-ci-checks.yml +++ b/.github/workflows/reuseable-ci-checks.yml @@ -340,7 +340,9 @@ jobs: # Echo the entire artifact list for debugging purposes echo "Artifact List: $ARTIFACT_LIST" - ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[] | select(.name=="coverage-report") | .url') + #qqqq worked mostly ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[] | select(.name=="coverage-report") | .url') + ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts | map(select(.name=="coverage-report")) | sort_by(.created_at) | last | .url') + # Echo the artifact URL to confirm echo "Artifact URL: $ARTIFACT_URL" diff --git a/.github/workflows/workflow-readme.md b/.github/workflows/workflow-readme.md index e008223..cef6cb3 100644 --- a/.github/workflows/workflow-readme.md +++ b/.github/workflows/workflow-readme.md @@ -85,12 +85,43 @@ The individual steps also automatically pass so can see if any error at the end - autoverging is being tried for major and minor - branch checks must pass for merge on automated_version - checks required but overrideable for all workflows +- dependabot secret names to match repos ones where need to share +- dependabot not need to build package later brnch does + +## Dependabot Pipeline (AI generatated diag) + +```mermaid +flowchart TD + %% Dependabot PR to initial branch + A[Dependabot PR] --> B[Automatic_version_update_dependabot] + + %% Checks on the dependabot branch + B --> C[Run Checks] + C --> C1[Commit name check ❌ skipped] + C --> C2[Branch name check ❌ skipped] + C --> C3[Build as release] + C --> C4[Unit tests] + C --> C5[E2E tests] + + %% Weekly merge to staging + B -->|Weekly merge via collected-dependabot-to-staging.yml| D[Automatic_collected_dependabot_staging] + + %% Staging checks and dev build + D --> E[Run Checks & Dev Build] + E --> E1[Checks again] + E --> E2[Build dev package] + E --> E3[Showcase dev page] + + %% Weekly merge to master + D -->|Weekly merge via collected-dependabot-staging-to-master.yml| F[Master] +``` + ## Versioning Via semantic release and recorded as a generate c# file used by a blazor component ## Alternative Approaches -``` + name: Pull Request Checks # ⚠️ pull_request_target is dangerous it allows secrets to be used by forks and bots, ⚠️ From 306ec36b73e8007657367228d256123f4491634e Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Mon, 1 Sep 2025 10:58:21 +0100 Subject: [PATCH 3/5] chore(cicd): safer disabling of scripts --- ...collected-dependabot-staging-to-master.yml | 87 ++++++++++--------- .../collected-dependabot-to-staging.yml | 3 + 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/.github/workflows/collected-dependabot-staging-to-master.yml b/.github/workflows/collected-dependabot-staging-to-master.yml index fbb0e0f..ffcb013 100644 --- a/.github/workflows/collected-dependabot-staging-to-master.yml +++ b/.github/workflows/collected-dependabot-staging-to-master.yml @@ -1,49 +1,52 @@ -# qqqq in development name: Collected Dependabot Promotion From Staging To Master on: - schedule: - # we want the opposite weeks to staging so we get a week where it occurs in manual testing - - cron: '0 9 8-14 * 1' # Second Monday of month - - cron: '0 9 22-28 * 1' # Fourth Monday of month workflow_dispatch: +# # qqqq in development +# name: Collected Dependabot Promotion From Staging To Master +# on: + # schedule: + # # we want the opposite weeks to staging so we get a week where it occurs in manual testing + # - cron: '0 9 8-14 * 1' # Second Monday of month + # - cron: '0 9 22-28 * 1' # Fourth Monday of month + # workflow_dispatch: -jobs: - promote-to-master: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 +# jobs: + # promote-to-master: + # runs-on: ubuntu-latest + # permissions: + # contents: write + # pull-requests: write + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Check for changes - id: changes - run: | - git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging - git fetch origin master:master # or main/master - whatever your prod branch is + # - name: Check for changes + # id: changes + # run: | + # git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging + # git fetch origin master:master - if git diff --quiet master Automatic_collected_dependabot_staging; then - echo "has_changes=false" >> $GITHUB_OUTPUT - else - echo "has_changes=true" >> $GITHUB_OUTPUT - fi + # if git diff --quiet master Automatic_collected_dependabot_staging; then + # echo "has_changes=false" >> $GITHUB_OUTPUT + # else + # echo "has_changes=true" >> $GITHUB_OUTPUT + # fi - - name: Create PR to master - if: steps.changes.outputs.has_changes == 'true' - run: | - if gh pr list --head Automatic_collected_dependabot_staging --base master --json number --jq '.[0].number' | grep -q .; then - echo "PR already exists, skipping creation" - else - gh pr create \ - --base master \ - --head Automatic_collected_dependabot_staging \ - --title "Fortnightly dependabot collected master promotion - $(date +%Y-%m-%d)" \ - --body "Automated weekly promotion from staging to master after testing period" \ - --auto-merge \ - --merge - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + # - name: Create PR to master + # if: steps.changes.outputs.has_changes == 'true' + # run: | + # if gh pr list --head Automatic_collected_dependabot_staging --base master --json number --jq '.[0].number' | grep -q .; then + # echo "PR already exists, skipping creation" + # else + # gh pr create \ + # --base master \ + # --head Automatic_collected_dependabot_staging \ + # --title "Fortnightly dependabot collected master promotion - $(date +%Y-%m-%d)" \ + # --body "Automated weekly promotion from staging to master after testing period" \ + # --auto-merge \ + # --merge + # fi + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/collected-dependabot-to-staging.yml b/.github/workflows/collected-dependabot-to-staging.yml index eb067b9..817768d 100644 --- a/.github/workflows/collected-dependabot-to-staging.yml +++ b/.github/workflows/collected-dependabot-to-staging.yml @@ -1,4 +1,7 @@ # # qqqq in development +name: Dependabot Collected Promotion To Staging +on: + workflow_dispatch: # name: Dependabot Collected Promotion To Staging # # this logic will require branch ruleset checks of running the dev pipeline # on: From db831a2c2f306f11f77425f91d2434ca0b0534fc Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Mon, 1 Sep 2025 12:21:43 +0100 Subject: [PATCH 4/5] chore(automerge): gh docs --- ...e-dependabot-prs-into-collected-branch.yml | 52 ++++++++++--------- README.md | 5 ++ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml index 0c420fc..dbbcfb1 100644 --- a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml +++ b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml @@ -1,12 +1,12 @@ # qqqq in development -# This script seperate major and minor but we do merge them into the same branch. -# Having two steps allows us to easily turn off major changes in future and then script them to their own branch and pipeline. -name: Auto-merge Dependabot PRs into collected branch +# this script seperate major and minor but we do merge them into the same branch. +# having two steps allows us to easily turn off major changes in future and then script them to their own branch and pipeline. +name: auto-merge dependabot prs into collected branch on: pull_request: # synchronize types: [opened, synchronize] - branches: [Automatic_version_update_dependabot] # Make sure this matches your actual branch name + branches: [automatic_version_update_dependabot] # make sure this matches your actual branch name check_suite: types: [completed] workflow_dispatch: @@ -19,43 +19,45 @@ jobs: debug: runs-on: ubuntu-latest steps: - - name: Debug info + - name: debug info run: | - echo "Actor: ${{ github.actor }}" - echo "PR Title: ${{ github.event.pull_request.title }}" - echo "Target Branch: ${{ github.event.pull_request.base.ref }}" - echo "Source Branch: ${{ github.event.pull_request.head.ref }}" - - name: Wait for other checks to start - - name: Delay for check + echo "actor: ${{ github.actor }}" + echo "pr title: ${{ github.event.pull_request.title }}" + echo "target branch: ${{ github.event.pull_request.base.ref }}" + echo "source branch: ${{ github.event.pull_request.head.ref }}" + - name: wait for other checks to start + - name: delay for check run: | # drop later qqqq shouldnt need but its running before auto - echo "Waiting 4 minutes for other checks to start running..." + echo "waiting 4 minutes for other checks to start running..." sleep 240 auto-merge: runs-on: ubuntu-latest # if dependabot and checks ran if: (github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch')&& (github.event_name != 'check_suite' || github.event.check_suite.conclusion == 'success') steps: - - name: Extract update type + - name: extract update type id: extract run: | - PR_TITLE="${{ github.event.pull_request.title }}" - if [[ $PR_TITLE == *"(major)"* ]]; then - echo "update_type=major" >> $GITHUB_OUTPUT + pr_title="${{ github.event.pull_request.title }}" + if [[ $pr_title == *"(major)"* ]]; then + echo "update_type=major" >> $github_output else - echo "update_type=minor_or_patch" >> $GITHUB_OUTPUT + echo "update_type=minor_or_patch" >> $github_output fi - - name: Auto-merge minor and patch updates + - name: auto-merge minor and patch updates if: steps.extract.outputs.update_type == 'minor_or_patch' - # Auto should set the the request to merge once checks complete - run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" + # auto should set the the request to merge once checks complete + # qqqq could squash for cleaner? --squash "${{ github.event.pull_request.html_url }}" + run: gh pr merge --auto 1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} - - name: Auto-merge major updates + - name: auto-merge major updates if: steps.extract.outputs.update_type == 'major' - # Auto should set the the request to merge once checks complete - run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}" + # auto should set the the request to merge once checks complete + # qqqq could squash for cleaner? --squash "${{ github.event.pull_request.html_url }}" + run: gh pr merge --auto 1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 404d9b3..4ec4215 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ the ability to produce static prerendered html. The prerendered html is written - **Node.js 18+** and npm - **Git** configured with your credentials - **PowerShell 5.1+** +- **Longfile names enabled on the system** > ⚠️ **Important:** All commands in this guide require **PowerShell running as Administrator** ### Quick Setup ⚡ @@ -116,6 +117,10 @@ The project should now work. See other sections for what projects to run, and co > ⚠️ read the contribution section before creating a branch or commits ⚠️ +### Trouble Shooting +- Longpaths may be required if E2E Client is not building. + - Follow [microsoft docs](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) + - or Win + R -> type regedit -> path to the option HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem -> set LongPathsEnabled to 1 ### Getting Started with the Project following Setup From 8db2b137b755697948e9fb9ccb8c397cb6e3df72 Mon Sep 17 00:00:00 2001 From: Phil-NHS Date: Mon, 1 Sep 2025 12:47:25 +0100 Subject: [PATCH 5/5] chore(dependabot): auto --- .../automerge-dependabot-prs-into-collected-branch.yml | 3 ++- .gitignore | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml index dbbcfb1..72540d9 100644 --- a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml +++ b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml @@ -25,12 +25,13 @@ jobs: echo "pr title: ${{ github.event.pull_request.title }}" echo "target branch: ${{ github.event.pull_request.base.ref }}" echo "source branch: ${{ github.event.pull_request.head.ref }}" - - name: wait for other checks to start + - name: delay for check run: | # drop later qqqq shouldnt need but its running before auto echo "waiting 4 minutes for other checks to start running..." sleep 240 + auto-merge: runs-on: ubuntu-latest # if dependabot and checks ran diff --git a/.gitignore b/.gitignore index fad9453..ca74745 100644 --- a/.gitignore +++ b/.gitignore @@ -237,3 +237,4 @@ TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/Logs/* # Generated version info files TELBlazor.Components/TELBlazorPackageVersion/VersionInfo*.cs /.github/workflows/test.yml +/Optimisation Notes.md