Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: yet more CI improvements #927

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-jvm-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
75 changes: 26 additions & 49 deletions crypto-ffi/Makefile.toml
Original file line number Diff line number Diff line change
@@ -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 ####################################

Expand Down Expand Up @@ -85,7 +85,7 @@ args = [
command = "wasm-pack"
args = [
"build",
"--locked",
"--frozen",
"--no-pack",
"--out-dir", "bindings/js/src",
"--out-name", "core-crypto-ffi",
Expand All @@ -105,7 +105,7 @@ args = ["run", "--cwd", "bindings/js", "build"]
command = "cargo"
args = [
"run",
"--locked",
"--frozen",
"--release",
"--features", "uniffi/cli",
"--bin", "uniffi-bindgen",
Expand All @@ -125,7 +125,7 @@ script = '''
command = "cargo"
args = [
"run",
"--locked",
"--frozen",
"--release",
"--features", "uniffi/cli",
"--bin", "uniffi-bindgen",
Expand All @@ -140,7 +140,7 @@ args = [
command = "cargo"
args = [
"run",
"--locked",
"--frozen",
"--release",
"--features", "uniffi/cli",
"--bin", "uniffi-bindgen",
Expand All @@ -157,24 +157,29 @@ 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" }
condition = { platforms = ["mac"] }
command = "cargo"
args = ["rustc", "--target", "aarch64-apple-ios", "--crate-type=cdylib", "--crate-type=staticlib", "--release", "--locked", "--", "-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"]
condition = { platforms = ["mac"] }
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "x86_64-apple-ios",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand All @@ -191,7 +196,7 @@ condition = { platforms = ["mac"] }
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "aarch64-apple-ios-sim",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand Down Expand Up @@ -222,7 +227,7 @@ plugin = "android-env"
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "armv7-linux-androideabi",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand All @@ -236,7 +241,7 @@ dependencies = ["android-env"]
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "aarch64-linux-android",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand All @@ -250,7 +255,7 @@ dependencies = ["android-env"]
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "x86_64-linux-android",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand All @@ -271,7 +276,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",
Expand All @@ -286,7 +291,7 @@ condition = { platforms = ["mac"] }
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "aarch64-apple-darwin",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand All @@ -297,11 +302,11 @@ args = [
dependencies = ["bindings-kotlin-jvm"]
condition = { platforms = ["mac"] }

[tasks.jvm-x86-linux]
[tasks.jvm-linux]
command = "cargo"
args = [
"rustc",
"--locked",
"--frozen",
"--target", "x86_64-unknown-linux-gnu",
"--crate-type=cdylib",
"--crate-type=staticlib",
Expand All @@ -315,9 +320,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"]

Expand All @@ -330,34 +332,13 @@ 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

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"
Expand Down Expand Up @@ -385,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
Expand All @@ -397,10 +377,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
Expand Down
Loading