run-lint.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Run Bolt Lint
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. branches:
  8. - main
  9. env:
  10. solana_version: v1.18.15
  11. jobs:
  12. setup:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v4
  16. - uses: actions/setup-node@v4
  17. with:
  18. node-version: 21
  19. - name: Install Essentials
  20. run: |
  21. sudo apt-get update
  22. sudo apt-get install -y pkg-config build-essential libudev-dev
  23. npm install --global yarn
  24. - name: Cache Node Dependencies
  25. uses: actions/cache@v3
  26. with:
  27. path: '**/node_modules'
  28. key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
  29. - name: Install Rust
  30. uses: dtolnay/rust-toolchain@stable
  31. with:
  32. toolchain: stable
  33. - name: Cache Rust
  34. uses: Swatinem/rust-cache@v2
  35. - name: Install Solana
  36. run: |
  37. sh -c "$(curl -sSfL https://release.solana.com/${{ env.solana_version }}/install)"
  38. export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
  39. echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
  40. solana --version
  41. lint:
  42. needs: setup
  43. runs-on: ubuntu-latest
  44. strategy:
  45. matrix:
  46. task: [clippy, yarn]
  47. steps:
  48. - uses: actions/checkout@v4
  49. - name: Install node modules
  50. run: |
  51. yarn --frozen-lockfile --network-concurrency 2
  52. - name: Cache Rust
  53. uses: Swatinem/rust-cache@v2
  54. - name: Run Lint
  55. run: |
  56. if [ "${{ matrix.task }}" == "clippy" ]; then
  57. cargo fmt -- --check --verbose
  58. cargo clippy -- --deny=warnings --allow=unexpected_cfgs
  59. else
  60. yarn lint
  61. fi