From a0a51de625e6ebc467b7095d31525e7d09da7a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 18:26:41 +0100 Subject: [PATCH 1/8] chore: ci: add missing --frozen options We want all commands on CI to work with exactly the versions of crates specified by Cargo.lock and we don't want cargo to look for updates. --- .github/workflows/benchmarks.yml | 2 +- .github/workflows/coverage.yml | 2 +- .github/workflows/rust.yml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 671591d6e1..d47e8222ed 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -24,7 +24,7 @@ jobs: bencher-api-token: ${{ secrets.BENCHER_API_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} adapter: rust_criterion - bench-command: cargo bench --bench ${{ matrix.rust_bench }} -- --quick + bench-command: cargo bench --frozen --bench ${{ matrix.rust_bench }} -- --quick web_benchmarks_with_bencher: name: web benchmarks with bencher diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 11e31c04f8..dc8fbe33e9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,7 +29,7 @@ jobs: - name: install cargo-nextest uses: taiki-e/install-action@nextest - name: generate code coverage - run: cargo llvm-cov nextest --workspace --lcov --exclude interop --output-path lcov.info + run: cargo llvm-cov nextest --frozen --workspace --lcov --exclude interop --output-path lcov.info - name: upload to codecov.io uses: codecov/codecov-action@v5 with: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5dfad59833..a656089c3f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -27,9 +27,9 @@ jobs: tool: - name: fmt trailer: --all -- --check - - name: clippy + - name: clippy --frozen trailer: -- -D warnings - - name: check + - name: check --frozen trailer: --tests target: ["", "--target wasm32-unknown-unknown"] exclude: @@ -54,9 +54,9 @@ jobs: rustflags: '' - uses: taiki-e/install-action@nextest - name: "test corecrypto" - run: cargo nextest run --verbose + run: cargo nextest run --verbose --frozen - name: "test corecrypto documentation" - run: cargo test --doc + run: cargo test --doc --frozen - name: "upload test results" if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 @@ -73,7 +73,7 @@ jobs: - name: "test keystore regressions" run: | cd extras/keystore-regression-versions - cargo run + cargo run --frozen proteus-test: runs-on: ubuntu-latest @@ -84,7 +84,7 @@ jobs: rustflags: '' - uses: taiki-e/install-action@nextest - name: "test corecrypto's proteus implementation" - run: cargo nextest run --verbose --features proteus,cryptobox-migrate,proteus-keystore proteus + run: cargo nextest run --frozen --verbose --features proteus,cryptobox-migrate,proteus-keystore proteus wasm-test: runs-on: ubuntu-latest From d05b55b7ac2231bdbed105cdc1cd6a7ff60fa042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 18:31:35 +0100 Subject: [PATCH 2/8] chore: crypto-ffi: use --frozen instead of --locked --frozen implies both --locked and --offline, which avoids network access. --- crypto-ffi/Makefile.toml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/crypto-ffi/Makefile.toml b/crypto-ffi/Makefile.toml index 5d3b2da18f..e48472d9b6 100644 --- a/crypto-ffi/Makefile.toml +++ b/crypto-ffi/Makefile.toml @@ -85,7 +85,7 @@ args = [ command = "wasm-pack" args = [ "build", - "--locked", + "--frozen", "--no-pack", "--out-dir", "bindings/js/src", "--out-name", "core-crypto-ffi", @@ -105,7 +105,7 @@ args = ["run", "--cwd", "bindings/js", "build"] command = "cargo" args = [ "run", - "--locked", + "--frozen", "--release", "--features", "uniffi/cli", "--bin", "uniffi-bindgen", @@ -125,7 +125,7 @@ script = ''' command = "cargo" args = [ "run", - "--locked", + "--frozen", "--release", "--features", "uniffi/cli", "--bin", "uniffi-bindgen", @@ -140,7 +140,7 @@ args = [ command = "cargo" args = [ "run", - "--locked", + "--frozen", "--release", "--features", "uniffi/cli", "--bin", "uniffi-bindgen", @@ -166,7 +166,7 @@ dependencies = ["bindings-swift"] env = { "IPHONEOS_DEPLOYMENT_TARGET"="16.0" } condition = { platforms = ["mac"] } command = "cargo" -args = ["rustc", "--target", "aarch64-apple-ios", "--crate-type=cdylib", "--crate-type=staticlib", "--release", "--locked", "--", "-C", "strip=symbols"] +args = ["rustc", "--target", "aarch64-apple-ios", "--crate-type=cdylib", "--crate-type=staticlib", "--release", "--frozen", "--", "-C", "strip=symbols"] [tasks.ios-simulator-x86] dependencies = ["bindings-swift"] @@ -174,7 +174,7 @@ condition = { platforms = ["mac"] } command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "x86_64-apple-ios", "--crate-type=cdylib", "--crate-type=staticlib", @@ -191,7 +191,7 @@ condition = { platforms = ["mac"] } command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "aarch64-apple-ios-sim", "--crate-type=cdylib", "--crate-type=staticlib", @@ -222,7 +222,7 @@ plugin = "android-env" command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "armv7-linux-androideabi", "--crate-type=cdylib", "--crate-type=staticlib", @@ -236,7 +236,7 @@ dependencies = ["android-env"] command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "aarch64-linux-android", "--crate-type=cdylib", "--crate-type=staticlib", @@ -250,7 +250,7 @@ dependencies = ["android-env"] command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "x86_64-linux-android", "--crate-type=cdylib", "--crate-type=staticlib", @@ -271,7 +271,7 @@ dependencies = ["android-armv7", "android-armv8", "android-x86"] command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "x86_64-apple-darwin", "--crate-type=cdylib", "--crate-type=staticlib", @@ -286,7 +286,7 @@ condition = { platforms = ["mac"] } command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "aarch64-apple-darwin", "--crate-type=cdylib", "--crate-type=staticlib", @@ -301,7 +301,7 @@ condition = { platforms = ["mac"] } command = "cargo" args = [ "rustc", - "--locked", + "--frozen", "--target", "x86_64-unknown-linux-gnu", "--crate-type=cdylib", "--crate-type=staticlib", From 1ab580b24bb2899a86e9c5659fc62fb8b54adbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 18:56:04 +0100 Subject: [PATCH 3/8] chore: ci: it's a dynamic library, not static --- .github/workflows/build-jvm-linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-jvm-linux.yml b/.github/workflows/build-jvm-linux.yml index e235e88d62..ac8fe4caf8 100644 --- a/.github/workflows/build-jvm-linux.yml +++ b/.github/workflows/build-jvm-linux.yml @@ -24,7 +24,7 @@ jobs: run: | cd crypto-ffi cargo make jvm-linux - - name: upload static rust library + - name: upload dynamic library uses: actions/upload-artifact@v4 with: name: jvm-linux-so-file-${{ github.run_id }} From 68dfb36febf93bc32aace157e44a40eca533deab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 18:57:05 +0100 Subject: [PATCH 4/8] chore: crypto-ffi: remove unnecessary task jvm-x86-linux --- crypto-ffi/Makefile.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crypto-ffi/Makefile.toml b/crypto-ffi/Makefile.toml index e48472d9b6..735173f1a5 100644 --- a/crypto-ffi/Makefile.toml +++ b/crypto-ffi/Makefile.toml @@ -297,7 +297,7 @@ args = [ dependencies = ["bindings-kotlin-jvm"] condition = { platforms = ["mac"] } -[tasks.jvm-x86-linux] +[tasks.jvm-linux] command = "cargo" args = [ "rustc", @@ -315,9 +315,6 @@ condition = { platforms = ["linux"] } [tasks.jvm-darwin] dependencies = ["jvm-aarch64-darwin", "jvm-x86-darwin"] -[tasks.jvm-linux] -dependencies = ["jvm-x86-linux"] - [tasks.jvm] dependencies = ["jvm-darwin", "jvm-linux"] From df199a891a5c0a9eb3148bb0f0546aa59f96dfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 19:00:21 +0100 Subject: [PATCH 5/8] chore: crypto-ffi: remove ios-env task and related plugin They're unused. --- crypto-ffi/Makefile.toml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/crypto-ffi/Makefile.toml b/crypto-ffi/Makefile.toml index 735173f1a5..3874dde0ad 100644 --- a/crypto-ffi/Makefile.toml +++ b/crypto-ffi/Makefile.toml @@ -157,10 +157,6 @@ dependencies = ["bindings-kotlin-android", "bindings-kotlin-jvm"] dependencies = ["bindings-swift", "bindings-kotlin"] ##################################### iOS ##################################### - -[tasks.ios-env] -plugin = "detect-release" - [tasks.ios-device] dependencies = ["bindings-swift"] env = { "IPHONEOS_DEPLOYMENT_TARGET"="16.0" } @@ -327,25 +323,6 @@ dependencies = ["android", "ios"] dependencies = ["mobile", "wasm"] ################################### Plugins ################################### -[plugins.impl.detect-release] -script = ''' -index = array_contains ${task.args} "--release" -if index - set_env IS_RELEASE_BUILD "release" - println -c bright_blue "Release mode detected!" -end - -release_path = set IS_RELEASE_BUILD or "debug" - -# index_target = array_contains ${task.args} "--target" -# if index_target -# target = array_get ${task.args} ${${index_target} + 1} -# set_env CORECRYPTO_TARGET_FOLDER "../target/${target}/${release_path}" -# else -# set_env CORECRYPTO_TARGET_FOLDER "../target/${release_path}" -# end -''' - [plugins.impl.android-env] script = ''' exit_on_error true From a54f470f9c18da49411d6e56a7bc891ebf7e06d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 19:04:14 +0100 Subject: [PATCH 6/8] chore: crypto-ffi: use consistent style for arguments --- crypto-ffi/Makefile.toml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crypto-ffi/Makefile.toml b/crypto-ffi/Makefile.toml index 3874dde0ad..ee1b89a071 100644 --- a/crypto-ffi/Makefile.toml +++ b/crypto-ffi/Makefile.toml @@ -162,7 +162,16 @@ dependencies = ["bindings-swift"] env = { "IPHONEOS_DEPLOYMENT_TARGET"="16.0" } condition = { platforms = ["mac"] } command = "cargo" -args = ["rustc", "--target", "aarch64-apple-ios", "--crate-type=cdylib", "--crate-type=staticlib", "--release", "--frozen", "--", "-C", "strip=symbols"] +args = [ + "rustc", + "--frozen", + "--target", "aarch64-apple-ios", + "--crate-type=cdylib", + "--crate-type=staticlib", + "--release", + "--", + "-C", "strip=symbols" +] [tasks.ios-simulator-x86] dependencies = ["bindings-swift"] From 80192ba8d29fb8cabf53ebf64fff431856bcc173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 19:07:56 +0100 Subject: [PATCH 7/8] chore: crypto-ffi: we don't support Windows --- crypto-ffi/Makefile.toml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/crypto-ffi/Makefile.toml b/crypto-ffi/Makefile.toml index ee1b89a071..0fa2d4a02a 100644 --- a/crypto-ffi/Makefile.toml +++ b/crypto-ffi/Makefile.toml @@ -1,6 +1,6 @@ [env] ANDROID_NDK_PREFER_VERSION = "25.2" -LIBRARY_EXTENSION = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "so", mapping = { "linux" = "so", "macos" = "dylib", "windows" = "dll" } } +LIBRARY_EXTENSION = { source = "${CARGO_MAKE_RUST_TARGET_OS}", mapping = { "linux" = "so", "macos" = "dylib" } } ##################################### DOCS #################################### @@ -338,9 +338,7 @@ exit_on_error true fn update_android_env platform = os_family - if eq ${platform} "windows" - platform_dir = set "windows-x86_64" - elseif eq ${platform} "linux" + if eq ${platform} "linux" platform_dir = set "linux-x86_64" elseif eq ${platform} "mac" platform_dir = set "darwin-x86_64" @@ -380,10 +378,7 @@ fn autodetect_android_env platform = os_family sdk_folder = set "Sdk" - if eq ${platform} "windows" - platform_dir = get_home_dir - platform_dir = set "${platform_dir}/AppData/Local" - elseif eq ${platform} "linux" + if eq ${platform} "linux" platform_dir = get_home_dir elseif eq ${platform} "mac" platform_dir = get_home_dir From ed736698fe165e4e32445aae123bae562cf06ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Stankovi=C4=87?= Date: Fri, 21 Feb 2025 19:15:11 +0100 Subject: [PATCH 8/8] chore: crypto-ffi: we don't support i686 Android anymore --- crypto-ffi/Makefile.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/crypto-ffi/Makefile.toml b/crypto-ffi/Makefile.toml index 0fa2d4a02a..6e49d41eac 100644 --- a/crypto-ffi/Makefile.toml +++ b/crypto-ffi/Makefile.toml @@ -366,7 +366,6 @@ fn update_android_env set_env CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_ANDROID_NDK "${base_ndk_path}" set_env CARGO_TARGET_AARCH64_LINUX_ANDROID_ANDROID_NDK "${base_ndk_path}" set_env CARGO_TARGET_X86_64_LINUX_ANDROID_ANDROID_NDK "${base_ndk_path}" - set_env CARGO_TARGET_I686_LINUX_ANDROID_ANDROID_NDK "${base_ndk_path}" end fn autodetect_android_env