From ab075bc9a665d289113a98757c423a48fe1f19aa Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:41:31 +0530 Subject: Test 1 --- src/tests/test.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/tests/test.py diff --git a/src/tests/test.py b/src/tests/test.py new file mode 100644 index 0000000..46803bd --- /dev/null +++ b/src/tests/test.py @@ -0,0 +1,7 @@ +from typing import List + +import os + +def sum_even_numbers(numbers: List[int]) -> int: + """Given a list of integers, return the sum of all even numbers in the list.""" + return sum(num for num in numbers if num % 2 == 0) \ No newline at end of file -- cgit v1.2.3 From 1cb569f657641fb63e27db641cc148959f0273fd Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:45:34 +0530 Subject: Test 1 - update --- src/tests/test_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/test_utils.py b/src/tests/test_utils.py index b7b7f22..8ae63ae 100644 --- a/src/tests/test_utils.py +++ b/src/tests/test_utils.py @@ -15,6 +15,7 @@ # along with this program. If not, see . from unittest import TestCase +import os class TestVyOSUtils(TestCase): def test_key_mangling(self): from vyos.utils.dict import mangle_dict_keys -- cgit v1.2.3 From fad18d17d0146ab2026c2c5ad7551ef535528003 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:05:34 +0530 Subject: test --- .github/workflows/ruff-lint-2.yml | 56 --------------------------------------- .github/workflows/ruff-lint.yml | 31 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/ruff-lint-2.yml diff --git a/.github/workflows/ruff-lint-2.yml b/.github/workflows/ruff-lint-2.yml deleted file mode 100644 index 1c5d54e..0000000 --- a/.github/workflows/ruff-lint-2.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -name: Ruff Lint 2 - -on: - pull_request: - branches: - - current - -permissions: - pull-requests: write - contents: read - -jobs: - ruff-lint-2: - runs-on: ubuntu-latest - permissions: - pull-requests: write - contents: read - steps: - - name: Checkout reusable actions repo - uses: actions/checkout@v3 - with: - repository: vyos/.github - path: reusable-actions - ref: current - - - name: Checkout head - uses: actions/checkout@v4 - with: - fetch-depth: 0 - fetch-tags: true - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - path: repo - - - name: Fetch base - run: | - cd repo - git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }} ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/base - - - name: Setup python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Get changed files - id: changed-files - run: | - cd repo - git diff --name-only origin/base...${{ github.event.pull_request.head.ref }} > changed_files.txt - - - name: Run ruff on changed files - uses: ChartBoost/ruff-action@v1 - with: - files: | - $(cat repo/changed_files.txt) \ No newline at end of file diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 4a87521..e84f5a2 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -6,10 +6,35 @@ on: pull_request jobs: ruff-lint: runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read steps: - - uses: actions/checkout@v4 + - name: Checkout head + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Fetch base ruff config + run: | + git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }} ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/base + if git ls-tree -r origin/base --name-only | grep -q '^ruff.toml$'; then + git checkout origin/base -- ruff.toml + echo "Using ruff.toml from base repo" + cat ruff.toml + else + echo "No ruff.toml found in base repo" + fi + + - name: Lint + uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: - changed-files: 'true' + args: 'format --check' + changed-files: 'true' \ No newline at end of file -- cgit v1.2.3 From 0aa05f2f0d6d432108e792424a055115af40c484 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:07:20 +0530 Subject: test --- .github/workflows/ruff-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index e84f5a2..8909621 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -36,5 +36,5 @@ jobs: - name: Lint uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: - args: 'format --check' + args: check changed-files: 'true' \ No newline at end of file -- cgit v1.2.3 From dc3ffbe3c5c7963d857e413a7b8b0bea46d7006c Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 01:09:10 +0530 Subject: test --- ruff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruff.toml b/ruff.toml index d85ceb7..e363f95 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,4 +1,4 @@ -line-length = 100 # defaults to 88 like black +line-length = 80 # defaults to 88 like black target-version = "py39" # the python version to target, useful when considering code upgrades, defaults to "py310" select = [ -- cgit v1.2.3 From 2dd73ddef5a8f19d7176140dd079e769d2914280 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:13:11 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 8909621..5122334 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -20,21 +20,15 @@ jobs: - name: Setup python uses: actions/setup-python@v5 with: - python-version: '3.11' - - - name: Fetch base ruff config - run: | - git fetch https://github.com/${{ github.event.pull_request.base.repo.full_name }} ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/base - if git ls-tree -r origin/base --name-only | grep -q '^ruff.toml$'; then - git checkout origin/base -- ruff.toml - echo "Using ruff.toml from base repo" - cat ruff.toml - else - echo "No ruff.toml found in base repo" - fi + python-version: '3.11' - name: Lint uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: args: check - changed-files: 'true' \ No newline at end of file + changed-files: 'true' + + - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b + with: + args: format --diff + changed-files: true \ No newline at end of file -- cgit v1.2.3 From e8534587f32b46359d496db26eb8cb46d6ab37c5 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:15:44 +0530 Subject: Test --- src/tests/test.py | 7 ------- src/tests/test_utils.py | 1 - 2 files changed, 8 deletions(-) delete mode 100644 src/tests/test.py diff --git a/src/tests/test.py b/src/tests/test.py deleted file mode 100644 index 46803bd..0000000 --- a/src/tests/test.py +++ /dev/null @@ -1,7 +0,0 @@ -from typing import List - -import os - -def sum_even_numbers(numbers: List[int]) -> int: - """Given a list of integers, return the sum of all even numbers in the list.""" - return sum(num for num in numbers if num % 2 == 0) \ No newline at end of file diff --git a/src/tests/test_utils.py b/src/tests/test_utils.py index 8ae63ae..b7b7f22 100644 --- a/src/tests/test_utils.py +++ b/src/tests/test_utils.py @@ -15,7 +15,6 @@ # along with this program. If not, see . from unittest import TestCase -import os class TestVyOSUtils(TestCase): def test_key_mangling(self): from vyos.utils.dict import mangle_dict_keys -- cgit v1.2.3 From ef1dfe7f1e2967b1cada50249a29ef8309ad9ff3 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:17:40 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 5122334..a86d133 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -22,11 +22,11 @@ jobs: with: python-version: '3.11' - - name: Lint - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b - with: - args: check - changed-files: 'true' + # - name: Lint + # uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b + # with: + # args: check + # changed-files: 'true' - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: -- cgit v1.2.3 From 5a6c38d483a176734c9777e62baeb94a66b67176 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:20:24 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index a86d133..e34dcb7 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -22,13 +22,13 @@ jobs: with: python-version: '3.11' - # - name: Lint - # uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b - # with: - # args: check - # changed-files: 'true' + - name: Lint + uses: chartboost/ruff-action@v1 + with: + args: check + changed-files: 'true' - - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b + - uses: chartboost/ruff-action@v1 with: args: format --diff changed-files: true \ No newline at end of file -- cgit v1.2.3 From 7a29e41cd3d14f7d8936003d660814461ce4ea01 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:24:40 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 6 +++--- src/tests/test.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/tests/test.py diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index e34dcb7..76e183c 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -23,12 +23,12 @@ jobs: python-version: '3.11' - name: Lint - uses: chartboost/ruff-action@v1 + uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: args: check changed-files: 'true' - - uses: chartboost/ruff-action@v1 + - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: args: format --diff - changed-files: true \ No newline at end of file + changed-files: 'true' \ No newline at end of file diff --git a/src/tests/test.py b/src/tests/test.py new file mode 100644 index 0000000..46803bd --- /dev/null +++ b/src/tests/test.py @@ -0,0 +1,7 @@ +from typing import List + +import os + +def sum_even_numbers(numbers: List[int]) -> int: + """Given a list of integers, return the sum of all even numbers in the list.""" + return sum(num for num in numbers if num % 2 == 0) \ No newline at end of file -- cgit v1.2.3 From e7bfd5e3c9d4f4c71e58b94021a2d0dd1411f260 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:29:18 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 76e183c..3ca3f06 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -29,6 +29,7 @@ jobs: changed-files: 'true' - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b + if: always() with: args: format --diff changed-files: 'true' \ No newline at end of file -- cgit v1.2.3 From 2c067857e4ef3e7968a6001a1ae3224fae69c937 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:31:29 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 3ca3f06..7f93ccd 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -10,25 +10,26 @@ jobs: pull-requests: write contents: read steps: - - name: Checkout head + - name: Checkout Head uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Setup python + - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.11' - - name: Lint + - name: Ruff Check uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: args: check changed-files: 'true' - - uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b + - name: Ruff Format + uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b if: always() with: args: format --diff -- cgit v1.2.3 From e7d873791a5dbfb141c4360ed21347677d5fc2e3 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:49:29 +0530 Subject: T6678: changed files --- .github/workflows/ruff-lint.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 7f93ccd..390086c 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -17,18 +17,22 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Setup Python - uses: actions/setup-python@v5 + - name: Get changed py files + id: changed-py-files + uses: tj-actions/changed-files@v44 with: - python-version: '3.11' + files: | + **.py - name: Ruff Check + if: steps.changed-py-files.outputs.any_changed == 'true' uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b with: args: check changed-files: 'true' - name: Ruff Format + if: steps.changed-py-files.outputs.any_changed == 'true' uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b if: always() with: -- cgit v1.2.3 From 07cc0c965687596760e65ffc3a3a1416a9a616f1 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:50:20 +0530 Subject: T6678: changed fil --- src/tests/test_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/test_utils.py b/src/tests/test_utils.py index b7b7f22..8ae63ae 100644 --- a/src/tests/test_utils.py +++ b/src/tests/test_utils.py @@ -15,6 +15,7 @@ # along with this program. If not, see . from unittest import TestCase +import os class TestVyOSUtils(TestCase): def test_key_mangling(self): from vyos.utils.dict import mangle_dict_keys -- cgit v1.2.3 From 505fd94fd48b545da18487ce3aa202a92e6835e7 Mon Sep 17 00:00:00 2001 From: Vijayakumar A <36878324+kumvijaya@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:54:11 +0530 Subject: Test --- .github/workflows/ruff-lint.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ruff-lint.yml b/.github/workflows/ruff-lint.yml index 390086c..6ba9447 100644 --- a/.github/workflows/ruff-lint.yml +++ b/.github/workflows/ruff-lint.yml @@ -32,9 +32,8 @@ jobs: changed-files: 'true' - name: Ruff Format - if: steps.changed-py-files.outputs.any_changed == 'true' + if: always() && steps.changed-py-files.outputs.any_changed == 'true' uses: chartboost/ruff-action@491342200cdd1cf4d5132a30ddc546b3b5bc531b - if: always() with: args: format --diff changed-files: 'true' \ No newline at end of file -- cgit v1.2.3