43 lines
No EOL
1.1 KiB
YAML
43 lines
No EOL
1.1 KiB
YAML
name: compile jq
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
compile-jq:
|
|
runs-on: archlinux-latest
|
|
container:
|
|
image: archlinux:latest
|
|
|
|
steps:
|
|
- name: install packages and prepare source
|
|
run: |
|
|
pacman -Sy --noconfirm wget base-devel autoconf automake bison flex python
|
|
wget https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-1.8.1.tar.gz
|
|
tar -xf jq-1.8.1.tar.gz
|
|
|
|
- name: compile jq
|
|
run: |
|
|
cd jq-1.8.1
|
|
./configure --prefix=/usr
|
|
make -j$(nproc)
|
|
make prefix=/usr install
|
|
|
|
|
|
- name: run jq
|
|
run: |
|
|
echo '[
|
|
{"first": "first ok"},
|
|
{"second": "second ok"},
|
|
{"third": "third ok"},
|
|
{"fourth": "fourth ok"},
|
|
{"fifth": "fifth ok"}
|
|
]' > test.json
|
|
echo "all"
|
|
jq '.[].first // .[].second // .[].third // .[].fourth // .[].fifth' test.json
|
|
echo "only object third"
|
|
jq '.[] | select(has("third"))' test.json
|
|
echo "only fourth"
|
|
jq '.[3].fourth' test.json |