ci-message-buffer.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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: actions-rust-lang/setup-rust-toolchain@v1
  21. with:
  22. cache-workspaces: "pythnet/message_buffer -> target"
  23. - name: Install Solana
  24. run: |
  25. wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  26. sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  27. sh -c "$(curl -sSfL https://release.anza.xyz/v1.17.34/install)"
  28. echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
  29. - name: Install Anchor
  30. run: |
  31. unset CARGO_UNSTABLE_SPARSE_REGISTRY
  32. unset CARGO_REGISTRIES_CRATES_IO_PROTOCOL
  33. # Anchor doesn't build with newer Rust
  34. cargo +1.66.1 install --git https://github.com/coral-xyz/anchor --tag v0.27.0 anchor-cli --locked
  35. - name: Install g++ 12
  36. run: |
  37. sudo apt-get install g++-12
  38. echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}"
  39. - uses: actions/setup-node@v4
  40. with:
  41. node-version-file: "package.json"
  42. # Libusb is a build requirement for the node-hid package and so pnpm
  43. # install will fail if this isn't in the build environment and if a
  44. # precompiled binary isn't found.
  45. - name: Install libusb
  46. run: sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libudev-dev
  47. - uses: pnpm/action-setup@v4
  48. name: Install pnpm
  49. with:
  50. run_install: true
  51. - name: Build and generate IDLs
  52. run: |
  53. unset CARGO_UNSTABLE_SPARSE_REGISTRY
  54. unset CARGO_REGISTRIES_CRATES_IO_PROTOCOL
  55. rustup override set 1.66.1
  56. anchor build
  57. rustup override unset
  58. - name: Copy anchor target files
  59. run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/
  60. - name: Fix formatting (to avoid pre-commit failures)
  61. run: pnpm turbo --filter message_buffer fix:format
  62. - name: Check IDL changes
  63. # Fails if the IDL files are not up to date. Please use anchor build to regenerate the IDL files for
  64. # the current version of the contract and update idl directory.
  65. run: git diff --exit-code idl/*
  66. if: success() || failure()
  67. - name: Cargo format
  68. run: cargo fmt --all -- --check
  69. if: success() || failure()
  70. - name: Cargo clippy
  71. run: cargo clippy --all-targets -- --deny warnings