run-tests.yml 3.6 KB

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