Skip to content

Commit

Permalink
Merge pull request #873 from IntersectMBO/test
Browse files Browse the repository at this point in the history
DRep explorer, Critical displaying fixes and recent design changes and enhancements, recent GH action updates
  • Loading branch information
pmbinapps authored Apr 25, 2024
2 parents 4e0ebe1 + 57c56d9 commit 19129db
Show file tree
Hide file tree
Showing 277 changed files with 11,966 additions and 7,240 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }}
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }}
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }}
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
IP_ADDRESS_BYPASSING_BASIC_AUTH1: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH1 }}
IP_ADDRESS_BYPASSING_BASIC_AUTH2: ${{ secrets.IP_ADDRESS_BYPASSING_BASIC_AUTH2 }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ jobs:
- name: Run build and lighthouse task
working-directory: ./govtool/frontend
run: |
npm install
VITE_BASE_URL=https://staging.govtool.byron.network/api npm run build
lhci collect
npm install
VITE_BASE_URL=https://staging.govtool.byron.network/ npm run build
lhci collect
- name: Evaluate reports
if: github.repository_owner != 'IntersectMBO'
run: |
lhci assert --preset "lighthouse:recommended"
lhci assert --preset "lighthouse:recommended"
- name: Publish reports
working-directory: ./govtool/frontend
if: github.repository_owner == 'IntersectMBO'
run: |
lhci assert --preset lighthouse:recommended || echo "LightHouse Assertion error ignored ..."
lhci upload --githubAppToken="${{ secrets.LHCI_GITHUB_APP_TOKEN }}" --token="${{ secrets.LHCI_SERVER_TOKEN }}" --serverBaseUrl=https://lighthouse.cardanoapi.io --ignoreDuplicateBuildFailure
curl -X POST https://ligththouse.cardanoapi.io/api/metrics/build-reports \
-d "@./lighthouseci/$(ls ./.lighthouseci |grep 'lhr.*\.json' | head -n 1)" \
-H "commit-hash: $(git rev-parse HEAD)" \
-H "secret-token: ${{ secrets.METRICS_SERVER_SECRET_TOKEN }}" \
-H 'Content-Type: application/json' || echo "Metric Upload error ignored ..."
lhci assert --preset lighthouse:recommended || echo "LightHouse Assertion error ignored ..."
lhci upload --githubAppToken="${{ secrets.LHCI_GITHUB_APP_TOKEN }}" --token="${{ secrets.LHCI_SERVER_TOKEN }}" --serverBaseUrl=https://lighthouse.cardanoapi.io --ignoreDuplicateBuildFailure
curl -X POST https://ligththouse.cardanoapi.io/api/metrics/build-reports \
-d "@./lighthouseci/$(ls ./.lighthouseci |grep 'lhr.*\.json' | head -n 1)" \
-H "commit-hash: $(git rev-parse HEAD)" \
-H "secret-token: ${{ secrets.METRICS_SERVER_SECRET_TOKEN }}" \
-H 'Content-Type: application/json' || echo "Metric Upload error ignored ..."
127 changes: 101 additions & 26 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Backend Test
on:
push:
paths:
- .github/workflows/test_backend.yml
- .github/workflows/test_backend.yml
# - govtool/backend
# - tests/govtool-backend

schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
deployment:
Expand All @@ -21,29 +21,104 @@ on:
- "govtool-sanchonet.cardanoapi.io/api"

jobs:
build:
backend-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.4
cache: 'pip'

- name: Run Backend Test
working-directory: tests/govtool-backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pytest -v --github-report
env:
BASE_URL: https://${{inputs.deployment || 'staging.govtool.byron.network/api' }}
METRICS_URL: https://metrics.cardanoapi.io
METRICS_API_SECRET: "${{ secrets.METRICS_SERVER_SECRET_TOKEN }}"

# - uses: schemathesis/action@v1
# with:
# schema: "http://localhost:8080/swagger.json"
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.4
cache: "pip"

- name: Run Backend Test
working-directory: tests/govtool-backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python -m pytest --alluredir allure-results
env:
BASE_URL: https://${{inputs.deployment || 'staging.govtool.byron.network/api' }}
METRICS_URL: https://metrics.cardanoapi.io
METRICS_API_SECRET: "${{ secrets.METRICS_SERVER_SECRET_TOKEN }}"

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

publish-report:
runs-on: ubuntu-latest
if: always()
needs: backend-tests
steps:
- uses: actions/checkout@v4
- name: Download results
uses: actions/download-artifact@v3
with:
name: allure-results
path: allure-results

- name: Get Allure history
uses: actions/checkout@v4
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
repository: ${{vars.GH_PAGES}}
token: ${{secrets.PERSONAL_TOKEN}}

- name: Register report
id: register-project
if: ${{success()}}
run: |
chmod +x ./register_report.sh
./register_report.sh
- if: steps.register-project.outputs.project_exists != 'true'
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: project

- name: Generate report details
id: report-details
run: |
chmod +x ./generate_report_details.sh
./generate_report_details.sh
- name: Build report
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages/${{env.REPORT_NAME}}
allure_report: allure-report
allure_history: allure-history
keep_reports: 2000
report_url: ${{steps.report-details.outputs.report_url}}
github_run_num: ${{steps.report-details.outputs.report_number}}

- name: Generate Latest Report
run: |
chmod +x ./generate_latest_report_redirect.sh
./generate_latest_report_redirect.sh ${{steps.report-details.outputs.report_number}}
- name: Deploy report to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: build
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: backend
GH_PAGES: ${{vars.GH_PAGES}}
132 changes: 132 additions & 0 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Integration Test [Playwright]

on:
push:
paths:
- .github/workflows/test_integration_playwright.yml
workflow_run:
workflows: ["Build and deploy GovTool to TEST server"]
types: [completed]

jobs:
integration-tests:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' }}
defaults:
run:
working-directory: tests/govtool-frontend/playwright
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: "./tests/govtool-frontend/playwright/package-lock.json"

- name: Install dependencies
run: npm ci

- name: Cache Playwright browsers
id: cache-playwright-browsers
uses: actions/cache@v3
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-browsers

- name: Install Playwright browsers if not cached
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: npx playwright install --with-deps

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

env:
FRONTEND_URL: ${{vars.FRONTEND_URL}}
API_URL: ${{vars.API_URL}}
DOCS_URL: ${{ vars.DOCS_URL }}
FAUCET_API_URL: ${{ vars.FAUCET_API_URL }}
FAUCET_API_KEY: ${{secrets.FAUCET_API_KEY}}
KUBER_API_URL: ${{vars.KUBER_API_URL}}
KUBER_API_KEY: ${{secrets.KUBER_API_KEY}}
WORKERS: ${{vars.WORKERS}}

publish-report:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' }}
needs: integration-tests
steps:
- uses: actions/checkout@v4
- name: Download report
uses: actions/download-artifact@v3
with:
name: allure-results
path: allure-results

- name: Get Allure history
uses: actions/checkout@v4
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
repository: ${{vars.GH_PAGES}}
token: ${{ secrets.PERSONAL_TOKEN }}

- name: Register report
id: register-project
if: ${{success()}}
run: |
chmod +x ./register_report.sh
./register_report.sh
- if: steps.register-project.outputs.project_exists != 'true'
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: project

- name: Generate report details
id: report-details
run: |
chmod +x ./generate_report_details.sh
./generate_report_details.sh
- name: Build report
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages/${{env.REPORT_NAME}}
allure_report: allure-report
allure_history: allure-history
keep_reports: 2000
report_url: ${{steps.report-details.outputs.report_url}}
github_run_num: ${{steps.report-details.outputs.report_number}}

- name: Generate Latest Report
run: |
chmod +x ./generate_latest_report_redirect.sh
./generate_latest_report_redirect.sh ${{steps.report-details.outputs.report_number}}
- name: Deploy report to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: build
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: integration
GH_PAGES: ${{vars.GH_PAGES}}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,7 @@ infra/terraform/.terraform*
scripts/govtool/dev-postgres_db
scripts/govtool/dev-postgres_user
scripts/govtool/dev-postgres_password

# nodejs/yarn

node_modules
Loading

0 comments on commit 19129db

Please sign in to comment.