From a47acff36e7bc6fe87798659fb87fbf986b4eb6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Tolga=20Erd=C3=B6nmez?= Date: Tue, 17 Jun 2025 16:39:36 +0300 Subject: [PATCH 1/5] feature: linting workflows for frontend/backend --- .github/workflows/lint.yml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..8e6fe76 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,54 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + backend-lint: + name: Backend Lint + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./backend + steps: + - uses: actions/checkout@v4 + + - name: Set up poetry + run: pipx install poetry==2.1.2 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'poetry' + cache-dependency-path: ./backend/poetry.lock + + - name: Install dependencies + run: poetry install --only=main,dev + + - name: Run linting + run: poetry run pre-commit run --all-files + + frontend-lint: + name: Frontend Lint + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20.14' + cache: 'npm' + cache-dependency-path: './frontend/package-lock.json' + + - name: Install dependencies + run: npm ci + + - name: Run linting + run: npm run lint From 80d6971c17c5b21e05476fe1cd2cc2e0d4dbf45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Tolga=20Erd=C3=B6nmez?= Date: Tue, 17 Jun 2025 17:08:27 +0300 Subject: [PATCH 2/5] feature: test backend workflow --- .github/workflows/test.yml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7d054d1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + backend-tests: + name: Backend Tests + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./backend + services: + postgres: + image: postgres + env: + POSTGRES_USER: pguser + POSTGRES_PASSWORD: pgpassword + POSTGRES_DB: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + PG_HOST: postgres + PG_USER: pguser + PG_PASSWORD: pgpassword + PG_DB: postgres + POSTGRES_USER: pguser + POSTGRES_PASSWORD: pgpassword + POSTGRES_DB: postgres + LLM_EVAL_ENCRYPTION_KEY: M2kbagZtWPjxfjeDio2VDH+sVH45BsUHUxHzR+hW3Ps= + steps: + - uses: actions/checkout@v4 + + - name: Set up poetry + run: pipx install poetry==2.1.2 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: 'poetry' + cache-dependency-path: ./backend/poetry.lock + + - name: Install dependencies + run: poetry install --only=main,dev,test + + - name: Run linting + run: poetry run pytest --cov llm_eval tests From dcbbbd1ec8c15446d575fa25aecfa3fc41e20b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Tolga=20Erd=C3=B6nmez?= Date: Tue, 17 Jun 2025 17:58:31 +0300 Subject: [PATCH 3/5] feature: backend & frontend test workflows --- .github/workflows/test.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d054d1..6d16c0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,8 @@ jobs: services: postgres: image: postgres + ports: + - 5432:5432 env: POSTGRES_USER: pguser POSTGRES_PASSWORD: pgpassword @@ -26,7 +28,7 @@ jobs: --health-timeout 5s --health-retries 5 env: - PG_HOST: postgres + PG_HOST: localhost PG_USER: pguser PG_PASSWORD: pgpassword PG_DB: postgres @@ -50,5 +52,26 @@ jobs: - name: Install dependencies run: poetry install --only=main,dev,test - - name: Run linting + - name: Running tests run: poetry run pytest --cov llm_eval tests + + frontend-tests: + name: Frontend Tests + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./frontend + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20.14' + cache: 'npm' + cache-dependency-path: './frontend/package-lock.json' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm run test:coverage From ba7401390d8355f3855fbb02d0ef923bd3cbd305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Tolga=20Erd=C3=B6nmez?= Date: Tue, 17 Jun 2025 18:06:57 +0300 Subject: [PATCH 4/5] WIP: artifacts for tests --- .github/workflows/test.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d16c0d..6aaf7ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,14 @@ jobs: run: poetry install --only=main,dev,test - name: Running tests - run: poetry run pytest --cov llm_eval tests + run: poetry run pytest --cov llm_eval --cov-report=xml tests + + - name: Upload backend coverage report + uses: actions/upload-artifact@v4 + with: + name: backend-coverage + path: ./backend/coverage.xml + if-no-files-found: error frontend-tests: name: Frontend Tests @@ -74,4 +81,11 @@ jobs: run: npm ci - name: Run tests - run: npm run test:coverage + run: npm run test:coverage -- --coverageReporters=json --coverageDirectory=coverage + + - name: Upload frontend coverage report + uses: actions/upload-artifact@v4 + with: + name: frontend-coverage + path: ./frontend/coverage/coverage-final.json + if-no-files-found: error From 2ac3c8408ea3e6185d488a8d9291e5035a445c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Tolga=20Erd=C3=B6nmez?= Date: Tue, 17 Jun 2025 18:10:35 +0300 Subject: [PATCH 5/5] feature: uploading test coverage artifacts --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6aaf7ea..277a66c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -81,7 +81,7 @@ jobs: run: npm ci - name: Run tests - run: npm run test:coverage -- --coverageReporters=json --coverageDirectory=coverage + run: npm run test:coverage -- --reporter=json --outputFile=coverage/coverage-final.json - name: Upload frontend coverage report uses: actions/upload-artifact@v4