|
| 1 | +name: Check Chainspec |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: check-chainspec-${{ github.ref }} |
| 5 | + cancel-in-progress: true |
| 6 | + |
| 7 | +on: |
| 8 | + ## Run automatically for all PRs against main, regardless of what the changes are |
| 9 | + ## to be safe and so we can more easily force re-run the CI when github is being |
| 10 | + ## weird by using a blank commit |
| 11 | + push: |
| 12 | + branches: [main, development, staging] |
| 13 | + |
| 14 | + ## |
| 15 | + # Run automatically for PRs against default/main branch if Rust files change |
| 16 | + pull_request: |
| 17 | + branches: [main, development, staging] |
| 18 | + |
| 19 | + ## Allow running workflow manually from the Actions tab |
| 20 | + workflow_dispatch: |
| 21 | + inputs: |
| 22 | + verbose: |
| 23 | + description: "Output more information when triggered manually" |
| 24 | + required: false |
| 25 | + default: "" |
| 26 | + |
| 27 | +env: |
| 28 | + CARGO_TERM_COLOR: always |
| 29 | + VERBOSE: ${{ github.events.input.verbose }} |
| 30 | + |
| 31 | +jobs: |
| 32 | + check-chainspecs: |
| 33 | + runs-on: SubtensorCI |
| 34 | + strategy: |
| 35 | + matrix: |
| 36 | + rust-branch: |
| 37 | + - nightly-2024-03-05 |
| 38 | + rust-target: |
| 39 | + - x86_64-unknown-linux-gnu |
| 40 | + os: |
| 41 | + - ubuntu-latest |
| 42 | + include: |
| 43 | + - os: ubuntu-latest |
| 44 | + env: |
| 45 | + RELEASE_NAME: development |
| 46 | + RUSTV: ${{ matrix.rust-branch }} |
| 47 | + RUST_BACKTRACE: full |
| 48 | + RUST_BIN_DIR: target/${{ matrix.rust-target }} |
| 49 | + SKIP_WASM_BUILD: 1 |
| 50 | + TARGET: ${{ matrix.rust-target }} |
| 51 | + steps: |
| 52 | + - name: Check-out repository under $GITHUB_WORKSPACE |
| 53 | + uses: actions/checkout@v2 |
| 54 | + |
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + sudo apt-get update && |
| 58 | + sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler |
| 59 | +
|
| 60 | + - name: Install Rust ${{ matrix.rust-branch }} |
| 61 | + uses: actions-rs/toolchain@v1.0.6 |
| 62 | + with: |
| 63 | + toolchain: ${{ matrix.rust-branch }} |
| 64 | + components: rustfmt, clippy |
| 65 | + profile: minimal |
| 66 | + |
| 67 | + - name: Utilize Shared Rust Cache |
| 68 | + uses: Swatinem/rust-cache@v2.2.1 |
| 69 | + with: |
| 70 | + key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }} |
| 71 | + |
| 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 |
| 113 | + 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 |
0 commit comments