diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..27465c4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + paths-ignore: + - '**/*.md' + push: + branches: + - main + paths-ignore: + - '**/*.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +jobs: + check: + name: Check + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + - os: ubuntu-latest + - os: macos-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: ci + save-if: ${{ github.ref_name == 'main' }} + + - run: rustup show + + - name: Cargo Check + shell: bash + run: | + cargo check --all-targets --all-features --locked + cargo test --no-run --all-targets --all-features + + format: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - run: rustup show + + - run: cargo fmt --all -- --check + + lint: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: ci + save-if: false + + - run: rustup show + + - run: cargo clippy -- -D warnings + + test: + name: Test + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + - os: ubuntu-latest + - os: macos-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: ci + save-if: false + + - run: rustup show + + - run: cargo test diff --git a/.gitignore b/.gitignore index 4fffb2f..ea8c4bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /target -/Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..175268a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,90 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ada-url" +version = "0.1.0" +dependencies = [ + "cc", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +dependencies = [ + "jobserver", +] + +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.144" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" + +[[package]] +name = "proc-macro2" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" diff --git a/build.rs b/build.rs index 95f59af..14f99dd 100644 --- a/build.rs +++ b/build.rs @@ -9,7 +9,8 @@ fn main() { build .file("./deps/ada.cpp") .include("./deps/ada.h") - .include("./deps/ada_c.h"); + .include("./deps/ada_c.h") + .cpp(true); let compile_target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS"); let compile_target_env = env::var("CARGO_CFG_TARGET_ENV").expect("CARGO_CFG_TARGET_ENV"); diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..02cb8fc --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +profile = "default"