run-tests.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. name: Run Bolt Tests
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. env:
  8. solana_version: v1.18.9
  9. jobs:
  10. install:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v4
  14. - uses: actions/cache@v4
  15. name: cache solana cli
  16. id: cache-solana
  17. with:
  18. path: |
  19. ~/.cache/solana/
  20. ~/.local/share/solana/
  21. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  22. - uses: actions/setup-node@v4
  23. with:
  24. node-version: 20
  25. - name: install essentials
  26. run: |
  27. sudo apt-get update
  28. sudo apt-get install -y pkg-config build-essential libudev-dev
  29. npm install --global yarn
  30. - name: Cache node dependencies
  31. uses: actions/cache@v3
  32. with:
  33. path: "**/node_modules"
  34. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  35. - name: install node_modules
  36. run: |
  37. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  38. yarn --frozen-lockfile --network-concurrency 2
  39. - name: install rust
  40. uses: dtolnay/rust-toolchain@stable
  41. with:
  42. toolchain: stable
  43. - name: Cache rust
  44. uses: Swatinem/rust-cache@v2
  45. - name: install solana
  46. if: steps.cache-solana.outputs.cache-hit != 'true'
  47. run: |
  48. sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
  49. export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
  50. solana --version
  51. clippy-lint:
  52. needs: install
  53. runs-on: ubuntu-latest
  54. steps:
  55. - uses: actions/checkout@v4
  56. - name: Cache rust
  57. uses: Swatinem/rust-cache@v2
  58. - name: Run fmt
  59. run: cargo fmt -- --check
  60. - name: Run clippy
  61. run: cargo clippy -- --deny=warnings
  62. yarn-lint:
  63. needs: install
  64. runs-on: ubuntu-latest
  65. steps:
  66. - uses: actions/checkout@v4
  67. - name: Use Node ${{ matrix.node }}
  68. uses: actions/setup-node@v4
  69. with:
  70. node-version: 20
  71. - name: Cache node dependencies
  72. uses: actions/cache@v4
  73. with:
  74. path: "**/node_modules"
  75. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  76. - name: Run lint
  77. run: yarn lint
  78. test:
  79. needs: [clippy-lint, yarn-lint]
  80. runs-on: ubuntu-latest
  81. steps:
  82. - name: install rust
  83. uses: dtolnay/rust-toolchain@stable
  84. with:
  85. toolchain: stable
  86. - name: Cache rust
  87. uses: Swatinem/rust-cache@v2
  88. - uses: actions/checkout@v4
  89. - name: Use Node ${{ matrix.node }}
  90. uses: actions/setup-node@v4
  91. with:
  92. node-version: 20
  93. - name: Cache node dependencies
  94. uses: actions/cache@v3
  95. with:
  96. path: "**/node_modules"
  97. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  98. - name: install node_modules
  99. run: |
  100. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  101. yarn --frozen-lockfile
  102. - uses: actions/cache@v4
  103. name: cache solana cli
  104. id: cache-solana
  105. with:
  106. path: |
  107. ~/.cache/solana/
  108. ~/.local/share/solana/
  109. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  110. - name: setup solana
  111. run: |
  112. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  113. solana --version
  114. solana-keygen new --silent --no-bip39-passphrase
  115. - name: Set deployments keys
  116. run: |
  117. mkdir -p target/deploy
  118. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  119. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  120. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  121. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  122. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  123. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  124. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  125. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  126. - name: run build
  127. run: |
  128. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  129. cargo install --path cli --force --locked
  130. bolt build
  131. - name: Generate lib
  132. run: |
  133. cd clients/bolt-sdk
  134. yarn build
  135. cd ../..
  136. - name: run tests
  137. run: |
  138. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  139. cargo install --path cli --force --locked
  140. bolt test
  141. - name: Install the Bolt CLI and create & build a new project
  142. shell: bash
  143. run: |
  144. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  145. cargo install --path cli --force --locked
  146. bolt init test-project --force
  147. cd test-project
  148. cargo add --package test-project --path "../crates/bolt-lang" || true # Overrides the version with the local version
  149. cargo add --package movement --path "../crates/bolt-lang" || true # -
  150. cargo add --package position --path "../crates/bolt-lang" || true # -
  151. cargo update
  152. yarn add file:../clients/bolt-sdk/ -D # Overrides the bolt ts SDK with the local version
  153. bolt build
  154. bolt test