|
| 1 | +name: Pathway Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + # Run weekly to catch dependency/Rust version issues |
| 5 | + schedule: |
| 6 | + - cron: '0 0 * * 0' # Every Sunday at midnight UTC |
| 7 | + |
| 8 | + # Run on releases |
| 9 | + release: |
| 10 | + types: [published] |
| 11 | + |
| 12 | + # Run on PRs that touch critical files |
| 13 | + # Smart path filtering: only run tests for templates that actually changed |
| 14 | + pull_request: |
| 15 | + paths: |
| 16 | + # Global toolchain/workflow changes - run all tests |
| 17 | + - 'rust-toolchain.toml' |
| 18 | + - 'dot/cli/tests/pathway_integration_tests.rs' |
| 19 | + - '.github/workflows/test-pathway-integration.yml' |
| 20 | + # Core SDK changes - run all tests |
| 21 | + - 'dot/sdk/src/**' |
| 22 | + # Template-specific changes - only run affected template tests |
| 23 | + - 'dot/sdk/templates/recipe-templates/polkadot-sdk-template/**' |
| 24 | + - 'dot/sdk/templates/recipe-templates/basic-interaction-template/**' |
| 25 | + - 'dot/sdk/templates/recipe-templates/solidity-template/**' |
| 26 | + - 'dot/sdk/templates/recipe-templates/xcm-template/**' |
| 27 | + - 'dot/sdk/templates/recipe-templates/testing-template/**' |
| 28 | + |
| 29 | + # Allow manual trigger |
| 30 | + workflow_dispatch: |
| 31 | + |
| 32 | +jobs: |
| 33 | + test-pathways: |
| 34 | + name: Test All Recipe Pathways |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 60 # Integration tests can take a while |
| 37 | + |
| 38 | + # Performance optimizations: |
| 39 | + # 1. Path-based triggers: Only run when relevant template files change |
| 40 | + # 2. Runtime WASM caching: Avoid 15+ minute rebuilds when runtime code unchanged |
| 41 | + # 3. Cargo/Node caching: Speed up dependency installation |
| 42 | + # Result: Most PRs skip this workflow, and when it runs, cached builds are 10x faster |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout code |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Setup Rust toolchain |
| 49 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 50 | + with: |
| 51 | + components: rustfmt, clippy, rust-src |
| 52 | + target: wasm32-unknown-unknown |
| 53 | + |
| 54 | + - name: Setup Node.js |
| 55 | + uses: actions/setup-node@v4 |
| 56 | + with: |
| 57 | + node-version: '20' |
| 58 | + |
| 59 | + - name: Cache cargo |
| 60 | + uses: actions/cache@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + ~/.cargo/registry |
| 64 | + ~/.cargo/git |
| 65 | + target |
| 66 | + key: ${{ runner.os }}-cargo-integration-${{ hashFiles('**/Cargo.lock') }} |
| 67 | + restore-keys: | |
| 68 | + ${{ runner.os }}-cargo-integration- |
| 69 | + ${{ runner.os }}-cargo- |
| 70 | +
|
| 71 | + - name: Cache node modules |
| 72 | + uses: actions/cache@v4 |
| 73 | + with: |
| 74 | + path: | |
| 75 | + ~/.npm |
| 76 | + recipes/*/node_modules |
| 77 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 78 | + restore-keys: | |
| 79 | + ${{ runner.os }}-node- |
| 80 | +
|
| 81 | + # Cache compiled runtime WASM to avoid 15+ minute rebuilds |
| 82 | + # This is the biggest time saver for parachain tests |
| 83 | + - name: Cache compiled runtime artifacts |
| 84 | + uses: actions/cache@v4 |
| 85 | + with: |
| 86 | + path: | |
| 87 | + recipes/*/target/release/wbuild |
| 88 | + recipes/*/target/release/*.wasm |
| 89 | + key: ${{ runner.os }}-runtime-wasm-${{ hashFiles('dot/sdk/templates/recipe-templates/polkadot-sdk-template/runtime/**/*.rs', 'dot/sdk/templates/recipe-templates/polkadot-sdk-template/pallets/**/*.rs', 'dot/sdk/templates/recipe-templates/polkadot-sdk-template/**/Cargo.toml') }} |
| 90 | + restore-keys: | |
| 91 | + ${{ runner.os }}-runtime-wasm- |
| 92 | +
|
| 93 | + - name: Build CLI |
| 94 | + run: cargo build --release --package cli --locked |
| 95 | + |
| 96 | + - name: Add CLI to PATH |
| 97 | + run: echo "${{ github.workspace }}/target/release" >> $GITHUB_PATH |
| 98 | + |
| 99 | + - name: Install protobuf compiler |
| 100 | + run: sudo apt-get update && sudo apt-get install -y protobuf-compiler |
| 101 | + |
| 102 | + - name: Cache polkadot tools |
| 103 | + uses: actions/cache@v4 |
| 104 | + id: cache-polkadot-tools |
| 105 | + with: |
| 106 | + path: | |
| 107 | + ~/.cargo/bin/polkadot-omni-node |
| 108 | + ~/.cargo/bin/chain-spec-builder |
| 109 | + key: ${{ runner.os }}-polkadot-tools-${{ hashFiles('**/Cargo.lock') }} |
| 110 | + restore-keys: | |
| 111 | + ${{ runner.os }}-polkadot-tools- |
| 112 | +
|
| 113 | + - name: Install polkadot-omni-node |
| 114 | + if: steps.cache-polkadot-tools.outputs.cache-hit != 'true' |
| 115 | + run: cargo install polkadot-omni-node --locked |
| 116 | + env: |
| 117 | + RUSTFLAGS: "" # Don't treat warnings as errors for external crates |
| 118 | + |
| 119 | + - name: Install chain-spec-builder |
| 120 | + if: steps.cache-polkadot-tools.outputs.cache-hit != 'true' |
| 121 | + run: cargo install staging-chain-spec-builder --locked |
| 122 | + env: |
| 123 | + RUSTFLAGS: "" # Don't treat warnings as errors for external crates |
| 124 | + |
| 125 | + - name: Run pathway integration tests |
| 126 | + run: cargo test --package cli --test pathway_integration_tests --release -- --ignored --nocapture |
| 127 | + env: |
| 128 | + RUST_BACKTRACE: 1 |
| 129 | + |
| 130 | + - name: Upload parachain-example artifact |
| 131 | + if: always() |
| 132 | + uses: actions/upload-artifact@v4 |
| 133 | + with: |
| 134 | + name: parachain-example |
| 135 | + path: recipes/parachain-example/ |
| 136 | + if-no-files-found: warn |
| 137 | + retention-days: 7 |
| 138 | + |
| 139 | + - name: Upload pallet-example artifact |
| 140 | + if: always() |
| 141 | + uses: actions/upload-artifact@v4 |
| 142 | + with: |
| 143 | + name: pallet-example |
| 144 | + path: recipes/pallet-example/ |
| 145 | + if-no-files-found: warn |
| 146 | + retention-days: 7 |
| 147 | + |
| 148 | + - name: Upload contracts-example artifact |
| 149 | + if: always() |
| 150 | + uses: actions/upload-artifact@v4 |
| 151 | + with: |
| 152 | + name: contracts-example |
| 153 | + path: recipes/contracts-example/ |
| 154 | + if-no-files-found: warn |
| 155 | + retention-days: 7 |
| 156 | + |
| 157 | + - name: Upload basic-interaction-example artifact |
| 158 | + if: always() |
| 159 | + uses: actions/upload-artifact@v4 |
| 160 | + with: |
| 161 | + name: basic-interaction-example |
| 162 | + path: recipes/basic-interaction-example/ |
| 163 | + if-no-files-found: warn |
| 164 | + retention-days: 7 |
| 165 | + |
| 166 | + - name: Upload xcm-example artifact |
| 167 | + if: always() |
| 168 | + uses: actions/upload-artifact@v4 |
| 169 | + with: |
| 170 | + name: xcm-example |
| 171 | + path: recipes/xcm-example/ |
| 172 | + if-no-files-found: warn |
| 173 | + retention-days: 7 |
| 174 | + |
| 175 | + - name: Upload infra-example artifact |
| 176 | + if: always() |
| 177 | + uses: actions/upload-artifact@v4 |
| 178 | + with: |
| 179 | + name: infra-example |
| 180 | + path: recipes/infra-example/ |
| 181 | + if-no-files-found: warn |
| 182 | + retention-days: 7 |
| 183 | + |
| 184 | + # Note: We keep the generated examples in the workspace |
| 185 | + # These can be committed to keep examples fresh and up-to-date |
| 186 | + |
| 187 | + test-summary: |
| 188 | + name: Integration Test Summary |
| 189 | + needs: test-pathways |
| 190 | + runs-on: ubuntu-latest |
| 191 | + if: always() |
| 192 | + |
| 193 | + steps: |
| 194 | + - name: Check test results |
| 195 | + run: | |
| 196 | + if [ "${{ needs.test-pathways.result }}" == "success" ]; then |
| 197 | + echo "✅ All pathway integration tests passed!" |
| 198 | + echo "All recipe templates generate working code with passing tests." |
| 199 | + else |
| 200 | + echo "❌ Some pathway integration tests failed!" |
| 201 | + echo "Check the logs above for details." |
| 202 | + exit 1 |
| 203 | + fi |
0 commit comments