From ae9539f8d4d38d0e46b06bbb6663d643022c9509 Mon Sep 17 00:00:00 2001 From: laurent Date: Thu, 26 Jun 2025 14:35:57 +0200 Subject: [PATCH] Add the pre-commit check to the CI. --- .github/actions/moshi_build/action.yml | 27 ++++++++++++++++++++++++++ .github/workflows/precommit.yml | 17 ++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 .github/actions/moshi_build/action.yml create mode 100644 .github/workflows/precommit.yml diff --git a/.github/actions/moshi_build/action.yml b/.github/actions/moshi_build/action.yml new file mode 100755 index 0000000..f7eebf3 --- /dev/null +++ b/.github/actions/moshi_build/action.yml @@ -0,0 +1,27 @@ +name: moshi_build +description: 'Build env.' +runs: + using: "composite" + steps: + - uses: actions/setup-python@v2 + with: + python-version: '3.10.14' + - uses: actions/cache@v3 + id: cache + with: + path: env + key: env-${{ hashFiles('moshi/pyproject.toml') }} + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + shell: bash + run: | + python3 -m venv env + . env/bin/activate + python -m pip install --upgrade pip + pip install torch==2.4.0 --index-url https://download.pytorch.org/whl/cpu + - name: Setup env + shell: bash + run: | + source env/bin/activate + pip install -e moshi==0.2.6 + pre-commit install diff --git a/.github/workflows/precommit.yml b/.github/workflows/precommit.yml new file mode 100644 index 0000000..e599571 --- /dev/null +++ b/.github/workflows/precommit.yml @@ -0,0 +1,17 @@ +name: precommit +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + run_precommit: + name: Run precommit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/moshi_build + - run: | + . env/bin/activate + bash .git/hooks/pre-commit