Skip to content

Commit 8c5c0d7

Browse files
authored
Merge pull request #84 from peterlau123/fix/jekyll-build-and-link-checker
fix(ci): Fix GitHub Pages Jekyll build and link checker
2 parents 473468c + c117ca6 commit 8c5c0d7

5 files changed

Lines changed: 117 additions & 7 deletions

File tree

.github/workflows/jekyll.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Ruby
2525
uses: ruby/setup-ruby@v1
2626
with:
27-
ruby-version: '3.3'
27+
ruby-version: "3.3"
2828
bundler-cache: true
2929

3030
- name: Setup Pages
@@ -36,6 +36,16 @@ jobs:
3636
env:
3737
JEKYLL_ENV: production
3838

39+
- name: Verify build output
40+
run: |
41+
echo "Checking _site/index.html..."
42+
if grep -q "{% for post" _site/index.html; then
43+
echo "ERROR: Jekyll template code found in _site/index.html - Jekyll build failed!"
44+
head -20 _site/index.html
45+
exit 1
46+
fi
47+
echo "Build verification passed - _site/index.html is properly rendered"
48+
3949
- name: Upload artifact
4050
uses: actions/upload-pages-artifact@v4
4151

.github/workflows/site-validation.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
schedule:
88
# Run weekly on Monday at 00:00 UTC
9-
- cron: '0 0 * * 1'
9+
- cron: "0 0 * * 1"
1010
workflow_dispatch:
1111

1212
jobs:
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Ruby
2020
uses: ruby/setup-ruby@v1
2121
with:
22-
ruby-version: '3.3'
22+
ruby-version: "3.3"
2323
bundler-cache: true
2424

2525
- name: Build site
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Python
2929
uses: actions/setup-python@v6
3030
with:
31-
python-version: '3.x'
31+
python-version: "3.x"
3232

3333
- name: Install html5validator
3434
run: pip install html5validator
@@ -38,10 +38,34 @@ jobs:
3838
html5validator --root _site/ --also-check-css --ignore '*/css/bootstrap.*' --ignore '*/css/bootstrap.min.*' --format text || echo "HTML validation completed with warnings"
3939
continue-on-error: true
4040

41+
- name: Serve site locally
42+
run: |
43+
python3 -m http.server 8080 --directory _site &
44+
echo "SERVER_PID=$!" >> $GITHUB_ENV
45+
sleep 2
46+
4147
- name: Check links
4248
uses: lycheeverse/lychee-action@v2
4349
with:
44-
args: --base file://${{ github.workspace }}/_site --verbose --no-progress --exclude 'https://peterlau123\.github\.io.*' './_site/**/*.html'
50+
args: |
51+
--base http://localhost:8080
52+
--verbose
53+
--no-progress
54+
--timeout 30
55+
--retry 2
56+
--exclude 'https://peterlau123\.github\.io.*'
57+
--exclude 'http://huangxuan\.me'
58+
--exclude 'http://cdn\.bootcss\.com'
59+
--exclude 'https://oss\.maxcdn\.com'
60+
--exclude 'https://ghbtns\.com'
61+
--exclude 'https://pagead2\.googlesyndication\.com'
62+
--exclude-mail
63+
--accept 200,204,301,302,307,308,403
64+
'http://localhost:8080'
4565
fail: true
4666
env:
4767
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
68+
69+
- name: Stop local server
70+
if: always()
71+
run: kill $SERVER_PID || true

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ _archive
44
node_modules
55
.vscode
66
*.log
7-
*.lock
7+
# *.lock # Commented out to allow Gemfile.lock for Jekyll dependency management
88
*.sh
99
.DS_Store
1010
.jekyll-cache
1111
*/.DS_Store
1212
*/*/.DS_Store
1313
.idea
14-
_site/
14+
_site/

.jekyll-metadata

-36.5 KB
Binary file not shown.

Gemfile.lock

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.8.7)
5+
public_suffix (>= 2.0.2, < 7.0)
6+
colorator (1.1.0)
7+
concurrent-ruby (1.3.5)
8+
em-websocket (0.5.3)
9+
eventmachine (>= 0.12.9)
10+
http_parser.rb (~> 0)
11+
eventmachine (1.2.7)
12+
ffi (1.17.2)
13+
forwardable-extended (2.6.0)
14+
google-protobuf (3.23.4)
15+
http_parser.rb (0.8.0)
16+
i18n (1.14.7)
17+
concurrent-ruby (~> 1.0)
18+
jekyll (4.3.4)
19+
addressable (~> 2.4)
20+
colorator (~> 1.0)
21+
em-websocket (~> 0.5)
22+
i18n (~> 1.0)
23+
jekyll-sass-converter (>= 2.0, < 4.0)
24+
jekyll-watch (~> 2.0)
25+
kramdown (~> 2.3, >= 2.3.1)
26+
kramdown-parser-gfm (~> 1.0)
27+
liquid (~> 4.0)
28+
mercenary (>= 0.3.6, < 0.5)
29+
pathutil (~> 0.9)
30+
rouge (>= 3.0, < 5.0)
31+
safe_yaml (~> 1.0)
32+
terminal-table (>= 1.8, < 4.0)
33+
webrick (~> 1.7)
34+
jekyll-paginate (1.1.0)
35+
jekyll-sass-converter (3.0.0)
36+
sass-embedded (~> 1.54)
37+
jekyll-watch (2.2.1)
38+
listen (~> 3.0)
39+
kramdown (2.5.1)
40+
rexml (>= 3.3.9)
41+
kramdown-parser-gfm (1.1.0)
42+
kramdown (~> 2.0)
43+
liquid (4.0.4)
44+
listen (3.9.0)
45+
rb-fsevent (~> 0.10, >= 0.10.3)
46+
rb-inotify (~> 0.9, >= 0.9.10)
47+
mercenary (0.4.0)
48+
pathutil (0.16.2)
49+
forwardable-extended (~> 2.6)
50+
public_suffix (5.1.1)
51+
rake (13.3.0)
52+
rb-fsevent (0.11.2)
53+
rb-inotify (0.11.1)
54+
ffi (~> 1.0)
55+
rexml (3.4.2)
56+
rouge (3.30.0)
57+
safe_yaml (1.0.5)
58+
sass-embedded (1.58.3)
59+
google-protobuf (~> 3.21)
60+
rake (>= 10.0.0)
61+
terminal-table (3.0.2)
62+
unicode-display_width (>= 1.1.1, < 3)
63+
unicode-display_width (2.6.0)
64+
webrick (1.9.1)
65+
66+
PLATFORMS
67+
ruby
68+
69+
DEPENDENCIES
70+
jekyll (~> 4.0)
71+
jekyll-paginate
72+
rake
73+
webrick (~> 1.7)
74+
75+
BUNDLED WITH
76+
1.17.2

0 commit comments

Comments
 (0)