publish-bolt-lang.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. name: Publish Bolt Lang
  2. on:
  3. release:
  4. types: [published]
  5. workflow_dispatch:
  6. env:
  7. solana_version: v1.17.0
  8. anchor_version: 0.29.0
  9. jobs:
  10. install:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v3
  14. - uses: actions/cache@v3
  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@v3
  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. - name: Cache node dependencies
  30. uses: actions/cache@v3
  31. with:
  32. path: '**/node_modules'
  33. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  34. - name: install node_modules
  35. run: |
  36. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  37. yarn --frozen-lockfile --network-concurrency 2
  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@v3
  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@v3
  65. - name: Use Node ${{ matrix.node }}
  66. uses: actions/setup-node@v3
  67. with:
  68. node-version: 20
  69. - name: Cache node dependencies
  70. uses: actions/cache@v3
  71. with:
  72. path: '**/node_modules'
  73. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  74. - name: Run lint
  75. run: yarn lint
  76. test-and-publish:
  77. needs: [clippy-lint, yarn-lint]
  78. runs-on: ubuntu-latest
  79. steps:
  80. - uses: actions/checkout@v3
  81. - name: Use Node ${{ matrix.node }}
  82. uses: actions/setup-node@v3
  83. with:
  84. node-version: 20
  85. - name: Cache node dependencies
  86. uses: actions/cache@v3
  87. with:
  88. path: '**/node_modules'
  89. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  90. - name: install node_modules
  91. run: |
  92. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  93. yarn --frozen-lockfile
  94. - uses: actions/cache@v3
  95. name: cache solana cli
  96. id: cache-solana
  97. with:
  98. path: |
  99. ~/.cache/solana/
  100. ~/.local/share/solana/
  101. key: solana-${{ runner.os }}-v0000-${{ env.solana_version }}
  102. - name: setup solana
  103. run: |
  104. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  105. solana --version
  106. solana-keygen new --silent --no-bip39-passphrase
  107. - name: Set deployments keys
  108. run: |
  109. mkdir -p target/deploy
  110. echo ${{ secrets.WORLD }} > target/deploy/world-keypair.json
  111. echo ${{ secrets.BOLT_COMPONENT }} > target/deploy/bolt_component-keypair.json
  112. echo ${{ secrets.BOLT_SYSTEM }} > target/deploy/bolt_system-keypair.json
  113. echo ${{ secrets.COMPONENT_POSITION }} > target/deploy/component_position-keypair.json
  114. echo ${{ secrets.COMPONENT_VELOCITY }} > target/deploy/component_velocity-keypair.json
  115. echo ${{ secrets.SYSTEM_APPLY_VELOCITY }} > target/deploy/system_apply_velocity-keypair.json
  116. echo ${{ secrets.SYSTEM_FLY }} > target/deploy/system_fly-keypair.json
  117. echo ${{ secrets.SYSTEM_SIMPLE_MOVEMENT }} > target/deploy/system_simple_movement-keypair.json
  118. - name: run tests
  119. run: |
  120. export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
  121. ls node_modules/.bin
  122. npm i -g @coral-xyz/anchor-cli@${{ env.anchor_version }} ts-mocha typescript
  123. anchor test
  124. - name: cargo publish
  125. run: |
  126. cargo publish --manifest-path=crates/bolt-lang/attribute/account/Cargo.toml --token ${CRATES_TOKEN}
  127. cargo publish --manifest-path=crates/bolt-lang/attribute/component/Cargo.toml --token ${CRATES_TOKEN}
  128. cargo publish --manifest-path=crates/bolt-lang/attribute/component-deserialize/Cargo.toml --token ${CRATES_TOKEN}
  129. cargo publish --manifest-path=crates/bolt-lang/attribute/system/Cargo.toml --token ${CRATES_TOKEN}
  130. cargo publish --manifest-path=programs/bolt-system/Cargo.toml --token ${CRATES_TOKEN}
  131. cargo publish --manifest-path=programs/bolt-component/Cargo.toml --token ${CRATES_TOKEN}
  132. cargo publish --manifest-path=programs/world/Cargo.toml --token ${CRATES_TOKEN}
  133. cargo publish --manifest-path=crates/bolt-lang/Cargo.toml --token ${CRATES_TOKEN}
  134. env:
  135. CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}