From ed45bc2dd75d7ff2215dc4101914d7c06a32232b Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:38:04 -0700 Subject: [PATCH] ci: pre-commit jobs * Add pre-commit check to CI * fixes --- .github/workflows/pre-commit.yml | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..71cd810 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,68 @@ +name: 🚨 pre-commit + +on: + pull_request: + push: + branches: + - "long_lived/**" + - main + - "release/**" + +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + +jobs: + pre-commit: + name: ${{ matrix.os.name }} ${{ matrix.python.major_dot_minor }} + runs-on: ${{ matrix.os.runs-on }} + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + os: + - name: Linux + matrix: linux + runs-on: ubuntu-latest + - name: macOS + matrix: macos + runs-on: macos-13-arm64 + python: + - major_dot_minor: "3.10" + - major_dot_minor: "3.11" + - major_dot_minor: "3.12" + + steps: + - name: Clean workspace + uses: Chia-Network/actions/clean-workspace@main + + - uses: Chia-Network/actions/git-mark-workspace-safe@main + + - name: disable git autocrlf + run: | + git config --global core.autocrlf false + + - uses: actions/checkout@v4 + + - uses: Chia-Network/actions/setup-python@main + with: + python-version: ${{ matrix.python.major_dot_minor }} + + - name: Create virtual environment + uses: Chia-Network/actions/create-venv@main + id: create-venv + + - name: Activate virtual environment + uses: Chia-Network/actions/activate-venv@main + with: + directories: ${{ steps.create-venv.outputs.activate-venv-directories }} + + - name: Run poetry install + uses: Chia-Network/actions/poetry@main + with: + poetry-command: "install --with dev" + + - env: + CHIA_MANAGE_CLVM_CHECK_USE_CACHE: "false" + CHIA_MANAGE_MYPY_CHECK_EXCLUSIONS: "true" + run: poetry run pre-commit run --all-files --verbose