-
Notifications
You must be signed in to change notification settings - Fork 508
119 lines (95 loc) · 3.37 KB
/
testing.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Testing Yari
on:
push:
branches:
- main
pull_request:
jobs:
lint:
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: yarn
cache-dependency-path: |
yarn.lock
client/pwa/yarn.lock
libs/**/*.js
- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
path: node_modules/@vscode/ripgrep/bin/
- name: Install all yarn packages (ROOT)
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install all yarn packages (pwa)
working-directory: client/pwa
run: yarn --frozen-lockfile
- name: Lint prettier
run: yarn prettier-check
- name: Lint ESLint
run: yarn eslint
- name: Lint stylelint
run: yarn stylelint
- name: Check TypeScript
run: yarn check:tsc
test:
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: yarn
- name: Cache @vscode/ripgrep bin
uses: actions/cache@v4
with:
key: vscode-ripgrep-bin-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('yarn.lock') }}
path: node_modules/@vscode/ripgrep/bin/
- name: Install all yarn packages
run: yarn --frozen-lockfile
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Unit testing client
run: yarn test:client
- name: Unit testing libs
run: yarn test:libs
- name: Build and start server
id: server
env:
ENV_FILE: .env.testing
run: |
yarn build:prepare
yarn build:docs
yarn render:html
yarn start:static-server > /tmp/stdout.log 2> /tmp/stderr.log &
sleep 1
curl --fail --retry-connrefused --retry 5 http://localhost:5042 > /dev/null
- name: Functional testing
run: |
yarn test:testing
yarn test:headless
- name: Basic m2h tool testing
env:
ENV_FILE: .env.testing
run: |
yarn m2h markdown/tool/m2h --locale en-US
diff -s testing/content/files/en-us/markdown/tool/m2h/index.html testing/content/files/en-us/markdown/tool/m2h/expected.html
- name: Debug server's stdout and stderr if tests failed
if: failure() && steps.server.outcome != 'skipped'
run: |
echo "STDOUT..................................................."
cat /tmp/stdout.log
echo ""
echo "STDERR..................................................."
cat /tmp/stderr.log