Add runtime API calls guide with SDK examples #1010
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Checks | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.snippets/code/**' | |
| - '.github/workflows/**' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - '.snippets/code/**' | |
| - '.github/workflows/**' | |
| merge_group: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| preflight: | |
| uses: ./.github/workflows/reusable-preflight.yml | |
| fmt: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cargo fmt | |
| working-directory: .snippets/code | |
| run: cargo +nightly fmt --all -- --check | |
| clippy: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Clippy check | |
| working-directory: .snippets/code | |
| run: | | |
| cargo clippy --all-targets --locked --workspace --quiet | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [preflight] | |
| container: | |
| image: ${{ needs.preflight.outputs.IMAGE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| working-directory: .snippets/code | |
| run: cargo test | |
| check-fail-ci: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: "paritytech/tools:latest" | |
| options: --user root | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check | |
| working-directory: .snippets/code | |
| run: | | |
| set +e | |
| rg --line-number --hidden --type rust --glob '!{.git,target}' "$ASSERT_REGEX" .; exit_status=$? | |
| if [ $exit_status -eq 0 ]; then | |
| echo "$ASSERT_REGEX was found, exiting with 1"; | |
| exit 1; | |
| else | |
| echo "No $ASSERT_REGEX was found, exiting with 0"; | |
| exit 0; | |
| fi | |
| env: | |
| ASSERT_REGEX: "FAIL-CI" | |
| GIT_DEPTH: 1 | |
| confirm-checks: | |
| runs-on: ubuntu-latest | |
| name: All checks passed | |
| needs: | |
| - fmt | |
| - clippy | |
| - test | |
| - check-fail-ci | |
| if: always() && !cancelled() | |
| steps: | |
| - run: | | |
| tee resultfile <<< '${{ toJSON(needs) }}' | |
| FAILURES=$(cat resultfile | grep '"result": "failure"' | wc -l) | |
| if [ $FAILURES -gt 0 ]; then | |
| echo "### At least one required job failed ❌" >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| else | |
| echo '### Good job! All the required jobs passed 🚀' >> $GITHUB_STEP_SUMMARY | |
| fi |