|
| 1 | +name: "Flow: Rust CI" |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: ['main'] |
| 6 | + |
| 7 | +defaults: |
| 8 | + run: |
| 9 | + shell: bash |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +env: |
| 15 | + NODE_VERSION: "20.18.3" |
| 16 | + |
| 17 | +jobs: |
| 18 | + format: |
| 19 | + runs-on: hiero-client-sdk-linux-medium |
| 20 | + steps: |
| 21 | + - name: Harden Runner |
| 22 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 23 | + with: |
| 24 | + egress-policy: audit |
| 25 | + |
| 26 | + - name: Checkout Code |
| 27 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 28 | + with: |
| 29 | + submodules: 'recursive' |
| 30 | + |
| 31 | + - name: Add `rustfmt` to toolchain |
| 32 | + run: | |
| 33 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 34 | + . $HOME/.cargo/env |
| 35 | + rustup +nightly component add rustfmt |
| 36 | +
|
| 37 | + - name: Format |
| 38 | + |
| 39 | + run: | |
| 40 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 41 | + . $HOME/.cargo/env |
| 42 | + cargo +nightly fmt --check |
| 43 | + |
| 44 | + check: |
| 45 | + runs-on: hiero-client-sdk-linux-medium |
| 46 | + steps: |
| 47 | + - name: Harden Runner |
| 48 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 49 | + with: |
| 50 | + egress-policy: audit |
| 51 | + |
| 52 | + - name: Checkout Code |
| 53 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 54 | + with: |
| 55 | + submodules: 'recursive' |
| 56 | + |
| 57 | + - name: Setup Rust |
| 58 | + uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # v1 |
| 59 | + with: |
| 60 | + toolchain: 1.88.0 |
| 61 | + |
| 62 | + - name: Setup GCC and OpenSSL |
| 63 | + run: | |
| 64 | + sudo apt-get update |
| 65 | + sudo apt-get install -y --no-install-recommends gcc libc6-dev libc-dev libssl-dev pkg-config openssl |
| 66 | +
|
| 67 | + - name: Install Protoc |
| 68 | + uses: step-security/setup-protoc@f6eb248a6510dbb851209febc1bd7981604a52e3 # v3.0.0 |
| 69 | + with: |
| 70 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + |
| 72 | + - name: Check |
| 73 | + run: | |
| 74 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 75 | + . $HOME/.cargo/env |
| 76 | + cargo check --examples --workspace |
| 77 | + |
| 78 | + test: |
| 79 | + needs: ['check'] |
| 80 | + runs-on: hiero-client-sdk-linux-medium |
| 81 | + steps: |
| 82 | + - name: Harden Runner |
| 83 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 84 | + with: |
| 85 | + egress-policy: audit |
| 86 | + |
| 87 | + - name: Checkout Code |
| 88 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 89 | + with: |
| 90 | + submodules: 'recursive' |
| 91 | + |
| 92 | + - name: Setup Rust |
| 93 | + uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # v1 |
| 94 | + with: |
| 95 | + toolchain: 1.88.0 |
| 96 | + |
| 97 | + - name: Setup GCC and OpenSSL |
| 98 | + run: | |
| 99 | + sudo apt-get update |
| 100 | + sudo apt-get install -y --no-install-recommends gcc libc6-dev libc-dev libssl-dev pkg-config openssl |
| 101 | +
|
| 102 | + - name: Install Protoc |
| 103 | + uses: step-security/setup-protoc@f6eb248a6510dbb851209febc1bd7981604a52e3 # v3.0.0 |
| 104 | + with: |
| 105 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + |
| 107 | + - name: Setup NodeJS |
| 108 | + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 |
| 109 | + with: |
| 110 | + node-version: ${{ env.NODE_VERSION }} |
| 111 | + |
| 112 | + - name: Prepare Hiero Solo |
| 113 | + id: solo |
| 114 | + uses: hiero-ledger/hiero-solo-action@6a1a77601cf3e69661fb6880530a4edf656b40d5 # v0.14.0 |
| 115 | + with: |
| 116 | + installMirrorNode: true |
| 117 | + hieroVersion: v0.65.0 |
| 118 | + |
| 119 | + - name: Create env file |
| 120 | + run: | |
| 121 | + touch .env |
| 122 | + echo TEST_OPERATOR_KEY="${{ steps.solo.outputs.privateKey }}" >> .env |
| 123 | + echo TEST_OPERATOR_ID="${{ steps.solo.outputs.accountId }}" >> .env |
| 124 | + echo TEST_NETWORK_NAME="localhost" >> .env |
| 125 | + echo TEST_RUN_NONFREE="1" >> .env |
| 126 | + cat .env |
| 127 | +
|
| 128 | + - name: Test |
| 129 | + run: | |
| 130 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 131 | + . $HOME/.cargo/env |
| 132 | + cargo test --workspace -- --skip node::update |
| 133 | + dab-tests: |
| 134 | + needs: ['check'] |
| 135 | + runs-on: hiero-client-sdk-linux-medium |
| 136 | + steps: |
| 137 | + - name: Harden Runner |
| 138 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 139 | + with: |
| 140 | + egress-policy: audit |
| 141 | + |
| 142 | + - name: Checkout Code |
| 143 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 144 | + with: |
| 145 | + submodules: 'recursive' |
| 146 | + |
| 147 | + - name: Setup Rust |
| 148 | + uses: dtolnay/rust-toolchain@6d653acede28d24f02e3cd41383119e8b1b35921 # v1 |
| 149 | + with: |
| 150 | + toolchain: 1.88.0 |
| 151 | + |
| 152 | + - name: Setup GCC and OpenSSL |
| 153 | + run: | |
| 154 | + sudo apt-get update |
| 155 | + sudo apt-get install -y --no-install-recommends gcc libc6-dev libc-dev libssl-dev pkg-config openssl |
| 156 | +
|
| 157 | + - name: Install Protoc |
| 158 | + uses: step-security/setup-protoc@f6eb248a6510dbb851209febc1bd7981604a52e3 # v3.0.0 |
| 159 | + with: |
| 160 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 161 | + |
| 162 | + - name: Setup NodeJS |
| 163 | + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 |
| 164 | + with: |
| 165 | + node-version: ${{ env.NODE_VERSION }} |
| 166 | + |
| 167 | + - name: Prepare Hiero Solo for DAB Tests |
| 168 | + id: solo-dab |
| 169 | + uses: hiero-ledger/hiero-solo-action@6a1a77601cf3e69661fb6880530a4edf656b40d5 # v0.14.0 |
| 170 | + with: |
| 171 | + installMirrorNode: true |
| 172 | + hieroVersion: v0.65.0 |
| 173 | + |
| 174 | + - name: Create env file for DAB Tests |
| 175 | + run: | |
| 176 | + touch .env |
| 177 | + echo TEST_OPERATOR_KEY="${{ steps.solo-dab.outputs.privateKey }}" >> .env |
| 178 | + echo TEST_OPERATOR_ID="${{ steps.solo-dab.outputs.accountId }}" >> .env |
| 179 | + echo TEST_NETWORK_NAME="localhost" >> .env |
| 180 | + echo TEST_RUN_NONFREE="1" >> .env |
| 181 | + cat .env |
| 182 | +
|
| 183 | + - name: Run DAB Tests |
| 184 | + run: | |
| 185 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 186 | + . $HOME/.cargo/env |
| 187 | + cargo test --test e2e node::update -- --nocapture |
0 commit comments