From f72d10abae9504b99c7a16c7890e404398a431e5 Mon Sep 17 00:00:00 2001 From: Sourav Mallick Date: Tue, 14 Jan 2025 23:57:08 +0530 Subject: [PATCH 1/3] Add check workflow and test script --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ helloworld.py | 2 +- helloworld/main.py | 4 ++-- test/run_test.py | 5 +++++ 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 test/run_test.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..08b220e6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Flake8 Pull Request Check + +on: + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Validate code + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v3 + with: + version: "latest" + - name: Install dependencies and Run test script + run: | + uv build + flake8 test/run_test.py \ No newline at end of file diff --git a/helloworld.py b/helloworld.py index 59701dbe..b5d1f20e 100755 --- a/helloworld.py +++ b/helloworld.py @@ -6,4 +6,4 @@ import helloworld.main if __name__ == '__main__': - sys.exit(helloworld.main.main()) + sys.exit(helloworld.main.main()) \ No newline at end of file diff --git a/helloworld/main.py b/helloworld/main.py index 10567a62..40d7764f 100644 --- a/helloworld/main.py +++ b/helloworld/main.py @@ -21,6 +21,6 @@ def main(argv=None): # ensures the user hasn't passed any other unrecognized arguments. parser.parse_args(argv[1:]) - print("Hello, world") + return "Hello, world" - return 0 +# return 0 diff --git a/test/run_test.py b/test/run_test.py new file mode 100644 index 00000000..abfca175 --- /dev/null +++ b/test/run_test.py @@ -0,0 +1,5 @@ +import helloworld.main + +# print(helloworld.main.main()) + +assert helloworld.main.main() == 'Hello, world' \ No newline at end of file From 63728af7ee268b0c471ba807d4cdde4c28fb623e Mon Sep 17 00:00:00 2001 From: Sourav Mallick Date: Wed, 15 Jan 2025 00:03:25 +0530 Subject: [PATCH 2/3] Add check workflow --- .github/workflows/ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08b220e6..d85e73ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Flake8 Pull Request Check +name: Pull Request Check on: pull_request: @@ -16,10 +16,8 @@ jobs: with: python-version: '3.x' - name: Install the latest version of uv - uses: astral-sh/setup-uv@v3 - with: - version: "latest" - - name: Install dependencies and Run test script - run: | - uv build - flake8 test/run_test.py \ No newline at end of file + uses: astral-sh/setup-uv@v3 + with: + version: "latest" + - name: Run test script + run: uv run test/run_test.py \ No newline at end of file From 0d78a2911c37f0d8a6306d3d20a4bb111e4911cd Mon Sep 17 00:00:00 2001 From: Sourav Mallick Date: Wed, 15 Jan 2025 00:12:34 +0530 Subject: [PATCH 3/3] Change main script to check workflow --- helloworld/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helloworld/main.py b/helloworld/main.py index 40d7764f..5d6f071b 100644 --- a/helloworld/main.py +++ b/helloworld/main.py @@ -21,6 +21,6 @@ def main(argv=None): # ensures the user hasn't passed any other unrecognized arguments. parser.parse_args(argv[1:]) - return "Hello, world" + return "Hello, world2" # return 0