ci-pre-commit.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Pre-commit checks
  2. on:
  3. pull_request:
  4. push:
  5. branches: [main]
  6. env:
  7. PYTHON_VERSION: "3.11"
  8. POETRY_VERSION: "1.4.2"
  9. jobs:
  10. pre-commit:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v4
  14. - uses: actions-rs/toolchain@v1
  15. with:
  16. profile: default
  17. toolchain: 1.82.0
  18. - name: Install Rust versions
  19. run: |
  20. rustup install 1.73.0
  21. rustup install 1.66.1
  22. - name: Cache Rust dependencies
  23. uses: Swatinem/rust-cache@v2
  24. with:
  25. workspaces: |
  26. apps/fortuna
  27. apps/hermes/server
  28. target_chains/ethereum/sdk/stylus
  29. target_chains/cosmwasm
  30. target_chains/fuel/contracts
  31. target_chains/solana
  32. governance/remote_executor
  33. lazer
  34. pythnet/message_buffer
  35. pythnet/pythnet_sdk
  36. pythnet/stake_caps_parameters
  37. # We only save the cache from runs on `main` because the cache is ~5GB, and the total Github Cache limit is 10GB.
  38. # Branches have their own caches, so saving this cache on PRs can result in evicting the main cache.
  39. save-if: ${{ github.ref == 'refs/heads/main' }}
  40. - name: Install protoc
  41. uses: arduino/setup-protoc@v3
  42. with:
  43. repo-token: ${{ secrets.GITHUB_TOKEN }}
  44. - name: Install poetry
  45. run: pipx install poetry
  46. - name: Install g++ 12
  47. run: |
  48. sudo apt-get install g++-12
  49. echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}"
  50. - uses: actions/setup-python@v2
  51. with:
  52. python-version: ${{ env.PYTHON_VERSION }}
  53. id: setup_python
  54. - name: Cache Poetry cache
  55. uses: actions/cache@v3
  56. with:
  57. path: ~/.cache/pypoetry
  58. key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
  59. # Install Aptos CLI for Lazer contract formatting and linting
  60. - name: Download Aptos CLI
  61. run: wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v6.1.1/aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip
  62. - name: Install Aptos CLI
  63. run: |
  64. unzip aptos-cli-6.1.1-Ubuntu-22.04-x86_64.zip
  65. sudo mv aptos /usr/local/bin/
  66. chmod +x /usr/local/bin/aptos
  67. aptos update movefmt
  68. - uses: pre-commit/action@v3.0.0