-
Notifications
You must be signed in to change notification settings - Fork 290
/
Copy pathjq.yaml
67 lines (58 loc) · 1.95 KB
/
jq.yaml
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
package:
name: jq
version: 1.7.1
epoch: 0
description: "a lightweight and flexible JSON processor"
copyright:
- license: MIT
environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- oniguruma-dev
- wolfi-base
pipeline:
- uses: fetch
with:
uri: https://github.com/jqlang/jq/releases/download/jq-${{package.version}}/jq-${{package.version}}.tar.gz
expected-sha256: 478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2
- uses: autoconf/configure
- uses: autoconf/make-install
- uses: strip
subpackages:
- name: "jq-dev"
description: "headers for libjq"
pipeline:
- uses: split/dev
- name: "jq-doc"
description: "jq documentation"
pipeline:
- uses: split/manpages
update:
enabled: true
github:
identifier: jqlang/jq
strip-prefix: jq-
tag-filter: jq-
test:
pipeline:
- name: Verify jq installation
runs: |
jq --version || exit 1
- name: Basic JSON parsing
runs: |
echo '{"name":"John", "age":31, "city":"New York"}' | jq '.name' | grep 'John' || exit 1
- name: Complex JSON parsing
runs: |
echo '{"employees":[{"firstName":"John", "lastName":"Doe"},{"firstName":"Anna", "lastName":"Smith"},{"firstName":"Peter", "lastName":"Jones"}]}' | jq '.employees[] | select(.firstName=="Anna").lastName' | grep 'Smith' || exit 1
- name: JSON construction
runs: |
echo '{"name":"John", "age":31}' | jq '. + {"city":"New York"}' | grep 'New York' || exit 1
- name: Filtering JSON arrays
runs: |
echo '[{"id":1,"name":"John"},{"id":2,"name":"Jane"},{"id":3,"name":"Doe"}]' | jq '.[] | select(.id > 1)' | grep -E 'Jane|Doe' || exit 1
- name: Using jq to transform JSON structure
runs: |
echo '[{"id":1,"name":"John"},{"id":2,"name":"Jane"}]' | jq '{users: map({userId: .id, userName: .name})}' | grep -E '"userId": 1|"userId": 2' || exit 1