Skip to content

Commit 7da184c

Browse files
committed
add Github Actions CI
1 parent 08dc761 commit 7da184c

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/node-tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: json-to-go tests
3+
4+
on: # yamllint disable-line rule:truthy
5+
workflow_call:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- "master"
10+
- "main"
11+
pull_request:
12+
13+
jobs:
14+
run-tests:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
27+
- name: Run tests
28+
run: |
29+
node json-to-go.test.js
30+
31+
- name: Run json-to-go using stdin
32+
shell: bash
33+
run: |
34+
set -eEuo pipefail
35+
got=$(node json-to-go.js < tests/double-nested-objects.json)
36+
exp=$(cat tests/double-nested-objects.go)
37+
echo "got: '${got}'"
38+
[[ "${got}" == "${exp}" ]]
39+
40+
- name: Run json-to-go with -big using stdin
41+
shell: bash
42+
run: |
43+
set -eEuo pipefail
44+
got=$(node json-to-go.js -big < tests/double-nested-objects.json)
45+
exp=$(cat tests/double-nested-objects.go)
46+
echo "got: '${got}'"
47+
[[ "${got}" == "${exp}" ]]
48+
49+
- name: Run json-to-go with a file
50+
shell: bash
51+
run: |
52+
set -eEuo pipefail
53+
got=$(node json-to-go.js tests/double-nested-objects.json)
54+
exp=$(cat tests/double-nested-objects.go)
55+
echo "got: '${got}'"
56+
[[ "${got}" == "${exp}" ]]

0 commit comments

Comments
 (0)