run-tests.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. name: Run Bolt Tests
  2. on:
  3. push:
  4. pull_request:
  5. env:
  6. solana_version: v1.17.0
  7. anchor_version: 0.29.0
  8. jobs:
  9. install:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v3
  13. - uses: actions/cache@v3
  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@v3
  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. - uses: dtolnay/rust-toolchain@stable
  38. with:
  39. toolchain: stable
  40. - name: Cache rust
  41. uses: Swatinem/rust-cache@v2
  42. - name: install solana
  43. if: steps.cache-solana.outputs.cache-hit != 'true'
  44. run: |
  45. sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
  46. export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
  47. solana --version
  48. clippy-lint:
  49. needs: install
  50. runs-on: ubuntu-latest
  51. steps:
  52. - uses: actions/checkout@v3
  53. - name: Cache rust
  54. uses: Swatinem/rust-cache@v2
  55. - name: Run fmt
  56. run: cargo fmt -- --check
  57. - name: Run clippy
  58. run: cargo clippy -- --deny=warnings
  59. yarn-lint:
  60. needs: install
  61. runs-on: ubuntu-latest
  62. steps:
  63. - uses: actions/checkout@v3
  64. - name: Use Node ${{ matrix.node }}
  65. uses: actions/setup-node@v3
  66. with:
  67. node-version: 20
  68. - name: Cache node dependencies
  69. uses: actions/cache@v3
  70. with:
  71. path: '**/node_modules'
  72. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  73. - name: Run lint
  74. run: yarn lint
  75. test:
  76. needs: [clippy-lint, yarn-lint]
  77. runs-on: ubuntu-latest
  78. steps:
  79. - uses: actions/checkout@v3
  80. - name: Use Node ${{ matrix.node }}
  81. uses: actions/setup-node@v3
  82. with:
  83. node-version: 20
  84. - name: Cache node dependencies
  85. uses: actions/cache@v3
  86. with:
  87. path: '**/node_modules'
  88. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  89. - name: install node_modules
  90. run: |
  91. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  92. yarn --frozen-lockfile
  93. - uses: actions/cache@v3
  94. name: cache solana cli
  95. id: cache-solana
  96. with:
  97. path: |
  98. ~/.cache/solana/
  99. ~/.local/share/solana/
  100. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  101. - name: setup solana
  102. run: |
  103. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  104. solana --version
  105. solana-keygen new --silent --no-bip39-passphrase
  106. - name: Set deployments keys
  107. run: |
  108. mkdir -p target/deploy
  109. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  110. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  111. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  112. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  113. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  114. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  115. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  116. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  117. - name: run tests
  118. run: |
  119. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  120. ls node_modules/.bin
  121. npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
  122. anchor test
  123. - uses: actions/upload-artifact@v3
  124. if: always()
  125. with:
  126. name: program-logs
  127. path: .anchor/program-logs/*