Skip to content

Commit a000435

Browse files
authored
Merge pull request #55 from TechnologyEnhancedLearning/feat-button-for-cicd-testing
Feat button for cicd testing
2 parents 2555393 + 617deb6 commit a000435

File tree

11 files changed

+163
-73
lines changed

11 files changed

+163
-73
lines changed

.commitlintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"security",
2626
"config"
2727
]
28-
]
28+
],
29+
"header-max-length": [ 2, "always", 100 ]
2930
}
3031
}

.github/workflows/dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches-ignore:
55
- 'main'
66
- 'master'
7+
workflow_dispatch:
78

89
permissions:
910
contents: write

.github/workflows/pull_request.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ name: Pull Request Checks
33
on:
44
pull_request:
55
branches: ['**'] # Run on all branches
6+
workflow_dispatch:
67

78
jobs:
9+
dummy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Dummy Step
13+
run: echo "This is a dummy job to allow workflow_dispatch"
14+
815
pull-request-call-reusable-ci-checks-workflow:
916
name: Pull Request run CI Checks
1017
uses: ./.github/workflows/reuseable-ci-checks.yml
18+
needs: dummy
1119
with:
1220
runall: true
1321
secrets:

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- master
6+
workflow_dispatch:
67

78
permissions:
89
contents: write

.github/workflows/reuseable-ci-checks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Reusable CI Checks
22

33
on:
4+
workflow_dispatch:
45
workflow_call:
56
inputs:
67
runall:

.github/workflows/workflow-readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ they stay in the pull request ui. they are also only targetted on master
3737
- npm and node
3838
- seperate script to auto merge
3939

40+
## automerge-passing-minor-patch-dependabot-prs
41+
-
42+
4043
# Git setup
4144

4245
## Pull requests
43-
- Branch checks for master (they dont directly use Reuseable Ci Checks instead they use them via the pull_request yml, unsure why not directly available)
44-
46+
- Branch checks for master dont work, they don't run the workflow dispatch.
47+
If we want these checks one solution is every check in its own yml (they dont directly use Reuseable Ci Checks instead they use them via the pull_request yml)
48+
The individual steps also automatically pass so can see if any error at the end with the check to check all their outputs
4549

4650
# Notes
4751
- doesnt run easily with nektos act due to git ref checks and calling other workflows

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,7 @@ CHANGELOG.md
194194
/TELBlazor.Components/wwwroot/css/nhsuk.css
195195
/TELBlazor.Components.ShowCase.Shared/wwwroot/css/nhsuk.css
196196
/TELBlazor.Components.ShowCase.E2ETests/Reports/*.zip
197+
/CICDPackageLocation/*.nupkg
197198

199+
200+
/AllTestResults/coverage.cobertura.xml

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# [1.4.0-feat-button-for-cicd-testing.4](https://github.com/TechnologyEnhancedLearning/TELBlazor/compare/v1.4.0-feat-button-for-cicd-testing.3...v1.4.0-feat-button-for-cicd-testing.4) (2025-05-27)
2+
3+
4+
### Features
5+
6+
* **button:** merge ([63863a6](https://github.com/TechnologyEnhancedLearning/TELBlazor/commit/63863a6622e2052859cb23734ed9bc02772e3314))
7+
* **button:** squash for file tracking ([15151ee](https://github.com/TechnologyEnhancedLearning/TELBlazor/commit/15151ee09d51023cc347b441202845d98c561a1b))
8+
9+
# [1.4.0-feat-button-for-cicd-testing.3](https://github.com/TechnologyEnhancedLearning/TELBlazor/compare/v1.4.0-feat-button-for-cicd-testing.2...v1.4.0-feat-button-for-cicd-testing.3) (2025-05-27)
10+
11+
12+
### Features
13+
14+
* **button:** cicd pr branch checks stuch ([6b84387](https://github.com/TechnologyEnhancedLearning/TELBlazor/commit/6b843876d08e38cb96dbde6e4cc569195d9a5e5d))
15+
16+
# [1.4.0-feat-button-for-cicd-testing.2](https://github.com/TechnologyEnhancedLearning/TELBlazor/compare/v1.4.0-feat-button-for-cicd-testing.1...v1.4.0-feat-button-for-cicd-testing.2) (2025-05-27)
17+
18+
19+
### Features
20+
21+
* **button:** dispatch for pr ([e5832d2](https://github.com/TechnologyEnhancedLearning/TELBlazor/commit/e5832d2304a7e5a03f832769ff891cf173915f3f))
22+
23+
# [1.4.0-feat-button-for-cicd-testing.1](https://github.com/TechnologyEnhancedLearning/TELBlazor/compare/v1.3.0...v1.4.0-feat-button-for-cicd-testing.1) (2025-05-27)
24+
25+
26+
### Features
27+
28+
* **tweaks:** lint limit ([8140e8a](https://github.com/TechnologyEnhancedLearning/TELBlazor/commit/8140e8ae3c23355f59380e55dd6e0626d30a7cf9))
29+
130
# [1.3.0](https://github.com/TechnologyEnhancedLearning/TELBlazor/compare/v1.2.0...v1.3.0) (2025-05-27)
231

332

CICDPackageLocation/gitinclude.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gitinclude

README.md

Lines changed: 110 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
21
# TELBlazor
32
TEL Blazor Component Library Package
43

4+
# This ReadMe
5+
6+
This readme is the repo readme, it is also used as the package readme as this is the solution for making the TELBlazor.Components package.
7+
There is also a cicd readme in the workflow folder.
8+
9+
The [MVCBlazor repo ](https://github.com/TechnologyEnhancedLearning/MVCBlazor) readme has exploration of various of the choices and alternatives to what is implemented here. And the other blazor repos may
10+
also be a useful resource when developing for this repo.
11+
512
# Purpose
613

714
Progressive components, that use the server prerendering in Global Wasm Blazor to ensure that if the user has no JS they will get html. And that html can be created to have working post actions.
815
The render cycle will hydrate the prerender and the post actions will be overrided by services injected in the components.
916
It is client side so the users browser will do the work.
1017

18+
1119

1220
# Links
1321

@@ -34,80 +42,112 @@ It is client side so the users browser will do the work.
3442

3543
# Set Up
3644

37-
## How to set up this solution locally
38-
*Be aware wasm wwwroot appsettings are public*
39-
- TELBlazor\TELBlazor.Components.ShowCase.E2ETests\bin\Debug\net8.0\playwright.ps1 need to be run as admin
40-
- local hook for commits, recommended for pre commit, and pre push as can only check the commit name value post commit
45+
## "It works on my machine"
46+
qqqq run release first make branch for kevin
47+
### Hi Kevin, Please rewrite or correct these steps.
48+
- im expecting ome global node may end up not working if anything as its already set up on my machine
49+
50+
### Steps
51+
52+
#### Get the repo
53+
1. Go to [TELBlazor Repo](https://github.com/TechnologyEnhancedLearning/TELBlazor) hit code and get the clone string
54+
1. Clone the repo locally
55+
1. Go to [TELBlazor Repo](https://github.com/TechnologyEnhancedLearning/TELBlazor)
56+
- create a branch (**there is branch name checks in cicd**) so for example call it "docs-readme-setup-instructions"
57+
- [branch lint rule](https://github.com/TechnologyEnhancedLearning/TELBlazor/blob/master/.releaserc.json)
58+
- you commits will look like this "docs(readme): added detail on commit rules"
59+
1. Fetch, and checkout your new branch locally so you can add to the readme as you go
60+
- create commit "docs(readme): first commit"
61+
- see [commit rules](https://github.com/TechnologyEnhancedLearning/TELBlazor/blob/master/.commitlintrc.json)
62+
- *these rules also enable the versioning in cicd*
63+
- Bonus dont wait for the pipeline to fail your commit names and expose your secrets: you may want to add
64+
- gitguardian from confluence docs (follow it to the letter) [gitguardian global setup instructions](https://hee-tis.atlassian.net/wiki/spaces/TP/pages/3855253505/GitGuardian+Setup+-+Simplified+Version)
65+
- and add a pre-commit and push hook (you need both as you cannot lint what hasnt yet been commit) you add these to your templates if you want them for every repo, or just to this repo, or you can be lazy and add them into the gitguardian hook
66+
- ```
67+
#### --- Commitlint Logic (force local config) ---
68+
REPO_ROOT=$(git rev-parse --show-toplevel)
69+
CONFIG_PATH="$REPO_ROOT/.commitlintrc.json"
70+
echo "COMMIT_MSG_FILE is one msg behind it is only set to the commit your trying to commit after the commit succeeds so this script is one behind"
71+
echo "so would work best in prepush template"
72+
COMMIT_MSG_FILE="$REPO_ROOT/.git/COMMIT_EDITMSG"
73+
74+
# Check if the local .commitlintrc.json exists in the repository root
75+
if [ -f "$CONFIG_PATH" ]; then
76+
77+
echo "✅ Local .commitlintrc.json found at: $CONFIG_PATH. Running commitlint..."
78+
echo "⚠️ if commit lint fails in precommit its actually reading previous commit name you need to reset or squash make a new commit and change .git/COMMIT_EDITMSG to something that would pass. ⚠️"
79+
80+
if command -v npx &> /dev/null; then
81+
82+
cd "$REPO_ROOT" || exit 1
83+
84+
# Debug: Print the commit message file content
85+
if [ -f "$COMMIT_MSG_FILE" ]; then
86+
echo "Commit message content:"
87+
cat "$COMMIT_MSG_FILE"
88+
else
89+
echo "❌ Commit message file not found!"
90+
exit 1
91+
fi
92+
93+
94+
# Run commitlint, explicitly pointing to the local config and providing the commit message via stdin
95+
OUTPUT1=$(npx.cmd --no -- commitlint --config=".commitlintrc.json" --edit="$COMMIT_MSG_FILE" 2>&1)
96+
97+
EXIT_CODE1=$?
98+
# echo "!!!!!!!!!!! OUTPUT1"
99+
# echo "$OUTPUT1"
100+
101+
102+
# OUTPUT2=$(npx.cmd --no -- commitlint --config=".commitlintrc.json" --from=origin/master --to=HEAD 2>&1)
103+
104+
# EXIT_CODE2=$?
105+
# echo "!!!!!!!!!!! OUTPUT2"
106+
# echo "$OUTPUT2"
107+
108+
# OUTPUT3=$(npx.cmd --no -- commitlint --config=".commitlintrc.json" --from-last-tag 2>&1)
109+
110+
111+
# EXIT_CODE3=$?
112+
# echo "!!!!!!!!!!! OUTPUT3"
113+
# echo "$OUTPUT3"
114+
115+
116+
117+
#if [ "$EXIT_CODE1" -ne 0 ] || [ "$EXIT_CODE2" -ne 0 ] || [ "$EXIT_CODE3" -ne 0 ]; then
118+
if [ "$EXIT_CODE1" -ne 0 ]; then
119+
echo "❌ Commitlint failed:"
120+
121+
echo "$OUTPUT1"
122+
exit 1
123+
else
124+
echo "✅ Commitlint passed!"
125+
fi
126+
else
127+
echo "⚠️ npx not found. Please ensure Node.js and npm are installed to use commitlint."
128+
# Optionally fail here
129+
# exit 1
130+
fi
131+
else
132+
echo "ℹ️ No local .commitlintrc.json found in $REPO_ROOT. Skipping commitlint."
133+
fi
134+
```
135+
### Install packages
41136

42-
```
43-
# --- Commitlint Logic (force local config) ---
44-
REPO_ROOT=$(git rev-parse --show-toplevel)
45-
CONFIG_PATH="$REPO_ROOT/.commitlintrc.json"
46-
echo "COMMIT_MSG_FILE is one msg behind it is only set to the commit your trying to commit after the commit succeeds so this script is one behind"
47-
echo "so would work best in prepush template"
48-
COMMIT_MSG_FILE="$REPO_ROOT/.git/COMMIT_EDITMSG"
137+
### Create local files
49138

50-
# Check if the local .commitlintrc.json exists in the repository root
51-
if [ -f "$CONFIG_PATH" ]; then
139+
### Set local environment variables
52140

53-
echo "✅ Local .commitlintrc.json found at: $CONFIG_PATH. Running commitlint..."
54-
echo "⚠️ if commit lint fails in precommit its actually reading previous commit name you need to reset or squash make a new commit and change .git/COMMIT_EDITMSG to something that would pass. ⚠️"
141+
### Run tests
142+
143+
144+
145+
### How to set up this solution locally
146+
*Be aware wasm wwwroot appsettings are public*
147+
- TELBlazor\TELBlazor.Components.ShowCase.E2ETests\bin\Debug\net8.0\playwright.ps1 need to be run as admin
148+
- local hook for commits, recommended for pre commit, and pre push as can only check the commit name value post commit
55149

56-
if command -v npx &> /dev/null; then
57-
58-
cd "$REPO_ROOT" || exit 1
59150

60-
# Debug: Print the commit message file content
61-
if [ -f "$COMMIT_MSG_FILE" ]; then
62-
echo "Commit message content:"
63-
cat "$COMMIT_MSG_FILE"
64-
else
65-
echo "❌ Commit message file not found!"
66-
exit 1
67-
fi
68-
69-
70-
# Run commitlint, explicitly pointing to the local config and providing the commit message via stdin
71-
OUTPUT1=$(npx.cmd --no -- commitlint --config=".commitlintrc.json" --edit="$COMMIT_MSG_FILE" 2>&1)
72-
73-
EXIT_CODE1=$?
74-
# echo "!!!!!!!!!!! OUTPUT1"
75-
# echo "$OUTPUT1"
76-
77-
78-
# OUTPUT2=$(npx.cmd --no -- commitlint --config=".commitlintrc.json" --from=origin/master --to=HEAD 2>&1)
79-
80-
# EXIT_CODE2=$?
81-
# echo "!!!!!!!!!!! OUTPUT2"
82-
# echo "$OUTPUT2"
83-
84-
# OUTPUT3=$(npx.cmd --no -- commitlint --config=".commitlintrc.json" --from-last-tag 2>&1)
85-
86-
87-
# EXIT_CODE3=$?
88-
# echo "!!!!!!!!!!! OUTPUT3"
89-
# echo "$OUTPUT3"
90-
91-
92-
93-
#if [ "$EXIT_CODE1" -ne 0 ] || [ "$EXIT_CODE2" -ne 0 ] || [ "$EXIT_CODE3" -ne 0 ]; then
94-
if [ "$EXIT_CODE1" -ne 0 ]; then
95-
echo "❌ Commitlint failed:"
96-
97-
echo "$OUTPUT1"
98-
exit 1
99-
else
100-
echo "✅ Commitlint passed!"
101-
fi
102-
else
103-
echo "⚠️ npx not found. Please ensure Node.js and npm are installed to use commitlint."
104-
# Optionally fail here
105-
# exit 1
106-
fi
107-
else
108-
echo "ℹ️ No local .commitlintrc.json found in $REPO_ROOT. Skipping commitlint."
109-
fi
110-
```
111151
- open powershell admin
112152
- go to e2e project bin/Debug/net8
113153
- run the playwright script with "install"

0 commit comments

Comments
 (0)