From a23ac8a70f0550a0a4fd160e130b8f04e1d7e1f7 Mon Sep 17 00:00:00 2001 From: teds-lin Date: Sun, 22 Oct 2023 16:13:11 +0800 Subject: [PATCH 1/3] [#14] feature: Backend github action CI flow --- .github/workflows/backend_ci.yml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/backend_ci.yml diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml new file mode 100644 index 0000000..a9b1fe7 --- /dev/null +++ b/.github/workflows/backend_ci.yml @@ -0,0 +1,36 @@ +name: Python Package build test + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build-linux: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.12 + uses: actions/setup-python@v3 + with: + python-version: '3.12.0' + - name: Install poerty + uses: abatilo/actions-poetry@v2 + with: + poetry-version: '1.6.1' + - name: Install dependencies by poerty + run: | + cd backend + poetry install + - name: Run linter by ruff + run: | + cd backend + poetry run ruff check -v app + - name: Run test by pytest + run: | + cd backend + poetry run pytest -v tests From 45456af554741ed16f1b439eada5a48c517a5ac9 Mon Sep 17 00:00:00 2001 From: teds-lin Date: Sun, 22 Oct 2023 16:14:12 +0800 Subject: [PATCH 2/3] [#14] fix: regular test file name --- backend/tests/e2e/{game.py => test_game.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename backend/tests/e2e/{game.py => test_game.py} (100%) diff --git a/backend/tests/e2e/game.py b/backend/tests/e2e/test_game.py similarity index 100% rename from backend/tests/e2e/game.py rename to backend/tests/e2e/test_game.py From 9e2be526af1c6ed7191a44bc2a8c41dbc4b1c343 Mon Sep 17 00:00:00 2001 From: teds-lin <125881849+teds-lin@users.noreply.github.com> Date: Thu, 26 Oct 2023 09:08:57 +0800 Subject: [PATCH 3/3] [#14] document: refining pytest example --- backend/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/README.md b/backend/README.md index b8e3b8f..932600f 100644 --- a/backend/README.md +++ b/backend/README.md @@ -29,7 +29,7 @@ curl --request POST --http2 \ ### Test ```bash -poetry run pytest -v ./tests/e2e/game.py +poetry run pytest -v ./tests/e2e/test_game.py ``` ### Linter