Skip to content

Commit

Permalink
chore(PocketIC): PocketIC library build on Windows (#2094)
Browse files Browse the repository at this point in the history
This PR adds a GitHub CI flow for PocketIC library build on Windows.
  • Loading branch information
mraszyk authored Oct 17, 2024
1 parent 2e17a1e commit dc88028
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 25 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pocket-ic-build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'PocketIC library build on Windows'
on:
pull_request:
paths:
- packages/pocket-ic/**
push:
branches:
- master
# runs for the same workflow are cancelled on PRs but not on master
# explanation: on push to master head_ref is not set, so we want it to fall back to run_id so it is not cancelled
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
pocket_ic_library_build_windows:
name: 'PocketIC library build on Windows'
runs-on: windows-2022
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'cargo clippy'
run: |
cargo clippy --locked --all-features -p pocket-ic -p pocket-ic-test-canister --all-targets -- -D warnings -D clippy::all -D clippy::mem_forget -C debug-assertions=off
- name: 'cargo build'
run: |
cargo build --release --locked -p pocket-ic
cargo build --release --locked -p pocket-ic-test-canister --target wasm32-unknown-unknown
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"packages/ic-ledger-hash-of",
"packages/ic-signature-verification",
"packages/pocket-ic",
"packages/pocket-ic/test_canister",
"packages/ic-vetkd-utils",
"rs/artifact_pool",
"rs/async_utils",
Expand Down
28 changes: 3 additions & 25 deletions packages/pocket-ic/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")
load("//bazel:canisters.bzl", "rust_canister")
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test_suite")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -46,38 +45,17 @@ rust_library(
deps = DEPENDENCIES,
)

rust_canister(
name = "test_canister",
srcs = ["tests/test_canister.rs"],
service_file = ":tests/test_canister.did",
deps = [
# Keep sorted.
"@crate_index//:candid",
"@crate_index//:ic-cdk",
"@crate_index//:serde",
"@crate_index//:serde_bytes",
],
)

rust_test(
name = "test_canister_unit_test",
crate = ":_wasm_test_canister",
data = ["tests/test_canister.did"],
env = {"CARGO_MANIFEST_DIR": "packages/pocket-ic"},
deps = [":pocket-ic"] + DEPENDENCIES + TEST_DEPENDENCIES,
)

rust_test_suite(
name = "test",
size = "medium",
srcs = ["tests/tests.rs"],
data = [
":test_canister.wasm",
"//packages/pocket-ic/test_canister:test_canister.wasm",
"//rs/pocket_ic_server:pocket-ic-server",
],
env = {
"POCKET_IC_BIN": "$(rootpath //rs/pocket_ic_server:pocket-ic-server)",
"TEST_WASM": "$(rootpath :test_canister.wasm)",
"TEST_WASM": "$(rootpath //packages/pocket-ic/test_canister:test_canister.wasm)",
},
flaky = False,
proc_macro_deps = MACRO_DEPENDENCIES,
Expand Down
14 changes: 14 additions & 0 deletions packages/pocket-ic/test_canister/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("//bazel:canisters.bzl", "rust_canister")

rust_canister(
name = "test_canister",
srcs = ["src/canister.rs"],
service_file = ":canister.did",
deps = [
# Keep sorted.
"@crate_index//:candid",
"@crate_index//:ic-cdk",
"@crate_index//:serde",
"@crate_index//:serde_bytes",
],
)
17 changes: 17 additions & 0 deletions packages/pocket-ic/test_canister/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "pocket-ic-test-canister"
version.workspace = true
authors.workspace = true
edition.workspace = true
description.workspace = true
documentation.workspace = true

[[bin]]
name = "pocket-ic-test-canister"
path = "src/canister.rs"

[dependencies]
candid = { workspace = true }
ic-cdk = { workspace = true }
serde = { workspace = true }
serde_bytes = { workspace = true }
File renamed without changes.
File renamed without changes.

0 comments on commit dc88028

Please sign in to comment.