diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9d9ef63 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build-and-test: + name: Build & Test (stable, beta, nightly) + runs-on: ubuntu-latest + + strategy: + matrix: + toolchain: [stable, beta, nightly] + + steps: + - uses: actions/checkout@v4 + + - name: Install toolchain + uses: actions/setup-rust@v1 + with: + toolchain: ${{ matrix.toolchain }} + components: clippy + + - name: Cache cargo registry + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cargo fmt check + run: cargo fmt --all -- --check + + - name: Build + run: cargo build --all-targets --verbose + + - name: Run tests + run: cargo test --all-targets --verbose + + - name: Run Clippy + run: cargo clippy --all-targets -- -D warnings + + docs: + name: Check Documentation + runs-on: ubuntu-latest + needs: build-and-test + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-rust@v1 + with: + toolchain: stable + + - name: Build docs + run: cargo doc --all --no-deps --verbose \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index a7f9b93..58601f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "backend/spqlios-arithmetic"] - path = backend/spqlios-arithmetic +[submodule "backend/src/implementation/cpu_spqlios/spqlios-arithmetic"] + path = backend/src/implementation/cpu_spqlios/spqlios-arithmetic url = https://github.com/phantomzone-org/spqlios-arithmetic diff --git a/Cargo.lock b/Cargo.lock index ab139e4..3da78e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,8 +39,11 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" name = "backend" version = "0.1.0" dependencies = [ + "byteorder", + "cmake", "criterion", "itertools 0.14.0", + "paste", "rand", "rand_core", "rand_distr", @@ -73,6 +76,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +[[package]] +name = "cc" +version = "1.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" +dependencies = [ + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -131,11 +143,21 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + [[package]] name = "core" version = "0.1.0" dependencies = [ "backend", + "byteorder", "criterion", "itertools 0.14.0", "rand_distr", @@ -145,9 +167,9 @@ dependencies = [ [[package]] name = "criterion" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf7af66b0989381bd0be551bd7cc91912a655a58c6918420c9527b1fd8b4679" +checksum = "e1c047a62b0cc3e145fa84415a3191f628e980b194c2755aa12300a4e6cbd928" dependencies = [ "anes", "cast", @@ -168,12 +190,12 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +checksum = "9b1bcc0dc7dfae599d84ad0b1a55f80cde8af3725da8313b528da95ef783e338" dependencies = [ "cast", - "itertools 0.10.5", + "itertools 0.13.0", ] [[package]] @@ -251,15 +273,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -340,6 +353,12 @@ version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "plotters" version = "0.3.7" @@ -527,18 +546,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.216" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", @@ -557,6 +576,12 @@ dependencies = [ "serde", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "syn" version = "2.0.96" diff --git a/Cargo.toml b/Cargo.toml index 4852656..3e68e2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,5 @@ rand_chacha = "0.9.0" rand_core = "0.9.3" rand_distr = "0.5.1" itertools = "0.14.0" -criterion = "0.6.0" +criterion = "0.7.0" +byteorder = "1.5.0" diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..44031cf --- /dev/null +++ b/NOTICE @@ -0,0 +1,12 @@ +Copyright 2025 Phantom Zone, Jean-Philippe Bossuat + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index 52bc74e..f331783 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,165 @@ -
-
-