Skip to content

Commit

Permalink
added saving dapp report data to db and analytics generation
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanAdamovNeon committed Aug 9, 2024
1 parent 8d75d9a commit 199672a
Show file tree
Hide file tree
Showing 15 changed files with 921 additions and 81 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/dapps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ jobs:
proxy_ip: ${{ needs.prepare.outputs.proxy_ip }}
solana_ip: ${{ needs.prepare.outputs.solana_ip }}
external_call: false
repo: 'tests'
event_name: ${{ github.event_name }}
ref: ${{ github.ref }}
ref_name: ${{ github.ref_name }}
head_ref: ${{ github.head_ref }}
base_ref: ${{ github.base_ref }}
last_commit_message: ${{ github.event.head_commit.message }}
docker_image_tag: ''
history_depth_limit: '10'

notify:
runs-on: ubuntu-20.04
Expand Down
80 changes: 78 additions & 2 deletions .github/workflows/dapps_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,42 @@ on:
type: boolean
required: false
default: true
repo:
type: string
description: "Repository type: tests | proxy | evm"
required: false
event_name:
type: string
description: "Event name"
required: false
ref:
type: string
description: "Reference (branch or tag)"
required: false
ref_name:
type: string
description: "Reference name"
required: false
head_ref:
type: string
description: "Head reference for pull requests"
required: false
base_ref:
type: string
description: "Base reference for pull requests"
required: false
last_commit_message:
type: string
description: "Message of the last commit"
required: false
docker_image_tag:
type: string
description: "Docker image tag"
required: false
history_depth_limit:
type: string
description: "Limit for commit history depth"
required: false

env:
NETWORK: ${{ inputs.network }}
Expand Down Expand Up @@ -612,7 +648,47 @@ jobs:
name: pancake-report
path: reports/
- name: "Swap report"
env:
TEST_RESULTS_DB_HOST: ${{ secrets.TEST_RESULTS_DB_HOST }}
TEST_RESULTS_DB_PORT: ${{ secrets.TEST_RESULTS_DB_PORT }}
TEST_RESULTS_DB_NAME: ${{ secrets.TEST_RESULTS_DB_NAME }}
TEST_RESULTS_DB_USER: ${{ secrets.TEST_RESULTS_DB_USER }}
TEST_RESULTS_DB_PASSWORD: ${{ secrets.TEST_RESULTS_DB_PASSWORD }}
run: |
python3 ./clickfile.py dapps report --directory=reports \
--pr_url_for_report=${{ inputs.pr_url_for_report }} \
--token=${{secrets.GHTOKEN}}
--repo="${{inputs.repo}}" \
--event_name="${{inputs.event_name}}" \
--ref="${{inputs.ref}}" \
--ref_name="${{inputs.ref_name}}" \
--head_ref="${{inputs.head_ref}}" \
--base_ref="${{inputs.base_ref}}" \
--last_commit_message="${{inputs.last_commit_message}}" \
--docker_image_tag="${{inputs.docker_image_tag}}" \
--history_depth_limit="${{inputs.history_depth_limit}}"
- name: "Upload cost_reports.pdf"
if: ${{ hashFiles('cost_reports.pdf') != '' }}
uses: actions/upload-artifact@v4
with:
name: cost_reports
path: cost_reports.pdf
- name: Get the download url for cost_reports and save to cost_reports.md
if: ${{ hashFiles('cost_reports.pdf') != '' }}
id: get_artifact_url
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
run: |
ARTIFACT_INFO=$(gh api -X GET "/repos/${{ github.repository }}/actions/artifacts" | jq -r ".artifacts[] | select(.name==\"${ARTIFACT_NAME}\") | {id: .id, run_id: .workflow_run.id}")
ARTIFACT_ID=$(echo "${ARTIFACT_INFO}" | jq -r '.id')
RUN_ID=$(echo "${ARTIFACT_INFO}" | jq -r '.run_id')
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${RUN_ID}/artifacts/${ARTIFACT_ID}"
echo "🔗[Cost report](${ARTIFACT_URL})" > cost_reports.md
- name: "Add cost reports to summary"
run: |
cat cost_reports.md >> $GITHUB_STEP_SUMMARY
- name: "Add PR comment"
if: ${{ inputs.pr_url_for_report != '' }}
run: |
python3 ./clickfile.py dapps add_pr_comment \
--pr_url_for_report="${{ inputs.pr_url_for_report }}" \
--token="${{ secrets.GHTOKEN }}" \
--md_file cost_reports.md
Loading

0 comments on commit 199672a

Please sign in to comment.