Skip to content

Commit a96b41d

Browse files
committed
feat: build_all_chainspecs.sh script
test shasum
1 parent cdf96f4 commit a96b41d

6 files changed

+50808
-50783
lines changed

.github/workflows/check-chainspec.yml

+52-48
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ env:
3131
jobs:
3232
check-chainspecs:
3333
runs-on: SubtensorCI
34+
permissions:
35+
contents: write
36+
3437
strategy:
3538
matrix:
3639
rust-branch:
@@ -46,7 +49,6 @@ jobs:
4649
RUSTV: ${{ matrix.rust-branch }}
4750
RUST_BACKTRACE: full
4851
RUST_BIN_DIR: target/${{ matrix.rust-target }}
49-
SKIP_WASM_BUILD: 1
5052
TARGET: ${{ matrix.rust-target }}
5153
steps:
5254
- name: Check-out repository under $GITHUB_WORKSPACE
@@ -69,51 +71,53 @@ jobs:
6971
with:
7072
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}
7173

72-
- name: Build node
73-
run: cargo build
74-
75-
- name: Build finney chainspecs
76-
run: |
77-
./target/debug/node-subtensor build-spec --raw --chain finney > __CI_TESTING__raw_spec_finney.json
78-
./target/debug/node-subtensor build-spec --chain finney > __CI_TESTING__plain_spec_finney.json
79-
80-
- name: Build testnet chainspecs
81-
run: |
82-
./target/debug/node-subtensor build-spec --raw --chain test_finney > __CI_TESTING__raw_spec_testfinney.json
83-
./target/debug/node-subtensor build-spec --chain test_finney > __CI_TESTING__plain_spec_testfinney.json
84-
85-
- name: Check raw_spec_finney.json
86-
run: |
87-
if [ "$(sha256sum __CI_TESTING__raw_spec_finney.json | awk '{print $1}')" != "$(sha256sum raw_spec_finney.json | awk '{print $1}')" ]; then
88-
echo "raw_spec_finney.json needs to be updated."
89-
exit 1
90-
else
91-
echo "raw_spec_finney.json is up to date."
92-
fi
93-
94-
- name: Check plain_spec_finney.json
95-
run: |
96-
if [ "$(sha256sum __CI_TESTING__plain_spec_finney.json | awk '{print $1}')" != "$(sha256sum plain_spec_finney.json | awk '{print $1}')" ]; then
97-
echo "plain_spec_finney.json needs to be updated."
98-
exit 1
99-
else
100-
echo "plain_spec_finney.json is up to date."
101-
fi
102-
103-
- name: Check raw_spec_testfinney.json
104-
run: |
105-
if [ "$(sha256sum __CI_TESTING__raw_spec_testfinney.json | awk '{print $1}')" != "$(sha256sum raw_spec_testfinney.json | awk '{print $1}')" ]; then
106-
echo "raw_spec_testfinney.json needs to be updated."
107-
exit 1
108-
else
109-
echo "raw_spec_testfinney.json is up to date."
110-
fi
111-
112-
- name: Check plain_spec_testfinney.json
74+
- name: Build chainspecs
11375
run: |
114-
if [ "$(sha256sum __CI_TESTING__plain_spec_testfinney.json | awk '{print $1}')" != "$(sha256sum plain_spec_testfinney.json | awk '{print $1}')" ]; then
115-
echo "plain_spec_testfinney.json needs to be updated."
116-
exit 1
117-
else
118-
echo "plain_spec_testfinney.json is up to date."
119-
fi
76+
rustup target add wasm32-unknown-unknown --toolchain nightly-2024-03-05-x86_64-unknown-linux-gnu
77+
rustup component add rust-src --toolchain nightly-2024-03-05-x86_64-unknown-linux-gnu
78+
./scripts/build_all_chainspecs.sh
79+
80+
- uses: stefanzweifel/git-auto-commit-action@v5
81+
82+
# - name: Check raw_spec_finney.json
83+
# run: |
84+
# sha1=$(sha256sum __CI_TESTING__raw_spec_finney.json | awk '{print $1}')
85+
# sha2=$(sha256sum raw_spec_finney.json | awk '{print $1}')
86+
# echo "__CI_TESTING__raw_spec_finney.json SHA256: $sha1"
87+
# echo "raw_spec_finney.json SHA256: $sha2"
88+
# if [ "$sha1" != "$sha2" ]; then
89+
# echo "raw_spec_finney.json needs to be updated."
90+
# exit 1
91+
# else
92+
# echo "raw_spec_finney.json is up to date."
93+
# fi
94+
95+
# - name: Check plain_spec_finney.json
96+
# run: |
97+
# if [ "$(sha256sum __CI_TESTING__plain_spec_finney.json | awk '{print $1}')" != "$(sha256sum plain_spec_finney.json | awk '{print $1}')" ]; then
98+
# diff __CI_TESTING__plain_spec_finney.json plain_spec_finney.json || true
99+
# echo "plain_spec_finney.json needs to be updated. Run './scripts/build_all_chainspecs.sh'."
100+
# exit 1
101+
# else
102+
# echo "plain_spec_finney.json is up to date."
103+
# fi
104+
#
105+
# - name: Check raw_spec_testfinney.json
106+
# run: |
107+
# if [ "$(sha256sum __CI_TESTING__raw_spec_testfinney.json | awk '{print $1}')" != "$(sha256sum raw_spec_testfinney.json | awk '{print $1}')" ]; then
108+
# diff __CI_TESTING__raw_spec_testfinney.json raw_spec_testfinney.json || true
109+
# echo "raw_spec_testfinney.json needs to be updated. Run './scripts/build_all_chainspecs.sh'"
110+
# exit 1
111+
# else
112+
# echo "raw_spec_testfinney.json is up to date."
113+
# fi
114+
#
115+
# - name: Check plain_spec_testfinney.json
116+
# run: |
117+
# if [ "$(sha256sum __CI_TESTING__plain_spec_testfinney.json | awk '{print $1}')" != "$(sha256sum plain_spec_testfinney.json | awk '{print $1}')" ]; then
118+
# diff __CI_TESTING__plain_spec_testfinney.json plain_spec_testfinney.json || true
119+
# echo "plain_spec_testfinney.json needs to be updated. Run './scripts/build_all_chainspecs.sh'"
120+
# exit 1
121+
# else
122+
# echo "plain_spec_testfinney.json is up to date."
123+
# fi

plain_spec_finney.json

+50,731-50,729
Large diffs are not rendered by default.

plain_spec_testfinney.json

+4-2
Large diffs are not rendered by default.

raw_spec_finney.json

+4-2
Large diffs are not rendered by default.

raw_spec_testfinney.json

+4-2
Large diffs are not rendered by default.

scripts/build_all_chainspecs.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
echo "*** Building node..."
4+
cargo +nightly-2024-03-05 build
5+
6+
echo "*** Building chainspecs..."
7+
./target/debug/node-subtensor build-spec --raw --chain finney >raw_spec_finney.json
8+
./target/debug/node-subtensor build-spec --chain finney >plain_spec_finney.json
9+
10+
./target/debug/node-subtensor build-spec --raw --chain test_finney >raw_spec_testfinney.json
11+
./target/debug/node-subtensor build-spec --chain test_finney >plain_spec_testfinney.json
12+
13+
echo "*** Done!"

0 commit comments

Comments
 (0)