Repository navigation
154 lines (146 loc) · 4.99 KB
/
Copy pathci.yml
File metadata and controls
154 lines (146 loc) · 4.99 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# A new push to a pull request cancels its previous run.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unix:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
# A failure of the macOS runner does not fail the run.
continue-on-error: ${{ matrix.name == 'macos' }}
strategy:
fail-fast: false
matrix:
include:
- {name: ubuntu-gcc, os: ubuntu-24.04, cc: gcc, cxx: g++, type: Release, flags: ""}
- {name: ubuntu-clang, os: ubuntu-24.04, cc: clang, cxx: clang++, type: Release, flags: ""}
- {name: ubuntu-sanitize, os: ubuntu-24.04, cc: gcc, cxx: g++, type: Debug, flags: "-DSJQ_SANITIZE=ON"}
- {name: ubuntu-arm64, os: ubuntu-24.04-arm, cc: gcc, cxx: g++, type: Release, flags: ""}
- {name: macos, os: macos-15, cc: clang, cxx: clang++, type: Release, flags: ""}
steps:
- uses: actions/checkout@v6
- name: Configure
run: >
CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DSJQ_WERROR=ON ${{ matrix.flags }}
- name: Build
run: cmake --build build -j 4
- name: Test
run: ctest --test-dir build --output-on-failure
windows-vs:
name: windows-vs
runs-on: windows-2025
steps:
- uses: actions/checkout@v6
- name: Configure
run: cmake -A x64 -DSJQ_WERROR=ON -B build
- name: Build
run: cmake --build build --config Release
- name: Test
run: ctest --test-dir build -C Release --output-on-failure
windows-mingw:
name: windows-ucrt64
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
env:
CMAKE_GENERATOR: Ninja
steps:
- uses: actions/checkout@v6
- uses: msys2/setup-msys2@v2
with:
update: true
msystem: UCRT64
install: mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-python
- name: Build and test
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSJQ_WERROR=ON
cmake --build build
ctest --test-dir build --output-on-failure
fuzz:
name: fuzz
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Build the fuzzer
run: >
CC=clang CXX=clang++
CXXFLAGS="-fsanitize=fuzzer-no-link,address,undefined"
LDFLAGS="-fsanitize=address,undefined"
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSJQ_FUZZING=ON &&
cmake --build build --target fuzz_sjq
- name: Fuzz for three minutes
run: |
python3 tests/fuzz_seeds.py corpus
UBSAN_OPTIONS=halt_on_error=1 build/fuzz_sjq corpus -dict=tests/fuzz.dict -max_total_time=180 -timeout=10 -rss_limit_mb=2048 -artifact_prefix=./
- name: Keep the crashing inputs
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-artifacts
path: |
crash-*
timeout-*
oom-*
# The install scripts, against the latest release.
install-windows:
name: install-ps1
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Windows PowerShell 5
shell: powershell
run: |
$env:SJQ_INSTALL_DIR = "$env:RUNNER_TEMP\sjq5"
Get-Content -Raw .\install.ps1 | Invoke-Expression
sjq --version
'{"a": 1}' | sjq .a
- name: PowerShell 7
shell: pwsh
run: |
$env:SJQ_INSTALL_DIR = "$env:RUNNER_TEMP\sjq7"
Get-Content -Raw ./install.ps1 | Invoke-Expression
sjq --version
install-unix:
name: install-sh
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: install.sh
run: |
SJQ_INSTALL_DIR="$RUNNER_TEMP/sjq" sh install.sh
"$RUNNER_TEMP/sjq/sjq" --version
- name: install.sh with SJQ_MODIFY_PATH=1, twice
run: |
home="$RUNNER_TEMP/home"
mkdir -p "$home"
HOME="$home" SHELL=/bin/bash SJQ_MODIFY_PATH=1 sh install.sh
HOME="$home" SHELL=/bin/bash SJQ_MODIFY_PATH=1 sh install.sh
test "$(grep -c '.local/bin' "$home/.bashrc")" = 1
install-scoop:
name: install-scoop
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Scoop, with this repository as the bucket
shell: pwsh
run: |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
$env:Path += ";$env:USERPROFILE\scoop\shims"
# A bucket is a Git repository: this checkout, by a file URL.
scoop bucket add sjq ("file:///" + ($env:GITHUB_WORKSPACE -replace '\\', '/'))
scoop install sjq/sjq
sjq --version
'{"a": 1}' | sjq .a