Skip to content

Commit 4975b01

Browse files
Merge old jqlang/jq master to the latest (#2596)
* Try making some GitHub Actions * GHA: Add OS X, Windows, and Linux w/ scan-build builds * Add link to discord server Add link to discord server * Update Ubuntu to 22.04 for GitHub Actions * Remove if condition for Ubuntu build * Fix MacOS OS on GitHub Actions * Fix python3 package on GitHub Actions * Disalbe valgrind Getting failed tests: https://github.com/jqlang/jq/actions/runs/5113866588/jobs/9193542140#step:9:341 * Format file * Fix macos build * Fix syntax errors of windows build https://github.com/jqlang/jq/actions/runs/5114162556/workflow * Install windows package with choco * Pin oniguruma to 5a24a49d710a9e3bb8ff11d12e1eae5a9f9df40c MacOS build [fails](https://github.com/jqlang/jq/actions/runs/5114162555/jobs/9194126677#step:6:3160) due to ``` posix.c:94:3: error: implicit declaration of function 'onig_end' is invalid in C99 [-Werror,-Wimplicit-function-declaration] onig_end(); ``` The current `oniguruma` revision 6fa38f4084b448592888ed9ee43c6e90a46b5f5c (15 Mar 2017) lacks the following explicit declaration in src/onigposix.h: ``` ONIG_EXTERN int onig_end P_((void)); ``` This was added to oniguruma in revision 5a24a49d710a9e3bb8ff11d12e1eae5a9f9df40c (8 Sep 2017). Ref: #2381 * Revert windows build to use pacman * Don't zip jq.exe * Fixing windows build * Update .gitattriutes for eol on Windows * Skip workflow_dispatch for windows build * Clean up builds * Use LF line endings for all text Ref: actions/checkout#135 * Fix test that has rounding error #2596 (comment) * Enable CI for all --------- Co-authored-by: Nicolas Williams <[email protected]>
1 parent 89caf46 commit 4975b01

File tree

8 files changed

+262
-3
lines changed

8 files changed

+262
-3
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.gitattributes export-ignore
22
.gitignore export-ignore
3+
* text=auto eol=lf

.github/workflows/linux.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Linux Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
linux:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
name: [linux-clang, linux-gcc]
14+
include:
15+
- name: linux-clang
16+
os: ubuntu-22.04
17+
compiler: clang
18+
cflags: ''
19+
- name: linux-gcc
20+
os: ubuntu-22.04
21+
compiler: gcc
22+
cflags: '-Wnonnull'
23+
steps:
24+
- name: Clone repository
25+
uses: actions/checkout@v3
26+
with:
27+
submodules: true
28+
- name: Install packages
29+
run: |
30+
sudo apt-get update -qq
31+
sudo apt-get install -y \
32+
automake \
33+
autoconf \
34+
bison \
35+
flex \
36+
gdb \
37+
python3 \
38+
valgrind
39+
- name: Build
40+
env:
41+
CC: ${{ matrix.compiler }}
42+
MAKEVARS: ${{ matrix.makevars }}
43+
run: |
44+
autoreconf -fi
45+
rm src/lexer.c src/lexer.h
46+
rm src/parser.c src/parser.h
47+
./configure --disable-valgrind --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE
48+
make -j4
49+
make dist
50+
- name: Test
51+
env:
52+
CC: ${{ matrix.compiler }}
53+
MAKEVARS: ${{ matrix.makevars }}
54+
run: |
55+
ulimit -c unlimited
56+
make -j4 check
57+
- name: Upload Test Logs
58+
if: ${{ failure() }}
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: test-logs
62+
path: |
63+
test-suite.log
64+
tests/*.log
65+
- name: Upload Artifacts
66+
uses: actions/upload-artifact@v3
67+
with:
68+
name: jq-${{ matrix.name }}
69+
path: |
70+
jq

.github/workflows/macos.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: MacOS Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
macos:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
name: [macos-12-clang, macos-13-clang]
14+
include:
15+
- name: macos-12-clang
16+
os: macos-12
17+
compiler: clang
18+
- name: macos-13-clang
19+
os: macos-13
20+
compiler: clang
21+
steps:
22+
- name: Clone repository
23+
uses: actions/checkout@v3
24+
with:
25+
submodules: true
26+
- name: Install packages
27+
run: |
28+
brew update
29+
brew install autoconf automake libtool flex bison python3
30+
sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac
31+
- name: Build
32+
env:
33+
CC: ${{ matrix.compiler }}
34+
MAKEVARS: ${{ matrix.makevars }}
35+
run: |
36+
autoreconf -fi
37+
rm src/lexer.c src/lexer.h
38+
rm src/parser.c src/parser.h
39+
./configure --disable-valgrind --with-oniguruma=builtin YACC="$(brew --prefix)/opt/bison/bin/bison -y" $COVERAGE
40+
make -j4
41+
make dist
42+
- name: Test
43+
env:
44+
CC: ${{ matrix.compiler }}
45+
MAKEVARS: ${{ matrix.makevars }}
46+
run: |
47+
ulimit -c unlimited
48+
make -j4 check
49+
- name: Upload Test Logs
50+
if: ${{ failure() }}
51+
uses: actions/upload-artifact@v3
52+
with:
53+
name: test-logs
54+
path: |
55+
test-suite.log
56+
tests/*.log
57+
- name: Upload Artifacts
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: jq-${{ matrix.name }}
61+
path: |
62+
jq

.github/workflows/scanbuild.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Linux Clang scan-build Static Analyzer Build
2+
3+
on:
4+
# Don't do this for PRs. It eats up minutes.
5+
push:
6+
branches:
7+
- 'master'
8+
- 'scan-build'
9+
paths:
10+
- '.github/workflows/scanbuild.yml'
11+
12+
jobs:
13+
unix:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
name: [linux-clang]
19+
include:
20+
- name: linux-clang
21+
os: ubuntu-18.04
22+
compiler: clang
23+
cflags: ''
24+
steps:
25+
- name: Clone repository
26+
uses: actions/checkout@v1
27+
- name: Open Submodule(s)
28+
run: |
29+
git submodule update --init --recursive
30+
- name: Install packages
31+
if: startsWith(matrix.os, 'ubuntu')
32+
run: |
33+
sudo apt-get update -qq
34+
sudo apt-get install -y automake autoconf bison flex gdb python valgrind clang-tools
35+
- name: Prep
36+
run: |
37+
#pyenv global 3.6.7
38+
#pip3 install pipenv
39+
#(cd docs && pipenv sync)
40+
#if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi
41+
echo SHELL=$SHELL
42+
echo PATH=$PATH
43+
which bison
44+
bison --version
45+
46+
- name: Build
47+
env:
48+
CC: ${{ matrix.compiler }}
49+
MAKEVARS: ${{ matrix.makevars }}
50+
run: |
51+
autoreconf -fi
52+
rm src/lexer.c src/lexer.h
53+
rm src/parser.c src/parser.h
54+
./configure --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE
55+
scan-build --keep-going make -j4
56+
- name: Test
57+
env:
58+
CC: ${{ matrix.compiler }}
59+
MAKEVARS: ${{ matrix.makevars }}
60+
run: |
61+
ulimit -c unlimited
62+
scan-build --keep-going make -j4 check
63+
- name: Core dump stacks
64+
run: |
65+
echo "thread apply all bt" > /tmp/x
66+
find . -name core -print | while read core; do gdb -batch -x x `file "$core"|sed -e "s/^[^']*'//" -e "s/[ '].*$//"` "$core"; done
67+
if [ "$(find . -name core -print | wc -l)" -gt 0 ]; then false; fi
68+
- name: Test logs
69+
if: ${{ failure() }}
70+
run: |
71+
cat test-suite.log
72+
cat tests/*.log
73+
- name: Upload Logs
74+
uses: actions/upload-artifact@v2
75+
with:
76+
name: Scan-Build Reports
77+
path: '/tmp/scan-build*/'

.github/workflows/windows.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Windows Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
jobs:
8+
windows:
9+
runs-on: windows-latest
10+
steps:
11+
- name: Clone repository
12+
uses: actions/checkout@v3
13+
with:
14+
submodules: true
15+
- uses: msys2/setup-msys2@v2
16+
with:
17+
update: true
18+
install: >-
19+
base-devel
20+
git
21+
clang
22+
autoconf
23+
automake
24+
libtool
25+
p7zip
26+
- shell: msys2 {0}
27+
run: |
28+
autoreconf -fiv
29+
./configure --disable-valgrind --with-oniguruma=builtin --disable-shared --enable-static --enable-all-static
30+
make -j4
31+
make SUBDIRS= "TESTS=tests/mantest tests/jqtest tests/onigtest tests/base64test" check
32+
- name: Upload Test Logs
33+
if: ${{ failure() }}
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: test-logs
37+
path: |
38+
test-suite.log
39+
tests/*.log
40+
- name: Upload Artifacts
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: jq-windows
44+
path: |
45+
jq.exe

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,8 @@ cross-compilation environment. See also
7272
["Cross compilation"](https://github.com/jqlang/jq/wiki/Cross-compilation) on
7373
the wiki.
7474

75-
Send questions to https://stackoverflow.com/questions/tagged/jq or to the #jq channel (https://web.libera.chat/#jq) on Libera.Chat (https://libera.chat/).
75+
76+
# Community
77+
78+
* Send questions to https://stackoverflow.com/questions/tagged/jq.
79+
* Join our [Discord server](https://discord.gg/yg6yjNmgAC).

tests/jq.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ try (1%.) catch .
15651565
jq: error: Division by zero? at <top-level>, line 1:
15661566

15671567
# Basic numbers tests: integers, powers of two
1568-
[range(-52;52;1)] as $powers | [$powers[]|pow(2;.)|log2] == $powers
1568+
[range(-52;52;1)] as $powers | [$powers[]|pow(2;.)|log2|round] == $powers
15691569
null
15701570
true
15711571

0 commit comments

Comments
 (0)