-
Notifications
You must be signed in to change notification settings - Fork 513
50 lines (39 loc) · 1.4 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Testing, building, serving
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install all npm packages
run: npm ci
- name: Lint files
run: npm test
- name: Build all
run: npm run build
- name: Start server
run: |
npm run start-server > /tmp/stdout.log 2> /tmp/stderr.log &
sleep 3
curl --retry-connrefused --retry 5 http://localhost:9090 > /dev/null
- name: View some built pages
run: |
# This depends on actual content.
# Arbitrary pages picked. The tests just makes sure they 200 OK
curl --fail --silent http://localhost:9090/pages/tabbed/video.html > /dev/null
curl --fail --silent http://localhost:9090/pages/js/array-foreach.html > /dev/null
curl --fail --silent http://localhost:9090/pages/css/background.html > /dev/null
- name: Debug server's stdout and stderr if tests failed
if: failure()
run: |
echo "STDOUT..................................................."
cat /tmp/stdout.log
echo ""
echo "STDERR..................................................."
cat /tmp/stderr.log