Skip to content
2 changes: 1 addition & 1 deletion .github/scripts/generate_latest_report_redirect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cat <<EOF > build/index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$REPORT_NAME/$REPORT_NUMBER#behaviors">
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$GROUP_NAME/$REPORT_NAME/$REPORT_NUMBER#behaviors">
<title>Redirecting...</title>
</head>
</html>
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/generate_report_details.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [[ ! -d "gh-pages/$REPORT_NAME" ]]; then
if [[ ! -d "gh-pages/$GROUP_NAME/$REPORT_NAME" ]]; then
latest_number=0
else
gh_pages_content=$(ls "gh-pages/$REPORT_NAME/")
gh_pages_content=$(ls "gh-pages/$GROUP_NAME/$REPORT_NAME/")
latest_number=$(echo "$gh_pages_content" | grep -Eo '[0-9]+' | sort -nr | head -n 1)
fi

echo "report_number=$((latest_number+1))" >> $GITHUB_OUTPUT
echo "report_url=https://$(dirname "$GH_PAGES").github.io/$(basename "$GH_PAGES")/$REPORT_NAME" >> $GITHUB_OUTPUT
echo "report_url=https://$(dirname "$GH_PAGES").github.io/$(basename "$GH_PAGES")/$GROUP_NAME/$REPORT_NAME" >> $GITHUB_OUTPUT

15 changes: 0 additions & 15 deletions .github/scripts/register_report.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .github/scripts/remove_oldest_report.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ -d "gh-pages/$REPORT_NAME" ]; then
cd gh-pages/$REPORT_NAME
if [ -d "gh-pages/$GROUP_NAME/$REPORT_NAME" ]; then
cd gh-pages/$GROUP_NAME/$REPORT_NAME

# Count the number of numerical directories
dir_count=$(find . -maxdepth 1 -type d -regex './[0-9]+' | wc -l)
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/set_commit_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ 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}" ;;
"IntersectMBO/govtool-test-reports") TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${GROUP_NAME}/${REPORT_NAME}/${REPORT_NUMBER}" ;;
"cardanoapi/govtool-test-reports") TARGET_URL="https://cardanoapi.github.io/govtool-test-reports/${GROUP_NAME}/${REPORT_NAME}/${REPORT_NUMBER}" ;;
*) TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${GROUP_NAME}/${REPORT_NAME}/${REPORT_NUMBER}" ;;
esac

# Determine test result message
Expand Down
19 changes: 19 additions & 0 deletions .github/scripts/set_deployment_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

DEPLOYMENT=${DEPLOYMENT:-"govtool.cardanoapi.io/api"}
GROUP_NAME="qa"

if [[ "$DEPLOYMENT" == "preview.gov.tools" || "$DEPLOYMENT" == "be.preview.gov.tools" || "$DEPLOYMENT" == "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr" ]]; then
GROUP_NAME="preview"
elif [[ "$DEPLOYMENT" == "gov.tools" || "$DEPLOYMENT" == "be.gov.tools" ]]; then
GROUP_NAME="mainnet"
elif [[ "$DEPLOYMENT" == "p80-z78acf3c2-zded6a792-gtw.z937eb260.rustrocks.fr" || "$DEPLOYMENT" == "z78acf3c2-z5575152b-gtw.z937eb260.rustrocks.fr" ]]; then
GROUP_NAME="dev"
else
GROUP_NAME="qa"
fi

# Set environment variable for GitHub Actions
echo "GROUP_NAME=${GROUP_NAME}" >>$GITHUB_ENV
echo "group_name=${GROUP_NAME}" >>$GITHUB_OUTPUT
echo "Setting deployment environment to: ${GROUP_NAME}"
32 changes: 13 additions & 19 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ on:
workflow_run:
workflows: ["Build and deploy GovTool test stack"]
types: [completed]
branches:
branches:
- test
- infra/test-chores

Expand All @@ -59,6 +59,7 @@ jobs:

- name: Set pending commit status
id: set-pending-status
if: ${{ !github.event.schedule }}
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
Expand Down Expand Up @@ -121,27 +122,18 @@ jobs:
repository: ${{vars.GH_PAGES}}
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Set Deployment Environment
id: set-deployment-url
run: |
chmod +x .github/scripts/set_deployment_environment.sh
.github/scripts/set_deployment_environment.sh

- name: Remove oldest report to save space
if: ${{success()}}
run: |
chmod +x .github/scripts/remove_oldest_report.sh
.github/scripts/remove_oldest_report.sh

- name: Register report
id: register-project
if: ${{success()}}
run: |
chmod +x .github/scripts/register_report.sh
.github/scripts/register_report.sh

- if: steps.register-project.outputs.project_exists != 'true'
uses: JamesIves/github-pages-deploy-action@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: project

- name: Generate report details
id: report-details
run: |
Expand All @@ -153,7 +145,7 @@ jobs:
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages/${{env.REPORT_NAME}}
gh_pages: gh-pages/${{steps.set-deployment-url.outputs.group_name}}/${{env.REPORT_NAME}}
allure_report: allure-report
allure_history: allure-history
keep_reports: 2000
Expand All @@ -172,7 +164,7 @@ jobs:
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: build
target-folder: ${{ env.REPORT_NAME }}
target-folder: ${{steps.set-deployment-url.outputs.group_name}}/${{ env.REPORT_NAME }}

publish-status:
runs-on: ubuntu-latest
Expand All @@ -185,8 +177,9 @@ jobs:
with:
name: allure-results
path: allure-results

- name: Set Commit Status
if: always()
if: always() && !github.event.schedule
run: |
chmod +x .github/scripts/set_commit_status.sh
.github/scripts/set_commit_status.sh
Expand All @@ -198,6 +191,7 @@ jobs:

env:
BASE_URL: https://${{github.event.schedule && 'be.preview.gov.tools' || inputs.deployment || 'govtool.cardanoapi.io/api' }}
DEPLOYMENT: ${{ inputs.deployment || 'govtool.cardanoapi.io/api'}}
REPORT_NAME: ${{ github.event.schedule && 'nightly-'}}govtool-backend
GH_PAGES: ${{vars.GH_PAGES}}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
31 changes: 12 additions & 19 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
with:
ref: ${{ env.COMMIT_SHA }}
- name: Set pending commit status
if: ${{ !github.event.schedule }}
id: set-pending-status
run: |
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -136,7 +137,7 @@ jobs:
FAUCET_ADDRESS: ${{vars.FAUCET_ADDRESS}}
CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}}
FAUCET_PAYMENT_PRIVATE: ${{secrets.FAUCET_PAYMENT_PRIVATE}}
FAUCET_STAKE_PKH: ${{secrets.FAUCET_STAKE_PKH}}
FAUCET_STAKE_PRIVATE: ${{secrets.FAUCET_STAKE_PRIVATE}}

publish-report:
runs-on: ubuntu-latest
Expand All @@ -161,27 +162,18 @@ jobs:
repository: ${{vars.GH_PAGES}}
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Set Deployment Environment
id: set-deployment-url
run: |
chmod +x .github/scripts/set_deployment_environment.sh
.github/scripts/set_deployment_environment.sh

- name: Remove oldest report to save space
if: ${{success()}}
run: |
chmod +x .github/scripts/remove_oldest_report.sh
.github/scripts/remove_oldest_report.sh

- name: Register report
id: register-project
if: ${{success()}}
run: |
chmod +x .github/scripts/register_report.sh
.github/scripts/register_report.sh

- if: steps.register-project.outputs.project_exists != 'true'
uses: JamesIves/github-pages-deploy-action@v4
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: project

- name: Generate report details
id: report-details
run: |
Expand All @@ -194,7 +186,7 @@ jobs:
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages/${{env.REPORT_NAME}}
gh_pages: gh-pages/${{steps.set-deployment-url.outputs.group_name}}/${{env.REPORT_NAME}}
allure_report: allure-report
allure_history: allure-history
keep_reports: 2000
Expand All @@ -213,7 +205,7 @@ jobs:
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: build
target-folder: ${{ env.REPORT_NAME }}
target-folder: ${{steps.set-deployment-url.outputs.group_name}}/${{ env.REPORT_NAME }}

publish-status:
runs-on: ubuntu-latest
Expand All @@ -226,8 +218,9 @@ jobs:
with:
name: allure-results
path: allure-results

- name: Set Commit Status
if: always()
if: always() && !github.event.schedule
run: |
chmod +x .github/scripts/set_commit_status.sh
.github/scripts/set_commit_status.sh
Expand Down
Loading