run-tests.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. name: Run Bolt Tests
  2. on:
  3. push:
  4. pull_request:
  5. env:
  6. solana_version: v1.18.0
  7. anchor_version: 0.29.0
  8. jobs:
  9. install:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v4
  13. - uses: actions/cache@v4
  14. name: cache solana cli
  15. id: cache-solana
  16. with:
  17. path: |
  18. ~/.cache/solana/
  19. ~/.local/share/solana/
  20. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  21. - uses: actions/setup-node@v4
  22. with:
  23. node-version: 20
  24. - name: install essentials
  25. run: |
  26. sudo apt-get update
  27. sudo apt-get install -y pkg-config build-essential libudev-dev
  28. - name: Cache node dependencies
  29. uses: actions/cache@v3
  30. with:
  31. path: '**/node_modules'
  32. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  33. - name: install node_modules
  34. run: |
  35. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  36. yarn --frozen-lockfile --network-concurrency 2
  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. clippy-lint:
  50. needs: install
  51. runs-on: ubuntu-latest
  52. steps:
  53. - uses: actions/checkout@v4
  54. - name: Cache rust
  55. uses: Swatinem/rust-cache@v2
  56. - name: Run fmt
  57. run: cargo fmt -- --check
  58. - name: Run clippy
  59. run: cargo clippy -- --deny=warnings
  60. yarn-lint:
  61. needs: install
  62. runs-on: ubuntu-latest
  63. steps:
  64. - uses: actions/checkout@v4
  65. - name: Use Node ${{ matrix.node }}
  66. uses: actions/setup-node@v4
  67. with:
  68. node-version: 20
  69. - name: Cache node dependencies
  70. uses: actions/cache@v4
  71. with:
  72. path: '**/node_modules'
  73. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  74. - name: Run lint
  75. run: yarn lint
  76. test:
  77. needs: [clippy-lint, yarn-lint]
  78. runs-on: ubuntu-latest
  79. steps:
  80. - name: install rust
  81. uses: dtolnay/rust-toolchain@stable
  82. with:
  83. toolchain: stable
  84. - name: Cache rust
  85. uses: Swatinem/rust-cache@v2
  86. - uses: actions/checkout@v4
  87. - name: Use Node ${{ matrix.node }}
  88. uses: actions/setup-node@v4
  89. with:
  90. node-version: 20
  91. - name: Cache node dependencies
  92. uses: actions/cache@v3
  93. with:
  94. path: '**/node_modules'
  95. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  96. - name: install node_modules
  97. run: |
  98. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  99. yarn --frozen-lockfile
  100. - uses: actions/cache@v4
  101. name: cache solana cli
  102. id: cache-solana
  103. with:
  104. path: |
  105. ~/.cache/solana/
  106. ~/.local/share/solana/
  107. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  108. - name: setup solana
  109. run: |
  110. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  111. solana --version
  112. solana-keygen new --silent --no-bip39-passphrase
  113. - name: Set deployments keys
  114. run: |
  115. mkdir -p target/deploy
  116. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  117. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  118. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  119. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  120. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  121. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  122. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  123. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  124. - name: run tests
  125. run: |
  126. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  127. ls node_modules/.bin
  128. npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
  129. anchor test
  130. - name: Install the Bolt CLI and create & build a new project
  131. run: |
  132. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  133. cargo install --path cli --force --locked
  134. bolt init test-project --force
  135. cd test-project && bolt build
  136. - uses: actions/upload-artifact@v3
  137. if: always()
  138. with:
  139. name: program-logs
  140. path: .anchor/program-logs/*