-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d101b5c
commit e90fbd8
Showing
8 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow runs the insert_navbar script on several test HTML inputs, | ||
# making sure that the output is as expected. | ||
|
||
name: Test Navbar Script | ||
|
||
on: [push, pull_request] # Runs on push and PRs | ||
|
||
jobs: | ||
test-html-diff: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Copy script to GHA scratch directory | ||
run: cp DocsNav/scripts/insert_navbar.sh .github/workflows/test_navbar_script | ||
|
||
- name: Compare all test inputs against out.html | ||
working-directory: .github/workflows/test_navbar_script | ||
run: | | ||
# Run script on all files in `ins_html` directory | ||
./insert_navbar.sh ./ins_html ./test_navbar.html | ||
# Expected output | ||
OUT="expected_out.html" | ||
# Check if all files in `ins_html` match the expected output | ||
for file in ins_html/*; do | ||
if diff <(tr -d '[:space:]' < "$file") <(tr -d '[:space:]' < $OUT) > /dev/null; then | ||
echo "✅ $file matches $OUT (ignoring whitespace)" | ||
else | ||
echo "❌ $file differs from $OUT" | ||
exit 1 # Fail the job if any file is different | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<body> | ||
<p>This is a navbar!</p> | ||
<h1>Test 1</h1> | ||
<p>Test 1</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<html> | ||
<body> | ||
<h1>Test 1</h1> | ||
<p>Test 1</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<html> | ||
<body><h1>Test 1</h1><p>Test 1</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html><body> | ||
<h1>Test 1</h1> | ||
<p>Test 1</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<html><body><h1>Test 1</h1><p>Test 1</p> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>This is a navbar!</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters