ci-message-buffer.yml 2.6 KB

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