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

GovTool - v2.0.11-patch1 #2932

Merged
merged 34 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
654a650
chore: add treasury mock proposal
kneerose Jan 31, 2025
d04969d
feat: check both treasury and info proposals for categorized proposals
kneerose Jan 31, 2025
55f2887
fix: filter proposal before show all button action
kneerose Jan 31, 2025
93cead3
fix: check on current category only instead of all
kneerose Jan 31, 2025
dbac716
chore: update GitHub Actions to use upload and download artifact v4
kneerose Feb 2, 2025
d2268a3
fix: add wait for dRep list to render properly on filter
kneerose Feb 2, 2025
0e1c3b7
Merge pull request #2887 from IntersectMBO/fix/proposal-category-vali…
kneerose Feb 5, 2025
1a231b3
feat: enhance ADA formatting with precision and suffixes for large va…
kneerose Feb 5, 2025
4db29c8
feat: add assertion to verify unvoted DRep counts on governance detai…
kneerose Feb 5, 2025
14c006b
fix: vote context validation for 10,000 character
kneerose Feb 5, 2025
22a6c97
fix: resize governance action card columns
MSzalowski Feb 5, 2025
474e609
feat: split dRep not voted calculation; assert only if totalStakeCont…
kneerose Feb 5, 2025
0e0af1a
test: increase timeout for visibility checks in proposal discussion t…
kneerose Feb 5, 2025
de6165f
Merge pull request #2910 from IntersectMBO/fix/govAction-adaFormat-vo…
kneerose Feb 6, 2025
c7dad14
fix: governance action votes calculation
MSzalowski Feb 6, 2025
cf25899
Merge pull request #2913 from IntersectMBO/fix/votes-counting-for-gov…
MSzalowski Feb 6, 2025
4b649a5
Merge pull request #2909 from IntersectMBO/fix/resize-governance-acti…
MSzalowski Feb 6, 2025
57581ef
chore: remove abstain from total drep votes calculation
MSzalowski Feb 6, 2025
b96c61f
Merge pull request #2917 from IntersectMBO/chore/remove-abstain-from-…
MSzalowski Feb 6, 2025
b92e470
feat: add commit status for playwright/backend test
kneerose Feb 7, 2025
082f6da
fix: checkout and set pending commit status order
kneerose Feb 7, 2025
a6bbd99
feat: add concurrency settings to test workflows
kneerose Feb 7, 2025
555f62a
fix(#2920): fix unhandled exception on missing proposal for vote
MSzalowski Feb 7, 2025
07d521b
Merge pull request #2921 from IntersectMBO/fix/2920-backend-crashes-w…
MSzalowski Feb 7, 2025
d58b8a6
feat(#2911): show drep metadata url and hash on detailed profile view
MSzalowski Feb 7, 2025
dd251bc
fix: remove abstain governance action votes from total stake
MSzalowski Feb 7, 2025
b6384f7
Merge pull request #2923 from IntersectMBO/feat/2911-show-drep-metada…
MSzalowski Feb 7, 2025
9ab9ada
Merge pull request #2922 from IntersectMBO/chore/remove-abstain-votes…
MSzalowski Feb 7, 2025
3d0099c
Merge pull request #2919 from IntersectMBO/feat/test-commit-status
kneerose Feb 10, 2025
19cbdec
fix: typos in IntersectMBO GitHub Pages
kneerose Feb 10, 2025
13b9c38
chore: set default report link to intersectMBO
kneerose Feb 10, 2025
6c41c5b
Merge pull request #2925 from IntersectMBO/fix/commit-status-report-link
kneerose Feb 10, 2025
f6d1be5
Merge pull request #2930 from IntersectMBO/develop
MSzalowski Feb 10, 2025
0c89866
Merge pull request #2931 from IntersectMBO/test
MSzalowski Feb 10, 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
75 changes: 75 additions & 0 deletions .github/scripts/set_commit_status.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# Ensure required environment variables are set
if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$GITHUB_SHA" ] || [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_RUN_ID" ]; then
echo "Missing required environment variables!"
exit 1
fi

# Retrieve necessary variables from workflow
START_TIME=${START_TIME:-$(date +%s)}
TEST_STATUS=${TEST_STATUS:-"failure"}
REPORT_NUMBER=${REPORT_NUMBER:-1}
REPORT_NAME=${REPORT_NAME:-"govtool-frontend"}
HOST_URL=${HOST_URL:-"https://govtool.cardanoapi.io"}
CONTEXT="Playwright Tests : $HOST_URL"

if [[ "$REPORT_NAME" == "govtool-backend" ]]; then
CONTEXT="Backend Tests : $BASE_URL"
fi

# Parse Allure JSON results
if [ -z "$(ls -A allure-results/*.json 2>/dev/null)" ]; then
echo "No Allure JSON results found!"
PASSED=0
FAILED=0
TOTAL=0
else
PASSED=$(jq -s '[.[] | select(.status == "passed")] | length' allure-results/*.json)
FAILED=$(jq -s '[.[] | select(.status == "failed")] | length' allure-results/*.json)
TOTAL=$((PASSED + FAILED))
fi



# Calculate test duration
CURRENT_TIME=$(date +%s)
TEST_DURATION_SECONDS=$((CURRENT_TIME - START_TIME))
TEST_DURATION_MINUTES=$((TEST_DURATION_SECONDS / 60))
TEST_DURATION_HOURS=$((TEST_DURATION_MINUTES / 60))

if [ "$TEST_DURATION_HOURS" -gt 0 ]; then
TEST_DURATION="${TEST_DURATION_HOURS} hour$( [ "$TEST_DURATION_HOURS" -ne 1 ] && echo "s"), $((TEST_DURATION_MINUTES % 60)) minute$( [ "$((TEST_DURATION_MINUTES % 60))" -ne 1 ] && echo "s"), and $((TEST_DURATION_SECONDS % 60)) second$( [ "$((TEST_DURATION_SECONDS % 60))" -ne 1 ] && echo "s")"
elif [ "$TEST_DURATION_MINUTES" -gt 0 ]; then
TEST_DURATION="${TEST_DURATION_MINUTES} minute$( [ "$TEST_DURATION_MINUTES" -ne 1 ] && echo "s") and $((TEST_DURATION_SECONDS % 60)) second$( [ "$((TEST_DURATION_SECONDS % 60))" -ne 1 ] && echo "s")"
else
TEST_DURATION="${TEST_DURATION_SECONDS} second$( [ "$TEST_DURATION_SECONDS" -ne 1 ] && echo "s")"
fi

# Determine target URL based on environment
case "$GH_PAGES" in
"IntersectMBO/govtool-test-reports") TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${REPORT_NAME}/${REPORT_NUMBER}" ;;
"cardanoapi/govtool-test-reports") TARGET_URL="https://cardanoapi.github.io/govtool-test-reports/${REPORT_NAME}/${REPORT_NUMBER}" ;;
*) TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${REPORT_NAME}/${REPORT_NUMBER}" ;;
esac

# Determine test result message
if [[ "$TEST_STATUS" == "success" ]]; then
DESCRIPTION="Tests passed in ${TEST_DURATION}"
elif [[ "$TEST_STATUS" == "failure" && "$TOTAL" -ne 0 ]]; then
DESCRIPTION="Tests failed in ${TEST_DURATION}: Passed ${PASSED}, Failed ${FAILED} out of ${TOTAL}"
else
DESCRIPTION="⚠️ Tests execution failed :$TEST_STATUS"
TEST_STATUS="error"
TARGET_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
fi



# Send commit status update to GitHub
curl -X POST -H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA} \
-d "{\"state\": \"${TEST_STATUS}\", \"context\": \"${CONTEXT}\", \"description\": \"${DESCRIPTION}\", \"target_url\": \"${TARGET_URL}\"}"

echo "Commit status updated successfully!"
65 changes: 56 additions & 9 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Backend Test

permissions:
contents: read
checks: write
statuses: write

on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -27,14 +32,31 @@ on:
workflows: ["Build and deploy GovTool test stack"]
types: [completed]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
backend-tests:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
outputs:
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
status: ${{ steps.run-tests.outcome }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set pending commit status
id: set-pending-status
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
-d "{\"state\": \"pending\", \"context\": \"Backend Tests : ${{env.BASE_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"


- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -43,6 +65,7 @@ jobs:

- name: Run Backend Test
working-directory: tests/govtool-backend
id: run-tests
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
Expand All @@ -55,26 +78,27 @@ jobs:
fi
python ./setup.py
python -m pytest --alluredir allure-results
env:
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
NETWORK: ${{ inputs.network || vars.NETWORK }}
KUBER_API_KEY: ${{ secrets.KUBER_API_KEY }}

- name: Upload report
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: allure-results
path: tests/govtool-backend/allure-results
env:
NETWORK: ${{ inputs.network || vars.NETWORK }}
KUBER_API_KEY: ${{ secrets.KUBER_API_KEY }}

publish-report:
runs-on: ubuntu-latest
if: always() && needs.backend-tests.result != 'skipped'
needs: backend-tests
outputs:
report_number: ${{ steps.report-details.outputs.report_number }}
steps:
- uses: actions/checkout@v4
- name: Download results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: allure-results
path: allure-results
Expand Down Expand Up @@ -134,6 +158,29 @@ jobs:
folder: build
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: govtool-backend
GH_PAGES: ${{vars.GH_PAGES}}
publish-status:
runs-on: ubuntu-latest
if: always()
needs: [backend-tests, publish-report]
steps:
- uses: actions/checkout@v4
- name: Download results
uses: actions/download-artifact@v4
with:
name: allure-results
path: allure-results
- name: Set Commit Status
if: always()
run: |
chmod +x .github/scripts/set_commit_status.sh
.github/scripts/set_commit_status.sh
env:
START_TIME: ${{ needs.backend-tests.outputs.start_time }}
TEST_STATUS: ${{ needs.backend-tests.outputs.status }}
REPORT_NUMBER: ${{ needs.publish-report.outputs.report_number }}
GITHUB_TOKEN: ${{ github.token }}

env:
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
REPORT_NAME: govtool-backend
GH_PAGES: ${{vars.GH_PAGES}}
59 changes: 52 additions & 7 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Integration Test [Playwright]

permissions:
contents: read
checks: write
statuses: write

on:
workflow_dispatch:
inputs:
Expand All @@ -26,16 +31,32 @@ on:
workflow_run:
workflows: ["Build and deploy GovTool test stack"]
types: [completed]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
integration-tests:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
outputs:
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
status: ${{ steps.run-test.outcome }}
defaults:
run:
working-directory: tests/govtool-frontend/playwright
steps:
- uses: actions/checkout@v4
- name: Set pending commit status
id: set-pending-status
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
-d "{\"state\": \"pending\", \"context\": \"Playwright Tests : ${{env.HOST_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"

- uses: actions/setup-node@v4
with:
node-version: "18"
Expand All @@ -58,6 +79,7 @@ jobs:
run: npx playwright install --with-deps

- name: Run tests
id: run-test
run: |
mkdir -p ./lib/_mock
chmod +w ./lib/_mock
Expand All @@ -81,21 +103,20 @@ jobs:
npm test

- name: Upload report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: allure-results
path: tests/govtool-frontend/playwright/allure-results

- name: Upload lock logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: lock-logs
path: tests/govtool-frontend/playwright/lock_logs.txt

env:
HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}
API_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}/api
DOCS_URL: ${{ vars.DOCS_URL }}
KUBER_API_KEY: ${{secrets.KUBER_API_KEY}}
Expand All @@ -111,10 +132,12 @@ jobs:
runs-on: ubuntu-latest
if: always() && needs.integration-tests.result != 'skipped'
needs: integration-tests
outputs:
report_number: ${{ steps.report-details.outputs.report_number }}
steps:
- uses: actions/checkout@v4
- name: Download report
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: allure-results
path: allure-results
Expand Down Expand Up @@ -175,6 +198,28 @@ jobs:
folder: build
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: govtool-frontend
GH_PAGES: ${{vars.GH_PAGES}}
publish-status:
runs-on: ubuntu-latest
if: always()
needs: [integration-tests, publish-report]
steps:
- uses: actions/checkout@v4
- name: Download results
uses: actions/download-artifact@v4
with:
name: allure-results
path: allure-results
- name: Set Commit Status
if: always()
run: |
chmod +x .github/scripts/set_commit_status.sh
.github/scripts/set_commit_status.sh
env:
START_TIME: ${{ needs.integration-tests.outputs.start_time }}
TEST_STATUS: ${{ needs.integration-tests.outputs.status }}
REPORT_NUMBER: ${{ needs.publish-report.outputs.report_number }}
GITHUB_TOKEN: ${{ github.token }}
env:
HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}
REPORT_NAME: govtool-frontend
GH_PAGES: ${{vars.GH_PAGES}}
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ changes.

### Added

-
- Add metadata url and hash to drep details [Issue 2911](https://github.com/IntersectMBO/govtool/issues/2911)

### Fixed

-
- Fix calculating votes counting for governance actions
- Fix crashing backend on unhandled missing proposal from vote [Issue 2920](https://github.com/IntersectMBO/govtool/issues/2920)
- Remove abstain votes (not auto abstain) from total DRep stake

### Changed

- Change threshold visual representation in governance action votes
- Resize governance action details columns

### Removed

-
- Remove abstain from total DRep votes calculation

## [v2.0.11](https://github.com/IntersectMBO/govtool/releases/tag/v2.0.11) 2025-02-04

Expand Down
Loading
Loading