anchor.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. name: Anchor Programs
  2. on:
  3. push:
  4. branches: ["main"]
  5. pull_request:
  6. branches: ["main"]
  7. env:
  8. CARGO_TERM_COLOR: always
  9. jobs:
  10. setup:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout code
  14. uses: actions/checkout@v3
  15. - name: Cache cargo registry
  16. uses: actions/cache@v2
  17. with:
  18. path: ~/.cargo/registry
  19. key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
  20. - name: Cache target
  21. uses: actions/cache@v2
  22. with:
  23. path: target
  24. key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
  25. - uses: actions/setup-node@v3
  26. with:
  27. node-version: 16.14.2
  28. cache: "npm"
  29. - name: Install dependencies
  30. run: |
  31. sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
  32. cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
  33. sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev
  34. avm install latest
  35. avm use latest
  36. shell: bash
  37. build:
  38. needs: setup
  39. runs-on: ubuntu-latest
  40. strategy:
  41. matrix:
  42. dir:
  43. [
  44. "basics/account-data/anchor",
  45. "basics/checking-accounts/anchor",
  46. "basics/close-account/anchor",
  47. "basics/counter/anchor",
  48. "basics/create-account/anchor",
  49. "basics/cross-program-invocation/anchor",
  50. "basics/hello-solana/anchor",
  51. "basics/pda-rent-payer/anchor",
  52. "basics/processing-instructions/anchor",
  53. "basics/program-derived-addresses/anchor",
  54. "basics/realloc/anchor",
  55. "basics/rent/anchor",
  56. "basics/repository-layout/anchor",
  57. "basics/transfer-sol/anchor",
  58. "compression/cnft-vault/anchor",
  59. "oracles/pyth/anchor",
  60. "tokens/create-token/anchor",
  61. "tokens/nft-minter/anchor",
  62. "tokens/pda-mint-authority/anchor",
  63. "tokens/spl-token-minter/anchor",
  64. "tokens/token-2022/basics/anchor",
  65. "tokens/transfer-tokens/anchor",
  66. ]
  67. steps:
  68. - name: Checkout code
  69. uses: actions/checkout@v3
  70. - name: Cache cargo registry
  71. uses: actions/cache@v2
  72. with:
  73. path: ~/.cargo/registry
  74. key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
  75. - name: Cache target
  76. uses: actions/cache@v2
  77. with:
  78. path: target
  79. key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
  80. - name: Set environment variables
  81. run: |
  82. echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
  83. echo "$HOME/.cargo/bin" >> $GITHUB_PATH
  84. npm i -g @project-serum/anchor-cli@$ANCHOR_VERSION ts-mocha typescript
  85. shell: bash
  86. - name: Build program
  87. working-directory: ${{ matrix.dir }}
  88. run: anchor build