Skip to content

Commit 2f1c441

Browse files
authored
feat: test website pages (#41)
* feat: test website pages * update main.yml * update main.yml * wait server to start
1 parent 21e8960 commit 2f1c441

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ jobs:
5656
uses: actions/upload-pages-artifact@v3
5757
with:
5858
path: ./public
59+
- name: Test website pages
60+
if: github.event_name == 'pull_request'
61+
run: |
62+
nohup make all-dev &
63+
sleep 5
64+
make test
5965
6066
- name: Deploy
6167
uses: peaceiris/actions-gh-pages@v4

Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,29 @@ compile-site:
66
hugo
77
echo "Website generated"
88

9-
serve-site-dev:
10-
echo "Serving website"
11-
hugo server --bind=0.0.0.0
12-
139
compile-assets:
1410
echo "Compiling assets"
1511
cd themes/conventional-branch && npm install && npm run build
1612
echo "Assets compiled"
1713

14+
serve-site-dev:
15+
echo "Serving website"
16+
hugo server --bind=0.0.0.0
17+
1818
compile-assets-dev:
1919
echo "Compiling assets"
2020
cd themes/conventional-branch && npm install && npm run start &
21+
22+
test:
23+
@echo "Running site tests against http://localhost:1313/ ..."
24+
@pages="\
25+
http://localhost:1313/ \
26+
http://localhost:1313/zh/ \
27+
http://localhost:1313/about/ \
28+
http://localhost:1313/#summary \
29+
http://localhost:1313/#specification" ;\
30+
for page in $$pages; do \
31+
echo -n "Testing $$page ... "; \
32+
curl -sSf -o /dev/null $$page && echo "✅ OK" || (echo "❌ FAILED"; exit 1); \
33+
done
34+

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ services:
99
- "1313:1313"
1010
working_dir: /src/
1111
volumes:
12-
- ./:/src/
12+
- ./:/src/

0 commit comments

Comments
 (0)