ci-pre-commit.yml 2.4 KB

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