-
Notifications
You must be signed in to change notification settings - Fork 6
datadog test #66
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
Merged
Merged
datadog test #66
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7ff4146
chore: refactor workflows to use a common shared workflow
m-mcgowan 193839b
chore: adds test run to datadog when the api key is defined
m-mcgowan 6dcf5af
chore: warn if DD_API_KEY is not defined.
m-mcgowan 8426e7a
chore: try the `--ddtrace-patch-all` flag
m-mcgowan 52c3d9f
style: line endings
m-mcgowan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,104 @@ | ||
| # Reusable workflow to run the python CI, which covers | ||
| # Optional notificiation to notehub (requires secrets NOTEHUB_SESSION_TOKEN, NOTEHUB_DEVICE_ID and NOTEHUB_PRODUCT_UID) | ||
| # Python installation and dependencies | ||
| # Linting (flake8 and docstyle) | ||
| # Testing and coverage with pytest | ||
| # Optionally publish coverage to coveralls (requires secrets.GITHUB_TOKEN) | ||
| # Reports test coverage to DataDog if secrets.DD_API_KEY is defined. | ||
|
|
||
| on: | ||
| workflow_call: | ||
| secrets: | ||
| NOTEHUB_SESSION_TOKEN: | ||
| NOTEHUB_PRODUCT_UID: | ||
| NOTECARD_DEVICE_ID: | ||
| inputs: | ||
| coveralls: | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
| notehub_notify: | ||
| type: boolean | ||
| required: false | ||
| default: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-20.04 | ||
| strategy: | ||
| matrix: | ||
| python-version: [3.6, 3.7, 3.8, 3.9] | ||
|
|
||
| env: | ||
| DD_API_KEY: ${{ secrets.DD_API_KEY }} | ||
|
|
||
| steps: | ||
| - name: Send building notification | ||
| if: ${{ inputs.notehub_notify }} | ||
| run: | | ||
| curl --request POST \ | ||
| --url 'https://api.notefile.net/?product=${{ secrets.NOTEHUB_PRODUCT_UID }}&device=${{ secrets.NOTECARD_DEVICE_ID }}' \ | ||
| --header 'Content-Type: application/json' \ | ||
| --header 'X-Session-Token: ${{ secrets.NOTEHUB_SESSION_TOKEN }}' \ | ||
| --data '{"req":"note.add","file":"build_results.qi","body":{"result":"building"}}' | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -U flake8 pytest coveralls ddtrace | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Lint with flake8 | ||
| run: | | ||
| # stop the build if there are Python syntax errors or undefined names | ||
| make flake8 | ||
| - name: Lint Docs with Pydocstyle | ||
| run: | | ||
| make docstyle | ||
| - name: Send running tests notification | ||
| if: ${{ inputs.notehub_notify }} | ||
| run: | | ||
| curl --request POST \ | ||
| --url 'https://api.notefile.net/?product=${{ secrets.NOTEHUB_PRODUCT_UID }}&device=${{ secrets.NOTECARD_DEVICE_ID }}' \ | ||
| --header 'Content-Type: application/json' \ | ||
| --header 'X-Session-Token: ${{ secrets.NOTEHUB_SESSION_TOKEN }}' \ | ||
| --data '{"req":"note.add","file":"build_results.qi","body":{"result":"running_tests"}}' | ||
|
|
||
| - name: Check DD API Key | ||
| if: ${{ !env.DD_API_KEY }} | ||
| run: | | ||
| echo Test run will NOT be collected by DD | ||
|
|
||
| - name: Test with pytest | ||
| env: | ||
| DD_CIVISIBILITY_AGENTLESS_ENABLED: ${{ !!env.DD_API_KEY }} | ||
| DD_SERVICE: note-python | ||
| DD_ENV: ci | ||
| run: | | ||
| coverage run -m pytest --ddtrace --ddtrace-patch-all | ||
| - name: Publish to Coveralls | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| if: ${{ inputs.coveralls }} | ||
| run: | | ||
| coveralls --service=github | ||
|
|
||
| - name: Check if the job has succeeded | ||
| if: ${{ success() && inputs.notehub_notify }} | ||
| run: | | ||
| curl --request POST \ | ||
| --url 'https://api.notefile.net/?product=${{ secrets.NOTEHUB_PRODUCT_UID }}&device=${{ secrets.NOTECARD_DEVICE_ID }}' \ | ||
| --header 'Content-Type: application/json' \ | ||
| --header 'X-Session-Token: ${{ secrets.NOTEHUB_SESSION_TOKEN }}' \ | ||
| --data '{"req":"note.add","file":"build_results.qi","body":{"result":"success"}}' | ||
| - name: Check if the job has failed | ||
| if: ${{ failure() && inputs.notehub_notify }} | ||
| run: | | ||
| curl --request POST \ | ||
| --url 'https://api.notefile.net/?product=${{ secrets.NOTEHUB_PRODUCT_UID }}&device=${{ secrets.NOTECARD_DEVICE_ID }}' \ | ||
| --header 'Content-Type: application/json' \ | ||
| --header 'X-Session-Token: ${{ secrets.NOTEHUB_SESSION_TOKEN }}' \ | ||
| --data '{"req":"note.add","file":"build_results.qi","body":{"result":"tests_failed"}}' |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.