-
Notifications
You must be signed in to change notification settings - Fork 515
84 lines (70 loc) · 2.92 KB
/
developing.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Developing with Yari
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: mdn/content
path: mdn/content
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: "12"
cache: "yarn"
- name: Cache node_modules
uses: actions/[email protected]
id: cached-node_modules
with:
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.github/workflows/developing.yml') }}
- name: Install all yarn packages
if: steps.cached-node_modules.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
- name: Setup kernel for react native, increase watchers
run: |
# When running Yari on Linux, you might get the
# "Error: ENOSPC: System limit for number of file watchers reached" error.
# This, resolves that.
# Source https://github.com/expo/expo-github-action/issues/20#issuecomment-541676895
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Start the dev server
env:
# Remember, the mdn/content repo got cloned into `pwd` into a
# sub-folder called "mdn/content"
CONTENT_ROOT: "${{ github.workspace }}/mdn/content/files"
run: |
# Sanity check that the mdn/kitchensink page is there. If you don't do
# this, and the file has accidentally or intentionally been deleted,
# unfortunately the error messaging can be very misleading because the
# tests would assume there's something wrong with the code instead of
# the content if loading this page fails.
ls "$CONTENT_ROOT/en-us/mdn/kitchensink"
yarn prepare-build
yarn start > /tmp/stdout.log 2> /tmp/stderr.log &
- name: Wait for servers
run: |
# Just a slight delay to wait until the dev server is ready.
sleep 3
curl --retry-connrefused --retry 5 http://localhost:5000 > /dev/null
curl --retry-connrefused --retry 5 --silent http://localhost:3000 > /dev/null
- name: Test viewing the dev server
env:
# This will make sure the tests in `testing/tests/*.test.js` only run
# if the development server is up and ready to be tested.
TESTING_DEVELOPING: true
CONTENT_ROOT: mdn/content/files
run: |
yarn test:developing
- 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