Skip to content

fix(release): don't use cross for Darwin and Windows builds (#258) #574

fix(release): don't use cross for Darwin and Windows builds (#258)

fix(release): don't use cross for Darwin and Windows builds (#258) #574

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- main
jobs:
audit:
name: audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features -- -D warnings
fmt:
name: format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
test:
name: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- run: cargo test --all-features
shell-tests:
name: shell tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Test pipe
run: if ! echo "{\"a\":4}" | cargo run '"a"' | grep -q "4"; then exit 1; fi
- name: Test raw-string flag
run: if echo "{\"foo\":\"bar\"}" | cargo run '"foo"' -r | grep -q \"bar\"; then exit 1; fi
- name: Test heredoc
run: |
cargo run -q -- '"one"[2:0],"two","three"' <<EOF
{
"one": [1, 2, 3],
"two": 2,
"three": 3
}
{
"one": [4, 5, 6],
"two": 2,
"three": 3
}
EOF
- name: Test streaming flag
run: |
for i in {1..10}; do echo '{"foo": 2}'; sleep 1; done | cargo run '!' -s
- name: Test validate flag
run: |
if ! echo "{\"foo\":\"bar\"}" | cargo run -- -v | grep -q "Valid JSON file or content"; then exit 1; fi
if echo "{\"foo:\"bar\"}" | cargo run -- -v | grep -q "Invalid JSON file or content"; then exit 1; fi
- name: Test broken pipe
run: echo "{\"foo\":\"bar\"}" | cargo run '"foo"' | less -sex
- name: Test query
run: |
echo \"foo\" > selectors.txt
if !echo "{\"foo\":\"bar\"}" | cargo run -- -q selectors.txt | grep -q \"bar\"; then exit 1; fi
bench:
if: "!contains(github.ref, 'refs/heads/main')"
name: bench
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Run the benchmarks against the current branch, main and compare
run: |
git fetch origin main
cargo bench --bench benchmark -- --noplot --save-baseline current
git checkout -b main
cargo bench --bench benchmark -- --noplot --save-baseline main
cargo install critcmp --force
critcmp main current