-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Sentry integration * Pytest updated * codecove config updated * Codecov GA added
- Loading branch information
Showing
8 changed files
with
134 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Codecov Report Upload | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
pytest: | ||
runs-on: ubuntu-latest | ||
environment: CI Environment | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Bring up Services and Run Tests | ||
run: | | ||
docker-compose -f docker-compose-pipeline.yml build | ||
docker-compose -f docker-compose-pipeline.yml up -d | ||
docker-compose -f docker-compose-pipeline.yml exec -T api pytest tests/ --cov --cov-report=xml --cov-fail-under=94 | ||
echo "STATUS=$(cat pytest-coverage.txt | grep 'Required test' | awk '{ print $1 }')" >> $GITHUB_ENV | ||
echo "FAILED=$(cat test-reports/report.xml | awk -F'=' '{print $5}' | awk -F' ' '{gsub(/"/, "", $1); print $1}')" >> $GITHUB_ENV | ||
env: | ||
FYLE_BASE_URL: ${{ secrets.FYLE_BASE_URL }} | ||
FYLE_TOKEN_URI: ${{ secrets.FYLE_TOKEN_URI }} | ||
NS_ACCOUNT_ID: ${{ secrets.NS_ACCOUNT_ID }} | ||
- name: Upload coverage reports to Codecov with GitHub Action | ||
uses: codecov/codecov-action@v3 | ||
- name: Stop Services | ||
run: docker compose -f docker-compose-pipeline.yml down | ||
- name: Evaluate Coverage | ||
if: ${{ (env.STATUS == 'FAIL') || (env.FAILED > 0) }} | ||
run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
codecov: | ||
require_ci_to_pass: false #post comment only if ci checks have passed | ||
comment: | ||
behavior: True #comment post behavior (update existing, post new, delete and post new) | ||
layout: reach, diff, flags, files #comment format | ||
require_base: true #base report is mandatory to post comment | ||
require_changes: false #only post comment if chages are done | ||
require_head: false #head commit is mandatory | ||
show_carryforward_flags: false | ||
coverage: #code coverage range | ||
precision: 2 | ||
range: | ||
- 97.0 | ||
- 98.0 | ||
round: down | ||
github_checks: | ||
annotations: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
|
||
import sentry_sdk | ||
|
||
from sentry_sdk.integrations.django import DjangoIntegration | ||
|
||
class Sentry: | ||
|
||
@staticmethod | ||
def init(): | ||
sentry_sdk.init( | ||
dsn=os.environ.get('SENTRY_DSN'), | ||
send_default_pii=True, | ||
integrations=[DjangoIntegration()], | ||
environment=os.environ.get('SENTRY_ENV'), | ||
traces_sampler=Sentry.traces_sampler, | ||
attach_stacktrace=True, | ||
request_bodies='small', | ||
in_app_include=['apps.users', | ||
'apps.workspaces', | ||
'apps.mappings', | ||
'apps.fyle', | ||
'apps.xero', | ||
'apps.tasks', | ||
'fyle_rest_auth', | ||
'fyle_accounting_mappings'], | ||
) | ||
|
||
@staticmethod | ||
def traces_sampler(sampling_context): | ||
# avoiding ready APIs in performance tracing | ||
if sampling_context.get('wsgi_environ') is not None: | ||
if sampling_context['wsgi_environ']['PATH_INFO'] in ['/ready']: | ||
return 0 | ||
|
||
return 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters