Skip to content

Commit 9c7f8d9

Browse files
committed
feat(target_chains/near): add reproducible build to ci
1 parent f79e2bb commit 9c7f8d9

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

.github/workflows/ci-near-contract.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ env:
1616
CARGO_TERM_COLOR: always
1717

1818
jobs:
19-
build:
19+
test:
20+
name: Workspace test
2021
runs-on: ubuntu-latest
2122
defaults:
2223
run:
@@ -25,3 +26,14 @@ jobs:
2526
- uses: actions/checkout@v2
2627
- name: Test
2728
run: ./workspace-test.sh
29+
reproducible-build:
30+
name: Reproducible build
31+
runs-on: ubuntu-latest
32+
defaults:
33+
run:
34+
working-directory: target_chains/near/receiver
35+
steps:
36+
- uses: actions/checkout@v2
37+
- run: sudo apt-get install -y libudev-dev
38+
- run: cargo +stable install --locked cargo-near@0.13.3
39+
- run: cargo near build reproducible-wasm

target_chains/near/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Deploying the NEAR contract has three steps:
1212
1. Create a NEAR key with `near generate-key`
1313
2. Fetch NEAR tokens from an available faucet, at last deploy around 100~ NEAR were needed.
1414
3. See the example deploy script in `scripts/deploy.sh` to deploy the contract. You can find a codehash by:
15-
- `sha256sum pyth.wasm` after building the contract.
15+
- `sha256sum pyth_near.wasm` after building the contract.
1616
- `list(bytes.fromhex(hash))` in Python to get a byte array.
1717
- Replace the `codehash` field in deploy.sh for the initial codehash.
1818
- Replace the sources with the keys expected by the network you're deploying on (testnet vs mainnet).

target_chains/near/receiver/tests/workspaces.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ async fn initialize_chain() -> (
2727

2828
// Deploy Pyth
2929
let contract = worker
30-
.dev_deploy(&std::fs::read("pyth.wasm").expect("Failed to find pyth.wasm"))
30+
.dev_deploy(&std::fs::read("pyth_near.wasm").expect("Failed to find pyth_near.wasm"))
3131
.await
32-
.expect("Failed to deploy pyth.wasm");
32+
.expect("Failed to deploy pyth_near.wasm");
3333

3434
// Deploy Wormhole Stub, this is a dummy contract that always verifies VAA's correctly so we
3535
// can test the ext_wormhole API.

target_chains/near/receiver/workspace-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -euo pipefail
1010
rustup target add wasm32-unknown-unknown
1111

1212
cargo build --release --target wasm32-unknown-unknown
13-
cp target/wasm32-unknown-unknown/release/pyth.wasm .
13+
cp target/wasm32-unknown-unknown/release/pyth_near.wasm .
1414

1515
(
1616
cd ../wormhole-stub

target_chains/near/scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ INIT_JSON=$(echo "$INIT_ARGS" | jq -c '.' -M)
2828
# Deploy..
2929
near deploy \
3030
--accountId "pyth.testnet" \
31-
--wasmFile pyth.wasm \
31+
--wasmFile pyth_near.wasm \
3232
--initFunction new \
3333
--initArgs "$INIT_JSON"

0 commit comments

Comments
 (0)