ci-lazer-solana-contract.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: "Lazer Solana contract test"
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. paths:
  8. - lazer/**
  9. - .github/workflows/ci-lazer-solana-contract.yml
  10. jobs:
  11. lazer-solana-contract-test:
  12. name: Lazer Solana contract test
  13. runs-on: ubuntu-22.04
  14. defaults:
  15. run:
  16. working-directory: lazer/contracts/solana
  17. steps:
  18. - uses: actions/checkout@v4
  19. - uses: actions-rust-lang/setup-rust-toolchain@v1
  20. with:
  21. cache-workspaces: "lazer/contracts/solana -> target"
  22. - name: install taplo
  23. run: cargo install --locked taplo-cli@0.9.3
  24. - uses: actions/setup-node@v4
  25. with:
  26. node-version-file: "package.json"
  27. # Libusb is a build requirement for the node-hid package and so pnpm
  28. # install will fail if this isn't in the build environment and if a
  29. # precompiled binary isn't found.
  30. - name: Install libusb
  31. run: sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libudev-dev
  32. - uses: pnpm/action-setup@v4
  33. name: Install pnpm
  34. with:
  35. run_install: true
  36. - name: Install Solana Cli
  37. run: |
  38. sh -c "$(curl -sSfL https://release.anza.xyz/v2.1.21/install)"
  39. echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH"
  40. - name: Create Solana key
  41. run: solana-keygen new --no-bip39-passphrase
  42. - name: Install Anchor
  43. run: cargo install --git https://github.com/coral-xyz/anchor --tag v0.31.1 --locked anchor-cli
  44. - name: Run anchor tests
  45. run: pnpm run test:anchor
  46. - name: check Cargo.toml formatting
  47. run: find . -name Cargo.toml -exec taplo fmt --check --diff {} \;
  48. - name: Format check
  49. run: cargo fmt --all -- --check
  50. - name: Clippy check
  51. run: cargo clippy --all-targets -- --deny warnings
  52. - name: Build contract
  53. run: cargo build-sbf
  54. - name: test
  55. run: cargo test