ci-message-buffer.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: Message Buffer Check
  2. on:
  3. pull_request:
  4. paths:
  5. - .github/workflows/ci-message-buffer.yml
  6. - pythnet/message_buffer/**
  7. push:
  8. branches:
  9. - main
  10. jobs:
  11. abi-check:
  12. name: Check Message Buffer formatting & IDL files
  13. runs-on: ubuntu-latest
  14. defaults:
  15. run:
  16. working-directory: pythnet/message_buffer
  17. steps:
  18. - name: Checkout sources
  19. uses: actions/checkout@v3
  20. - uses: Swatinem/rust-cache@v2
  21. with:
  22. workspaces: "pythnet/message_buffer -> target"
  23. - uses: actions-rs/toolchain@v1
  24. with:
  25. toolchain: 1.66.1
  26. components: rustfmt, clippy
  27. - name: Install Solana
  28. run: |
  29. wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  30. sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  31. sh -c "$(curl -sSfL https://release.anza.xyz/v1.17.34/install)"
  32. echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
  33. - name: Install Anchor
  34. run: |
  35. cargo install --git https://github.com/coral-xyz/anchor --tag v0.27.0 anchor-cli --locked
  36. - name: Install g++ 12
  37. run: |
  38. sudo apt-get install g++-12
  39. echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}"
  40. - uses: actions/setup-node@v4
  41. with:
  42. node-version-file: "package.json"
  43. # Libusb is a build requirement for the node-hid package and so pnpm
  44. # install will fail if this isn't in the build environment and if a
  45. # precompiled binary isn't found.
  46. - name: Install libusb
  47. run: sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libudev-dev
  48. - uses: pnpm/action-setup@v4
  49. name: Install pnpm
  50. with:
  51. run_install: true
  52. - name: Build and generate IDLs
  53. run: anchor build
  54. - name: Copy anchor target files
  55. run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/
  56. - name: Fix formatting (to avoid pre-commit failures)
  57. run: pnpm turbo --filter message_buffer fix:format
  58. - name: Check IDL changes
  59. # Fails if the IDL files are not up to date. Please use anchor build to regenerate the IDL files for
  60. # the current version of the contract and update idl directory.
  61. run: git diff --exit-code idl/*
  62. if: success() || failure()
  63. - name: Cargo format
  64. run: cargo fmt --all -- --check
  65. if: success() || failure()
  66. - name: Cargo clippy
  67. run: cargo clippy --tests -- --deny warnings
  68. if: success() || failure()