diff --git a/.github/workflows/compiler.yml b/.github/workflows/compiler.yml index dd0d74b13..b30b2fc6a 100644 --- a/.github/workflows/compiler.yml +++ b/.github/workflows/compiler.yml @@ -2,7 +2,7 @@ name: Continuous integration - compiler on: push: - branches: [ main ] + branches: [ main, testci ] pull_request: env: diff --git a/.github/workflows/optimizer-expensive-tests.yml b/.github/workflows/optimizer-expensive-tests.yml new file mode 100644 index 000000000..6a1b4ddac --- /dev/null +++ b/.github/workflows/optimizer-expensive-tests.yml @@ -0,0 +1,26 @@ +name: Continuous integration - Extra tests + +on: + push: + branches: [ main, testci ] + pull_request: + +env: + CARGO_TERM_COLOR: always +jobs: + check-concrete-optimizer-expensive-tests: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: -D warnings + steps: + - uses: actions/checkout@v3 + + - name: "Setup" + uses: ./.github/workflows/setup + with: + ssh_private_key: ${{ secrets.CONCRETE_COMPILER_CI_SSH_PRIVATE }} + + - name: Tests + run: | + cd v0-parameters + cargo test --release --no-fail-fast --features=expensive_tests diff --git a/.github/workflows/optimizer.yml b/.github/workflows/optimizer.yml index 76f5ef2ce..292523405 100644 --- a/.github/workflows/optimizer.yml +++ b/.github/workflows/optimizer.yml @@ -2,7 +2,7 @@ name: Continuous integration on: push: - branches: [ main ] + branches: [ main, testci ] pull_request: env: @@ -13,22 +13,12 @@ jobs: env: RUSTFLAGS: -D warnings steps: - - name: Code checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Rust install - uses: actions-rs/toolchain@v1 + - name: "Setup" + uses: ./.github/workflows/setup with: - toolchain: stable - - - name: Download cargo cache - uses: Swatinem/rust-cache@v1 - - # A SSH private key is required as some dependencies are from private repos - - name: Set ssh keys - uses: webfactory/ssh-agent@v0.5.2 - with: - ssh-private-key: ${{ secrets.CONCRETE_COMPILER_CI_SSH_PRIVATE }} + ssh_private_key: ${{ secrets.CONCRETE_COMPILER_CI_SSH_PRIVATE }} - name: Formatting run: cargo fmt --check diff --git a/.github/workflows/setup/action.yml b/.github/workflows/setup/action.yml new file mode 100644 index 000000000..cd47d3aa8 --- /dev/null +++ b/.github/workflows/setup/action.yml @@ -0,0 +1,21 @@ +inputs: + ssh_private_key: + description: 'A ssh key to access private github repository' + required: true + +runs: + using: "composite" + steps: + - name: Rust install + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + - name: Download cargo cache + uses: Swatinem/rust-cache@v1 + + # A SSH private key is required as some dependencies are from private repos + - name: Set ssh keys + uses: webfactory/ssh-agent@v0.5.2 + with: + ssh-private-key: ${{ inputs.ssh_private_key }} diff --git a/v0-parameters/Cargo.toml b/v0-parameters/Cargo.toml index 023b8bb4c..7c7e95259 100644 --- a/v0-parameters/Cargo.toml +++ b/v0-parameters/Cargo.toml @@ -3,6 +3,9 @@ name = "v0-parameters" version = "0.1.0" edition = "2021" +[features] +expensive_tests = [] + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/v0-parameters/src/lib.rs b/v0-parameters/src/lib.rs index bdf08111f..8bc0254e5 100644 --- a/v0-parameters/src/lib.rs +++ b/v0-parameters/src/lib.rs @@ -177,11 +177,29 @@ mod tests { use super::*; use concrete_optimizer::security::security_weights::SECURITY_WEIGHTS_TABLE; + #[cfg(not(feature = "expensive_tests"))] + const ONLY_SOME_SECURITY_LEVELS: bool = true; + + #[cfg(feature = "expensive_tests")] + const ONLY_SOME_SECURITY_LEVELS: bool = false; + + fn security_levels_to_test() -> Vec { + if ONLY_SOME_SECURITY_LEVELS { + vec![128] + } else { + SECURITY_WEIGHTS_TABLE.keys().copied().collect() + } + } + #[test] fn test_reference_output() { + check_reference_output_on_levels(&security_levels_to_test()); + } + + fn check_reference_output_on_levels(security_levels: &[u64]) { const CMP_LINES: &str = "\n"; const EXACT_EQUALITY: i32 = 0; - for &security_level in SECURITY_WEIGHTS_TABLE.keys() { + for &security_level in security_levels { let ref_file: &str = &format!("ref/v0_2022-7-4_{}", security_level); let args: Args = Args { min_precision: 1, @@ -214,9 +232,13 @@ mod tests { #[test] fn test_reference_wop_output() { + check_reference_wop_output_on_levels(&security_levels_to_test()); + } + + fn check_reference_wop_output_on_levels(security_levels: &[u64]) { const CMP_LINES: &str = "\n"; const EXACT_EQUALITY: i32 = 0; - for &security_level in SECURITY_WEIGHTS_TABLE.keys() { + for &security_level in security_levels { let ref_file: &str = &format!("ref/wop_pbs_2022-7-11_{}", security_level); let args = Args {