ci-message-buffer-idl.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Message Buffer IDL Check
  2. on:
  3. pull_request:
  4. paths:
  5. - pythnet/message_buffer/**
  6. push:
  7. branches:
  8. - main
  9. jobs:
  10. abi-check:
  11. name: Check Message Buffer IDL files are up to date
  12. runs-on: ubuntu-latest
  13. defaults:
  14. run:
  15. working-directory: pythnet/message_buffer
  16. steps:
  17. - name: Checkout sources
  18. uses: actions/checkout@v3
  19. - uses: Swatinem/rust-cache@v2
  20. with:
  21. workspaces: "pythnet/message_buffer -> target"
  22. - uses: actions-rs/toolchain@v1
  23. with:
  24. profile: minimal
  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.solana.com/v1.14.18/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: Build and generate IDLs
  37. run: anchor build
  38. - name: Copy anchor target files
  39. run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/
  40. # Libusb is a build requirement for the node-hid package and so pnpm
  41. # install will fail if this isn't in the build environment and if a
  42. # precompiled binary isn't found.
  43. - name: Install libusb
  44. run: sudo apt install -y libusb-1.0-0-dev libudev-dev
  45. - uses: pnpm/action-setup@v4
  46. name: Install pnpm
  47. - name: Install prettier globally
  48. run: pnpm install -g prettier@2.7.1
  49. - name: Run prettier (to avoid pre-commit failures)
  50. run: |
  51. pnpm dlx prettier@2.7.1 --write "./idl/*"
  52. - name: Check IDL changes
  53. # Fails if the IDL files are not up to date. Please use anchor build to regenerate the IDL files for
  54. # the current version of the contract and update idl directory.
  55. run: git diff --exit-code idl/*