diff --git a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml index 6021872..72540d9 100644 --- a/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml +++ b/.github/workflows/automerge-dependabot-prs-into-collected-branch.yml @@ -1,38 +1,64 @@ -# 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 +# 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: + # 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: permissions: contents: write pull-requests: write + checks: read 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: 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 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' - 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' - 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/.github/workflows/collected-dependabot-staging-to-master.yml b/.github/workflows/collected-dependabot-staging-to-master.yml index 822ba31..ffcb013 100644 --- a/.github/workflows/collected-dependabot-staging-to-master.yml +++ b/.github/workflows/collected-dependabot-staging-to-master.yml @@ -1,48 +1,52 @@ 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 4306f22..817768d 100644 --- a/.github/workflows/collected-dependabot-to-staging.yml +++ b/.github/workflows/collected-dependabot-to-staging.yml @@ -1,45 +1,49 @@ +# # 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 + workflow_dispatch: +# 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, ⚠️ 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 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