From 6c3895fcd8cd73fa439415e107783543dc9c286f Mon Sep 17 00:00:00 2001 From: Min Huang Date: Fri, 21 Mar 2025 21:40:42 -0700 Subject: [PATCH] run common tests --- .github/workflows/build.yml | 4 ++++ .github/workflows/test.yml | 35 +++++++++++++++++++++++++++++++++++ pyproject.toml | 1 + scripts.py | 4 ++++ 4 files changed, 44 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f001b3..51c8691 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,3 +62,7 @@ jobs: author_name: github-actions[bot] author_email: github-actions[bot]@github.com message: Automatic commit via GitHub Actions + + - name: Test + if: ${{ steps.commit.outputs.committed == 'false' }} + run: poetry run test_common \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3d8fecf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: + - ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install poetry + run: python -m pip install poetry==2.1.1 + + - name: Configure poetry + run: poetry config virtualenvs.in-project true + + - name: Cache the virtualenv + uses: actions/cache@v4 + with: + path: ./.venv + key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + run: poetry install + + - name: Run format + run: poetry run test diff --git a/pyproject.toml b/pyproject.toml index 144f906..54188ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ all = "scripts:run_all" format = "scripts:run_format" lint = "scripts:run_lint" test = "scripts:run_tests" +test_common = "scripts:run_tests_common" [tool.poetry.dependencies] numpy = "^2.2.4" diff --git a/scripts.py b/scripts.py index c4e9217..28d2b3a 100644 --- a/scripts.py +++ b/scripts.py @@ -23,3 +23,7 @@ def run_format(): def run_tests(): run_cmd("poetry run pytest project_euler") + + +def run_tests_common(): + run_cmd("poetry run pytest project_euler/common")