Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

[Workflow] Add mypy check to pre-commit (#349)

Tianqi Xud1aeb7aadb71
diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
deleted file mode 100644
index 1916de211..000000000
--- a/.github/workflows/linting.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Linting
-
-on:
- push:
- branches:
- - master
- pull_request:
- merge_group:
-
-concurrency:
- cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ startsWith(github.ref, 'refs/pull/') || github.run_number }}
-
-jobs:
- linting:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - name: Set up Python environment and install dependencies
- uses: ./.github/actions/camel_install
- with:
- python-version: "3.8"
- - name: Run mypy checks
- run: |
- poetry run mypy --install-types --non-interactive --namespace-packages -p camel
- poetry run mypy --install-types --non-interactive --namespace-packages -p test
- poetry run mypy --install-types --non-interactive --namespace-packages -p apps
diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml
index cc27b60ce..80e1b69c0 100644
--- a/.github/workflows/pre_commit.yml
+++ b/.github/workflows/pre_commit.yml
@@ -11,8 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- - uses: actions/setup-python@v3
+ - name: Set up Python environment and install dependencies
+ uses: ./.github/actions/camel_install
with:
python-version: "3.8"
- - uses: pre-commit/[email protected]
- - uses: stefanzweifel/git-auto-commit-action@v4
+ - name: Run pre-commit
+ run: poetry run pre-commit run --all-files
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index dbd9632d0..92e978481 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -17,6 +17,16 @@ repos:
hooks:
- id: flake8
name: Check PEP8
+
+ - repo: local
+ hooks:
+ - id: mypy
+ name: Check mypy
+ entry: mypy --namespace-packages --install-types --non-interactive -p camel -p test -p apps
+ language: system
+ types: [python]
+ pass_filenames: false
+ require_serial: true
- repo: local
hooks: