run-tests.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 Rust
  38. uses: dtolnay/rust-toolchain@stable
  39. with:
  40. toolchain: stable
  41. - name: Cache Rust
  42. uses: Swatinem/rust-cache@v2
  43. - name: Install Solana
  44. if: steps.cache-solana.outputs.cache-hit != 'true'
  45. run: |
  46. sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
  47. export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
  48. solana --version
  49. lint:
  50. needs: setup
  51. runs-on: ubuntu-latest
  52. strategy:
  53. matrix:
  54. task: [clippy, yarn]
  55. steps:
  56. - uses: actions/checkout@v4
  57. - name: Install node modules
  58. run: |
  59. yarn --frozen-lockfile --network-concurrency 2
  60. - name: Cache Rust
  61. uses: Swatinem/rust-cache@v2
  62. - name: Run Lint
  63. run: |
  64. if [ "${{ matrix.task }}" == "clippy" ]; then
  65. cargo fmt -- --check --verbose
  66. cargo clippy -- --deny=warnings
  67. else
  68. yarn lint
  69. fi
  70. test:
  71. needs: lint
  72. runs-on: ubuntu-latest
  73. steps:
  74. - uses: actions/checkout@v4
  75. - name: Setup Environment
  76. run: |
  77. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  78. solana --version
  79. solana-keygen new --silent --no-bip39-passphrase
  80. - name: Set Deployment Keys
  81. run: |
  82. mkdir -p target/deploy
  83. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  84. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  85. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  86. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  87. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  88. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  89. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  90. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  91. - name: Run Build and Tests
  92. run: |
  93. cargo install --path cli --force --locked
  94. bolt build
  95. cd clients/bolt-sdk
  96. yarn install && yarn build
  97. cd ../..