run-tests.yml 5.6 KB

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