| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- name: Pre-commit checks
- on:
- pull_request:
- push:
- branches: [main]
- env:
- PYTHON_VERSION: "3.11"
- POETRY_VERSION: "1.4.2"
- jobs:
- pre-commit:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- # Need to grab the history of the PR
- fetch-depth: 0
- - uses: actions-rs/toolchain@v1
- with:
- profile: default
- toolchain: 1.82.0
- - name: Install Rust versions
- run: |
- rustup install 1.73.0
- - name: Install protoc
- uses: arduino/setup-protoc@v3
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- - uses: actions/checkout@v4
- - name: Install poetry
- run: pipx install poetry
- - name: Install g++ 12
- run: |
- sudo apt-get install g++-12
- echo "CXX=/usr/bin/g++-12" >> "${GITHUB_ENV}"
- - uses: actions/setup-python@v2
- with:
- python-version: ${{ env.PYTHON_VERSION }}
- id: setup_python
- - name: Cache Poetry cache
- uses: actions/cache@v3
- with:
- path: ~/.cache/pypoetry
- key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }}
- - uses: pre-commit/action@v3.0.0
- if: ${{ github.event_name == 'pull_request' }}
- with:
- # Run only on files changed in the PR
- extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
- - uses: pre-commit/action@v3.0.0
- if: ${{ github.event_name != 'pull_request' }}
|