ci-message-buffer.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. # Libusb is a build requirement for the node-hid package and so pnpm
  42. # install will fail if this isn't in the build environment and if a
  43. # precompiled binary isn't found.
  44. - name: Install libusb
  45. run: sudo apt install -y libusb-1.0-0-dev libudev-dev
  46. - uses: pnpm/action-setup@v4
  47. name: Install pnpm
  48. - name: Install prettier globally
  49. run: pnpm install -g prettier@2.7.1
  50. - name: Build and generate IDLs
  51. run: anchor build
  52. - name: Copy anchor target files
  53. run: cp ./target/idl/message_buffer.json idl/ && cp ./target/types/message_buffer.ts idl/
  54. - name: Run prettier (to avoid pre-commit failures)
  55. run: |
  56. pnpm dlx prettier@2.7.1 --write "./idl/*"
  57. - name: Check IDL changes
  58. # Fails if the IDL files are not up to date. Please use anchor build to regenerate the IDL files for
  59. # the current version of the contract and update idl directory.
  60. run: git diff --exit-code idl/*
  61. if: success() || failure()
  62. - name: Cargo format
  63. run: cargo fmt --all -- --check
  64. if: success() || failure()
  65. - name: Cargo clippy
  66. run: cargo clippy --tests -- --deny warnings
  67. if: success() || failure()