diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 35030c7..fc931db 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -1,4 +1,4 @@ -name: compile bc +name: compile jq on: push: @@ -6,7 +6,7 @@ on: - main jobs: - compile-bc: + compile-jq: runs-on: archlinux-latest container: image: archlinux:latest @@ -14,25 +14,30 @@ jobs: steps: - name: install packages and prepare source run: | - pacman -Sy --noconfirm wget base-devel ed readline - wget https://ftp.gnu.org/gnu/bc/bc-1.08.2.tar.gz - tar -xf bc-1.08.2.tar.gz + 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 - - name: compile bc + - name: compile jq run: | - cd bc-1.08.2 - ./configure \ - --prefix=/usr \ - --mandir=/usr/share/man \ - --infodir=/usr/share/info \ - --with-readline - make -j1 - make install + cd jq-1.8.1 + ./configure --prefix=/usr + make -j$(nproc) + make prefix=/usr install - - name: run bc + - name: run jq run: | - echo "2+2 = " - echo "2+2" | bc - echo "2+2*2 = " - echo "2+2*2" | bc \ No newline at end of file + 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 \ No newline at end of file