run-tests.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. install:
  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 --frozen-lockfile --network-concurrency 2
  41. - name: install rust
  42. uses: dtolnay/rust-toolchain@stable
  43. with:
  44. toolchain: stable
  45. components: rustfmt
  46. - name: Cache rust
  47. uses: Swatinem/rust-cache@v2
  48. - name: install solana
  49. if: steps.cache-solana.outputs.cache-hit != 'true'
  50. run: |
  51. sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
  52. export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
  53. solana --version
  54. clippy-lint:
  55. needs: install
  56. runs-on: ubuntu-latest
  57. steps:
  58. - uses: actions/checkout@v4
  59. - name: Cache rust
  60. uses: Swatinem/rust-cache@v2
  61. - name: Check Rust version
  62. run: rustc --version
  63. - name: Run fmt
  64. run: cargo fmt -- --check --verbose
  65. - name: Run clippy
  66. run: cargo clippy -- --deny=warnings
  67. yarn-lint:
  68. needs: install
  69. runs-on: ubuntu-latest
  70. steps:
  71. - uses: actions/checkout@v4
  72. - name: Use Node ${{ matrix.node }}
  73. uses: actions/setup-node@v4
  74. with:
  75. node-version: 20
  76. - name: Cache node dependencies
  77. uses: actions/cache@v4
  78. with:
  79. path: "**/node_modules"
  80. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  81. - name: Run lint
  82. run: yarn lint
  83. test:
  84. needs: [clippy-lint, yarn-lint]
  85. runs-on: ubuntu-latest
  86. steps:
  87. - name: install rust
  88. uses: dtolnay/rust-toolchain@stable
  89. with:
  90. toolchain: stable
  91. - name: Cache rust
  92. uses: Swatinem/rust-cache@v2
  93. - uses: actions/checkout@v4
  94. - name: Use Node ${{ matrix.node }}
  95. uses: actions/setup-node@v4
  96. with:
  97. node-version: 20
  98. - name: Cache node dependencies
  99. uses: actions/cache@v3
  100. with:
  101. path: "**/node_modules"
  102. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  103. - name: install node_modules
  104. run: |
  105. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  106. yarn --frozen-lockfile
  107. - uses: actions/cache@v4
  108. name: cache solana cli
  109. id: cache-solana
  110. with:
  111. path: |
  112. ~/.cache/solana/
  113. ~/.local/share/solana/
  114. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  115. - name: setup solana
  116. run: |
  117. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  118. solana --version
  119. solana-keygen new --silent --no-bip39-passphrase
  120. - name: Set deployments keys
  121. run: |
  122. mkdir -p target/deploy
  123. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  124. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  125. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  126. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  127. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  128. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  129. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  130. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  131. - name: run build
  132. run: |
  133. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  134. cargo install --path cli --force --locked
  135. bolt build
  136. - name: Generate lib
  137. run: |
  138. cd clients/bolt-sdk
  139. yarn install && yarn build
  140. cd ../..
  141. - name: run tests
  142. run: |
  143. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  144. cargo install --path cli --force --locked
  145. bolt test
  146. - name: Install the Bolt CLI and create & build a new project
  147. shell: bash
  148. run: |
  149. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  150. cargo install --path cli --force --locked
  151. bolt init test-project --force
  152. cd test-project
  153. cargo add --package test-project --path "../crates/bolt-lang" || true # Overrides the version with the local version
  154. cargo add --package movement --path "../crates/bolt-lang" || true # -
  155. cargo add --package position --path "../crates/bolt-lang" || true # -
  156. cargo update
  157. yarn add file:../clients/bolt-sdk/ -D # Overrides the bolt ts SDK with the local version
  158. bolt build
  159. bolt test