Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added codecov code for showing statistics #2871

Merged
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f39599a
added codecov code for showing statistics
VanshikaSabharwal Jan 19, 2025
d5da3e9
changed yml to yaml
VanshikaSabharwal Jan 19, 2025
781da57
changed yml to yaml
VanshikaSabharwal Jan 19, 2025
20c1006
changed yaml back to yml
VanshikaSabharwal Jan 19, 2025
6f48459
added some code in vitest.config.ts
VanshikaSabharwal Jan 20, 2025
fca9609
added some code in vitest.config.ts
VanshikaSabharwal Jan 20, 2025
61a1b79
Merge branch 'develop-postgres' into codecov-work
VanshikaSabharwal Jan 20, 2025
0d9c5c4
added some code in vitest.config.ts
VanshikaSabharwal Jan 20, 2025
5ee1906
Merge branch 'codecov-work' of https://github.com/VanshikaSabharwal/t…
VanshikaSabharwal Jan 20, 2025
836dc81
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
742df0f
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
415ad59
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
0021e35
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
852fc45
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
bbd21c0
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
af4f58f
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
af8f8b2
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
e718f45
updated code acc. to coderabbitai suggestions
VanshikaSabharwal Jan 20, 2025
d6789a4
set threshold to 39%
VanshikaSabharwal Jan 20, 2025
10ac35a
updated formatting to make all tests run
VanshikaSabharwal Jan 20, 2025
cb6090f
updated formatting to make all tests run
VanshikaSabharwal Jan 20, 2025
b7c499a
Update pull-request.yml
VanshikaSabharwal Jan 20, 2025
d077837
Update pull-request.yml
VanshikaSabharwal Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 85 additions & 68 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
run: |
echo "Pull requests are only allowed against the 'develop-postgres' branch. Please refer to the pull request guidelines."
echo "Error: Close this PR and try again."
exit 1
exit 1

Code-Quality-Checks:
name: Checking code quality
runs-on: ubuntu-latest
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:

- name: Run Python script
run: |
python .github/workflows/scripts/code_coverage_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}
python .github/workflows/scripts/code_coverage_disable_check.py --files ${{ steps.changed-files.outputs.all_changed_files }}

check_gql_tada:
name: Check gql tada files and configuration
Expand All @@ -98,7 +98,7 @@ jobs:
run: docker buildx build --file ./docker/api.Containerfile --tag talawa_api --target non_production ./
- name: Check gql tada
run: docker container run talawa_api pnpm check_gql_tada

check_drizzle_migrations:
name: Check drizzle migration files
runs-on: ubuntu-latest
Expand All @@ -109,7 +109,7 @@ jobs:
run: docker buildx build --file ./docker/api.Containerfile --tag talawa_api --target non_production ./
- name: Check drizzle migrations
run: docker container run --env-file ./envFiles/.env.ci talawa_api pnpm check_drizzle_migrations

check_type_errors:
name: Check type errors
runs-on: ubuntu-latest
Expand All @@ -127,71 +127,74 @@ jobs:
needs: [Code-Quality-Checks]
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v4.2.2
- id: changed_files
name: Get changed files
uses: tj-actions/changed-files@v45.0.4
with:
files: |
.coderabbit.yaml
Caddyfile
codegen.ts
Dockerfile*
docker-compose*
.dockerignore
.env.sample
.env_test
eslint.config.mjs
envFiles/**
.gitignore
init-mongo.sh
.prettierignore
.prettierrc.json
.pylintrc
.github/**
biome.jsonc
drizzle_migrations/**
renovate.json
requirements.txt
schema.graphql
CODEOWNERS
LICENSE
tsconfig.json
vitest.config.ts
pnpm-lock.yaml
package.json
package-lock.json
.nojekyll
docs/docusaurus.config.ts
docs/sidebar*
setup.ts
tsconfig.build.json
vite.config.mts
CNAME
CODE_OF_CONDUCT.md
CODE_STYLE.md
CONTRIBUTING.md
DOCUMENTATION.md
INSTALLATION.md
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md
- env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
if: steps.changed_files.outputs.any_changed == 'true' || steps.changed_files.outputs.any_deleted == 'true'
name: Show changed files
run: |
echo "Unauthorized changes were made in the following files:"
for FILE in ${CHANGED_FILES}; do
echo "$FILE"
done
echo "To override this, apply the 'ignore-sensitive-files-pr' label"
exit 1
- name: Checkout this repository
uses: actions/checkout@v4.2.2
- id: changed_files
name: Get changed files
uses: tj-actions/changed-files@v45.0.4
with:
files: |
.coderabbit.yaml
Caddyfile
codegen.ts
Dockerfile*
docker-compose*
.dockerignore
.env.sample
.env_test
eslint.config.mjs
envFiles/**
.gitignore
init-mongo.sh
.prettierignore
.prettierrc.json
.pylintrc
.github/**
biome.jsonc
drizzle_migrations/**
renovate.json
requirements.txt
schema.graphql
CODEOWNERS
LICENSE
tsconfig.json
vitest.config.ts
pnpm-lock.yaml
package.json
package-lock.json
.nojekyll
docs/docusaurus.config.ts
docs/sidebar*
setup.ts
tsconfig.build.json
vite.config.mts
CNAME
CODE_OF_CONDUCT.md
CODE_STYLE.md
CONTRIBUTING.md
DOCUMENTATION.md
INSTALLATION.md
ISSUE_GUIDELINES.md
PR_GUIDELINES.md
README.md
- env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }}
if: steps.changed_files.outputs.any_changed == 'true' || steps.changed_files.outputs.any_deleted == 'true'
name: Show changed files
run: |
echo "Unauthorized changes were made in the following files:"
for FILE in ${CHANGED_FILES}; do
echo "$FILE"
done
echo "To override this, apply the 'ignore-sensitive-files-pr' label"
exit 1

Run-Tests:
name: Run tests for talawa api
runs-on: ubuntu-latest
needs: [Code-Quality-Checks, check_code_coverage_disable]
env:
CODECOV_UNIQUE_NAME: ${{github.workflow}}-${{github.ref_name}}
steps:
- name: Checkout this repository
uses: actions/checkout@v4.2.2
Expand All @@ -201,12 +204,25 @@ jobs:
run: docker compose build
- name: Run tests
run: docker compose up --exit-code-from api
- name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}}
uses: codecov/codecov-action@v4
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
name: "${{env.CODECOV_UNIQUE_NAME}}"

VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
- name: Test acceptable level of code coverage
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: "./coverage/lcov.info"
min_coverage: 95.0

Test-Docusaurus-Deployment:
name: Test Deployment to https://docs-api.talawa.io
runs-on: ubuntu-latest
needs: [Run-Tests]
# Run only if the develop-postgres branch and not dependabot
# Run only if the develop-postgres branch and not dependabot
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop-postgres' }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -290,3 +306,4 @@ jobs:
run: |
source venv/bin/activate
python .github/workflows/scripts/check_docstrings.py --directories .github

VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"generate_gql_tada": "gql.tada generate-output && gql.tada turbo --fail-on-warn",
"push_drizzle_schema": "drizzle-kit push",
"push_drizzle_test_schema": "drizzle-kit push --config=./test/drizzle.config.ts",
"run_tests": "vitest",
"run_tests": "vitest --coverage",
VanshikaSabharwal marked this conversation as resolved.
Show resolved Hide resolved
"start_development_server": "tsx watch ./src/index.ts",
"start_development_server_with_debugger": "tsx watch --inspect=${API_DEBUGGER_HOST:-127.0.0.1}:${API_DEBUGGER_PORT:-9229} ./src/index.ts",
"start_production_server": "pnpm build_production && node ./dist/index.js",
Expand All @@ -94,4 +94,4 @@
},
"type": "module",
"version": "1.0.0"
}
}
7 changes: 5 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// More information at this link: https://vitest.dev/config/
import tsconfigPaths from "vite-tsconfig-paths";
import { defineConfig } from "vitest/config";

export default defineConfig({
plugins: [tsconfigPaths()],
test: {
// // https://vitest.dev/config/#fileparallelism
coverage: {
provider: "v8", // or 'istanbul' if you prefer
reporter: ["text", "lcov", "html"], // Specify 'lcov' to generate lcov.info
},
// https://vitest.dev/config/#fileparallelism
// fileParallelism: true,

// https://vitest.dev/config/#globalsetup
Expand Down
Loading