ci-pre-commit.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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@v3
  14. with:
  15. # Need to grab the history of the PR
  16. fetch-depth: 0
  17. - uses: actions-rs/toolchain@v1
  18. with:
  19. profile: minimal
  20. toolchain: nightly-2023-03-01
  21. components: rustfmt, clippy
  22. - uses: actions-rs/toolchain@v1
  23. with:
  24. profile: minimal
  25. toolchain: nightly-2023-07-23
  26. components: rustfmt, clippy
  27. - uses: actions-rs/toolchain@v1
  28. with:
  29. profile: minimal
  30. toolchain: nightly-2024-03-26
  31. components: rustfmt, clippy
  32. - uses: actions-rs/toolchain@v1
  33. with:
  34. profile: minimal
  35. toolchain: nightly-2024-08-04
  36. components: rustfmt, clippy
  37. - name: Install protoc
  38. uses: arduino/setup-protoc@v3
  39. - uses: actions/checkout@v4
  40. - name: Install poetry
  41. run: pipx install poetry
  42. - uses: actions/setup-python@v2
  43. with:
  44. python-version: ${{ env.PYTHON_VERSION }}
  45. id: setup_python
  46. - name: Cache Poetry cache
  47. uses: actions/cache@v3
  48. with:
  49. path: ~/.cache/pypoetry
  50. key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
  51. - name: Install poetry dependencies
  52. run: poetry -C express_relay/sdk/python/express_relay install
  53. shell: sh
  54. - uses: pre-commit/action@v3.0.0
  55. if: ${{ github.event_name == 'pull_request' }}
  56. with:
  57. # Run only on files changed in the PR
  58. extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
  59. - uses: pre-commit/action@v3.0.0
  60. if: ${{ github.event_name != 'pull_request' }}