Skip to content

Commit 4f189e6

Browse files
author
akorchyn
committed
added pos runtime to the CI build
1 parent 1925e0a commit 4f189e6

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

.github/workflows/pull-request-write.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@ jobs:
5454
with:
5555
ref: ${{ github.event.pull_request.head.sha }}
5656
persist-credentials: false
57-
- run: |
57+
- name: linting documentation
58+
run: nix run .#lint
59+
- name: building-targets
60+
run: |
5861
mkdir out
59-
nix build --print-build-logs --show-trace --no-update-lock-file
60-
cp ./result/lib/golden_gate_runtime.compact.compressed.wasm ./out
62+
nix build .#poa-runtime --print-build-logs --show-trace --no-update-lock-file
63+
cp ./result/lib/golden_gate_poa_runtime.compact.compressed.wasm ./out
64+
nix build .#pos-runtime --print-build-logs --show-trace --no-update-lock-file
65+
cp ./result/lib/golden_gate_pos_runtime.compact.compressed.wasm ./out
6166
nix build .#golden-gate-node --print-build-logs --show-trace --no-update-lock-file
6267
cp ./result/bin/golden-gate-node ./out
63-
# can add here contracts and oci image, etc
64-
nix run .#lint
65-
68+
# can add here contracts and oci image, etc
6669
- name: action-gh-release
6770
# so we do not allow non team members to do releases
6871
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.id != env.OCTOLYTICS_DIMENSION_REPOSITORY_ID) || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.id == env.OCTOLYTICS_DIMENSION_REPOSITORY_ID) }}

flake.nix

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,28 @@
8080
src = rust-src;
8181
};
8282

83-
84-
common-wasm-attrs = common-attrs // rec {
85-
# really would could read it from Cargo.toml and reuse in here and in CI publish script as refactoring
86-
pname = "golden-gate-runtime";
87-
cargoExtraArgs = "--package ${pname} --target wasm32-unknown-unknown --no-default-features --features=aura,with-rocksdb-weights";
83+
common-wasm-deps-attrs = common-attrs // {
84+
cargoExtraArgs = # Removing "-deps" from pname is a hack to utilise this for deps and the actual package
85+
"--package \${pname%\"-deps\"} --target wasm32-unknown-unknown --no-default-features --features=aura,with-rocksdb-weights";
8886
RUSTFLAGS =
8987
"-Clink-arg=--export=__heap_base -Clink-arg=--import-memory";
90-
version = "0.1.0";
9188
};
9289

90+
common-wasm-attrs = common-wasm-deps-attrs // {
91+
src = rust-src;
92+
installPhase = ''
93+
mkdir --parents $out/lib
94+
pname_underscore=''${pname//-/_}
95+
cp ./target/wasm32-unknown-unknown/release/wbuild/$pname/$pname_underscore.compact.compressed.wasm $out/lib
96+
'';
97+
};
9398

9499
common-native-release-attrs = common-attrs // rec {
95100
cargoExtraArgs = "--package ${pname}";
96101
pname = "golden-gate-node";
97102
version = "0.1.0";
98103
};
99104

100-
# calls `cargo vendor` on package deps
101-
common-wasm-deps =
102-
craneLib.buildDepsOnly (common-wasm-attrs // { });
103105
common-native-release-deps =
104106
craneLib.buildDepsOnly (common-native-release-attrs // { });
105107

@@ -130,13 +132,16 @@
130132
[ ./.gitignore ] ./.;
131133
};
132134

133-
golden-gate-runtime = craneLib.buildPackage (common-wasm-attrs // {
134-
installPhase = ''
135-
mkdir --parents $out/lib
136-
cp ./target/wasm32-unknown-unknown/release/wbuild/${common-wasm-attrs.pname}/golden_gate_runtime.compact.compressed.wasm $out/lib
137-
'';
138-
src = rust-src;
139-
cargoArtifacts = common-wasm-deps;
135+
golden-gate-poa-runtime = craneLib.buildPackage (common-wasm-attrs // rec {
136+
pname = "golden-gate-poa-runtime";
137+
version = "0.1.0";
138+
cargoArtifacts = craneLib.buildDepsOnly (common-wasm-deps-attrs // { inherit pname version; });
139+
});
140+
141+
golden-gate-pos-runtime = craneLib.buildPackage (common-wasm-attrs // rec {
142+
pname = "golden-gate-pos-runtime";
143+
version = "0.1.0";
144+
cargoArtifacts = craneLib.buildDepsOnly (common-wasm-deps-attrs // { inherit pname version; });
140145
});
141146

142147
golden-gate-node = craneLib.buildPackage (common-native-release-attrs // {
@@ -233,11 +238,12 @@
233238
};
234239
in
235240
rec {
236-
packages = flake-utils.lib.flattenTree {
237-
inherit golden-gate-runtime golden-gate-node single-fast multi-fast tf-config tf-apply lint;
241+
packages = flake-utils.lib.flattenTree rec {
242+
inherit golden-gate-poa-runtime golden-gate-pos-runtime golden-gate-node single-fast multi-fast tf-config tf-apply lint;
238243
node = golden-gate-node;
239-
runtime = golden-gate-runtime;
240-
default = golden-gate-runtime;
244+
pos-runtime = golden-gate-pos-runtime;
245+
poa-runtime = golden-gate-poa-runtime;
246+
default = poa-runtime;
241247
# we should prune 3 things:
242248
# - running process
243249
# - logs/storages of run proccess

0 commit comments

Comments
 (0)