-
Notifications
You must be signed in to change notification settings - Fork 56
Automating SDK generation process #171
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
Open
Raghunath-S-S-J
wants to merge
50
commits into
master
Choose a base branch
from
feature/sdk-automation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
553c0ab
Adds Deploy step
db2412c
adds a separate deploy step
08fa57b
install twine
61d9370
update to correct alpha version
8327412
removed some unused steps
e119bd2
final commit with test instance
e718f32
fixed review comments - corrected name from deploy to publish
49e5f12
Merge pull request #157 from XeroAPI/PETOSS-534-Publish-Python-SDK-af…
vigneshk-tw b7c4c85
updated packages, added audit ci step, added prism script
a7604ec
ci: fix build ci step
a2bdc74
added alpha version for testing
1cfdd02
added vulnerable package to text test the pipeline
15dc01e
refactored the audit steps
a05d150
added sudo to pip audit
2810f3f
Added read me file
f58785a
renamed a step
2e46874
incorporated the review comments
23377eb
renamed the step
9bc7862
increase alpha version for testing
vigneshk-tw cbb4403
Merge pull request #158 from XeroAPI/PETOSS-517-python-vulnerabilitie…
vigneshk-tw cc72c3b
adds verbose
vigneshk-tw 22e9cf2
verify publish with the new token
vigneshk-tw 651e4e3
adds if case to publish either to pypi or testpypi
vigneshk-tw 1de299a
update publish script
vigneshk-tw 65a9aa2
deploy to pypi instead of test instance
vigneshk-tw 8473d38
removed unwanted changes
vigneshk-tw 7a1632e
removed the verbose flag
vigneshk-tw 06e3fa5
Merge pull request #162 from XeroAPI/PETOSS-604-Replace-Test-instance…
vigneshk-tw 26d6e2f
start and stop prism for running tests
vigneshk-tw d20a509
install prism
vigneshk-tw 41fd22a
check if prism is installed properly
vigneshk-tw e3e7fce
corrected start script
vigneshk-tw b672e73
removed sudo
vigneshk-tw 7834c27
adds nohup
vigneshk-tw ec413b6
adds disown
vigneshk-tw bea1f9d
adds continue-on-error
vigneshk-tw 15f4f51
uncommented and adds sleep
vigneshk-tw 234066d
commented source activation
vigneshk-tw 0b9cc88
adds environment
vigneshk-tw 0b05dd3
removed version for urllib3
vigneshk-tw 20873cd
increase sleep timing
vigneshk-tw 94a8f5f
commented echo statemenet
vigneshk-tw 3797926
try adding sleep while starting prism
vigneshk-tw c0b657b
increase sleep timer
vigneshk-tw d6b63e2
try removing disown
vigneshk-tw 217a7ef
clanup commit
vigneshk-tw b8eb6d8
final cleanup
vigneshk-tw 7a8f410
Merge pull request #163 from XeroAPI/PETOSS-585-Enable-Test-Step-in-C…
vigneshk-tw 3cb9ad7
ci: Added slack alert code
sangeet-joy-tw dcbf497
Merge branch 'master' into feature/sdk-automation
sangeet-joy-tw 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: slack-alert-action | ||
description: "Action to send slack payload to public-sdk-events channel" | ||
|
||
inputs: | ||
heading_text: | ||
required: true | ||
description: "Heading of the slack payload" | ||
alert_type: | ||
required: true | ||
description: "type of the slack alert" | ||
job_status: | ||
required: true | ||
description: "status of the job" | ||
XERO_SLACK_WEBHOOK_URL: | ||
required: true | ||
description: "webhook url for channel - public-sdk-events" | ||
job_url: | ||
required: true | ||
description: "job run id link" | ||
button_type: | ||
required: true | ||
description: "color for the check logs button" | ||
package_version: | ||
required: true | ||
description: "released package version" | ||
repo_link: | ||
required: true | ||
description: "link of the repo" | ||
|
||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
|
||
- name: Send slack notification | ||
id: slack | ||
uses: slackapi/[email protected] | ||
env: | ||
SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
with: | ||
payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "rich_text", | ||
"elements": [ | ||
{ | ||
"type": "rich_text_section", | ||
"elements": [ | ||
{ | ||
"type": "text", | ||
"text": "${{inputs.heading_text}} ", | ||
"style": { | ||
"bold": true | ||
} | ||
}, | ||
{ | ||
"type": "emoji", | ||
"name": "${{inputs.alert_type}}" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Repository:* \n ${{inputs.repo_link}}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Status:*\n ${{inputs.job_status}}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Package Version:*\n ${{inputs.package_version}}" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Check the logs", | ||
"emoji": true | ||
}, | ||
"style": "${{inputs.button_type}}", | ||
"url": "${{inputs.job_url}}" | ||
} | ||
] | ||
} | ||
] | ||
} |
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,100 @@ | ||
name: Publish | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_number: ${{steps.get_latest_release_number.outputs.release_tag}} | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout xero-python repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: XeroAPI/xero-python | ||
path: xero-python | ||
|
||
- name: Set up Python environment | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
cache: 'pip' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install --upgrade pip | ||
sudo pip install twine | ||
working-directory: xero-python | ||
|
||
- name: Fetch Latest release number | ||
id: get_latest_release_number | ||
run: | | ||
latest_version=$(gh release view --json tagName --jq '.tagName') | ||
echo "Latest release version is - $latest_version" | ||
echo "::set-output name=release_tag::$latest_version" | ||
working-directory: xero-python | ||
env: | ||
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Build Package | ||
run: python setup.py sdist | ||
working-directory: xero-python | ||
|
||
- name: Publish to PyPi | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }} | ||
run: twine upload dist/* | ||
working-directory: xero-python | ||
|
||
notify-slack-on-success: | ||
runs-on: ubuntu-latest | ||
needs: publish | ||
if: success() | ||
steps: | ||
- name: Checkout xero-pythonrepo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: XeroAPI/xero-python | ||
path: xero-python | ||
|
||
- name: Send slack notification on success | ||
uses: ./xero-python/.github/actions/notify-slack | ||
with: | ||
heading_text: "Publish job has succeeded !" | ||
alert_type: "thumbsup" | ||
job_status: "Success" | ||
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} | ||
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" | ||
button_type: "primary" | ||
package_version: ${{needs.publish.outputs.release_number}} | ||
repo_link: ${{github.server_url}}/${{github.repository}} | ||
|
||
notify-slack-on-failure: | ||
runs-on: ubuntu-latest | ||
needs: publish | ||
if: failure() | ||
steps: | ||
- name: Checkout xero-python repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: XeroAPI/xero-python | ||
path: xero-python | ||
|
||
- name: Send slack notification on failure | ||
uses: ./xero-python/.github/actions/notify-slack | ||
with: | ||
heading_text: "Publish job has failed !" | ||
alert_type: "alert" | ||
job_status: "Failed" | ||
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}} | ||
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" | ||
button_type: "danger" | ||
package_version: ${{needs.publish.outputs.release_number}} | ||
repo_link: ${{github.server_url}}/${{github.repository}} | ||
Comment on lines
+80
to
+100
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
python-dateutil>=2.7 | ||
urllib3 | ||
certifi | ||
setuptools>=75.1.0 |
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,11 @@ | ||
#!/bin/bash | ||
|
||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_accounting.yaml --host 127.0.0.1 --port 4010 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-app-store.yaml --host 127.0.0.1 --port 4011 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_assets.yaml --host 127.0.0.1 --port 4012 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero_bankfeeds.yaml --host 127.0.0.1 --port 4013 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-finance.yaml --host 127.0.0.1 --port 4014 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-uk.yaml --host 127.0.0.1 --port 4015 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-nz.yaml --host 127.0.0.1 --port 4016 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-payroll-au.yaml --host 127.0.0.1 --port 4017 & | ||
prism mock https://raw.githubusercontent.com/XeroAPI/Xero-OpenAPI/refs/heads/master/xero-projects.yaml --host 127.0.0.1 --port 4018 |
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium