run-tests.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. name: Run Bolt Tests
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request_target:
  7. branches:
  8. - main
  9. env:
  10. solana_version: v1.18.15
  11. jobs:
  12. setup:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v4
  16. - uses: actions/cache@v4
  17. name: Cache Solana CLI
  18. id: cache-solana
  19. with:
  20. path: |
  21. ~/.cache/solana/
  22. ~/.local/share/solana/
  23. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  24. - uses: actions/setup-node@v4
  25. with:
  26. node-version: 21
  27. - name: Install Essentials
  28. run: |
  29. sudo apt-get update
  30. sudo apt-get install -y pkg-config build-essential libudev-dev
  31. npm install --global yarn
  32. - name: Cache Node Dependencies
  33. uses: actions/cache@v3
  34. with:
  35. path: '**/node_modules'
  36. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  37. - name: Install Node Modules
  38. run: |
  39. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  40. yarn install
  41. - name: Install Rust
  42. uses: dtolnay/rust-toolchain@stable
  43. with:
  44. toolchain: stable
  45. - name: Cache Rust
  46. uses: Swatinem/rust-cache@v2
  47. - name: Install Solana
  48. if: steps.cache-solana.outputs.cache-hit != 'true'
  49. run: |
  50. sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
  51. export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
  52. solana --version
  53. lint:
  54. needs: setup
  55. runs-on: ubuntu-latest
  56. strategy:
  57. matrix:
  58. task: [clippy, yarn]
  59. steps:
  60. - uses: actions/checkout@v4
  61. - name: Cache Rust
  62. uses: Swatinem/rust-cache@v2
  63. - name: Run Lint
  64. run: |
  65. if [ "${{ matrix.task }}" == "clippy" ]; then
  66. cargo fmt -- --check --verbose
  67. cargo clippy -- --deny=warnings
  68. else
  69. yarn lint
  70. fi
  71. test:
  72. needs: lint
  73. runs-on: ubuntu-latest
  74. steps:
  75. - uses: actions/checkout@v4
  76. - name: Setup Environment
  77. run: |
  78. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  79. solana --version
  80. solana-keygen new --silent --no-bip39-passphrase
  81. - name: Set Deployment Keys
  82. run: |
  83. mkdir -p target/deploy
  84. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  85. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  86. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  87. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  88. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  89. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  90. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  91. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  92. - name: Run Build and Tests
  93. run: |
  94. cargo install --path cli --force --locked
  95. bolt build
  96. cd clients/bolt-sdk
  97. yarn install && yarn build
  98. cd ../..
  99. bolt test