From 96eef33c4c92a3967b2ffebc30799a638edb8c7a Mon Sep 17 00:00:00 2001 From: Laurent Mazare Date: Thu, 26 Jun 2025 14:41:57 +0200 Subject: [PATCH] Add the pre-commit check to the CI. (#18) * Add the pre-commit check to the CI. * CI tweaks. * Add the pre-commit. --- .github/actions/moshi_build/action.yml | 28 ++++++++++++++++++++++++++ .github/workflows/precommit.yml | 17 ++++++++++++++++ 2 files changed, 45 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..eb14bc0 --- /dev/null +++ b/.github/actions/moshi_build/action.yml @@ -0,0 +1,28 @@ +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 + pip install moshi==0.2.6 + pip install pre-commit + - name: Setup env + shell: bash + run: | + source env/bin/activate + 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