Skip to content

Commit

Permalink
ci: add ci for macos and windows
Browse files Browse the repository at this point in the history
  • Loading branch information
liuq19 committed Dec 26, 2023
1 parent e4951d7 commit 7d9db40
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 22 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
needs:
- test-linux
- test-linux-aarch64
- test-macos
- test-windows
- lint
steps:
- run: exit 0
Expand All @@ -31,14 +33,10 @@ jobs:
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: |
cargo check
cargo test --examples
cargo test
cargo install cargo-fuzz
cargo +nightly fuzz run fuzz_value -- -max_total_time=5m
./scripts/test.sh
cargo clippy --all-features -- -D warnings
./scripts/test_all.sh
./scripts/sanitize.sh
test-linux-aarch64:
runs-on: [self-hosted, arm]

Expand All @@ -49,10 +47,32 @@ jobs:
components: rustfmt
# - uses: Swatinem/rust-cache@v1
- name: Run tests
run: |
cargo check
cargo test
cargo test --examples
run: ./scripts/test_all.sh

test-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: ./scripts/test_all.sh


test-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: ./scripts/test_all.sh

lint:
runs-on: [self-hosted, X64]
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ bytes = "1.4"
thiserror = "1.0"
simdutf8 = "0.1"
parking_lot = "0.12"
libc = "0.2"
page_size = "0.6"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/handle_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ fn main() {
// ......^...
assert_eq!(
format!("{}", err),
"Invalid UTF-8 characters in json at line 1 column 6\n\n\t{\"b\":\"\"}\n\t......^...\n"
"Invalid UTF-8 characters in json at line 1 column 6\n\n\t{\"b\":\"\"}\n\t......^..\n"
);
}
7 changes: 3 additions & 4 deletions examples/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ fn main() {

// deal with errors when invalid json
if elem.is_err() {
assert_eq!(
elem.err().unwrap().to_string(),
assert!(elem.err().unwrap().to_string().starts_with(
"Expected this character to be either a ',' or a ']' while parsing at line 1 \
column 17"
);
column 16"
));
}
}

Expand Down
34 changes: 33 additions & 1 deletion fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions scripts/fuzz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -ex

cargo install cargo-fuzz

cargo +nightly fuzz run fuzz_value -- -max_total_time=5m
11 changes: 11 additions & 0 deletions scripts/run_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -xe

examples=$(cargo build --example 2>&1 | grep -v ":")

for example in $examples; do
echo "Running example $example"
cargo run --example $example
done

File renamed without changes.
12 changes: 12 additions & 0 deletions scripts/test_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -ex

cargo test

./scripts/run_examples.sh

./scripts/fuzz.sh



4 changes: 2 additions & 2 deletions src/util/arch/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Not use PMULL instructions, but it is apparently slow.
// This is copied from simdjson.
pub fn prefix_xor(bitmask: u64) -> u64 {
pub unsafe fn prefix_xor(bitmask: u64) -> u64 {
let mut bitmask = bitmask;
bitmask ^= bitmask << 1;
bitmask ^= bitmask << 2;
Expand All @@ -12,7 +12,7 @@ pub fn prefix_xor(bitmask: u64) -> u64 {
}

#[inline(always)]
pub fn get_nonspace_bits(data: &[u8; 64]) -> u64 {
pub unsafe fn get_nonspace_bits(data: &[u8; 64]) -> u64 {
let mut mask: u64 = 0;
for (i, p) in data.iter().enumerate() {
if !matches!(*p, b'\t' | b'\n' | b'\r' | b' ') {
Expand Down

0 comments on commit 7d9db40

Please sign in to comment.