Skip to content

Commit 4a0566e

Browse files
authored
Merge pull request #3658 from IntersectMBO/refactor/report-workflow
Refactor: report workflow to support new grouping UI
2 parents 49b6256 + bc96e67 commit 4a0566e

File tree

8 files changed

+53
-62
lines changed

8 files changed

+53
-62
lines changed

.github/scripts/generate_latest_report_redirect.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cat <<EOF > build/index.html
1111
<html lang="en">
1212
<head>
1313
<meta charset="UTF-8">
14-
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$REPORT_NAME/$REPORT_NUMBER#behaviors">
14+
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$GROUP_NAME/$REPORT_NAME/$REPORT_NUMBER#behaviors">
1515
<title>Redirecting...</title>
1616
</head>
1717
</html>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22

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

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

.github/scripts/register_report.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/scripts/remove_oldest_report.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
if [ -d "gh-pages/$REPORT_NAME" ]; then
4-
cd gh-pages/$REPORT_NAME
3+
if [ -d "gh-pages/$GROUP_NAME/$REPORT_NAME" ]; then
4+
cd gh-pages/$GROUP_NAME/$REPORT_NAME
55

66
# Count the number of numerical directories
77
dir_count=$(find . -maxdepth 1 -type d -regex './[0-9]+' | wc -l)

.github/scripts/set_commit_status.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ fi
4848

4949
# Determine target URL based on environment
5050
case "$GH_PAGES" in
51-
"IntersectMBO/govtool-test-reports") TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${REPORT_NAME}/${REPORT_NUMBER}" ;;
52-
"cardanoapi/govtool-test-reports") TARGET_URL="https://cardanoapi.github.io/govtool-test-reports/${REPORT_NAME}/${REPORT_NUMBER}" ;;
53-
*) TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${REPORT_NAME}/${REPORT_NUMBER}" ;;
51+
"IntersectMBO/govtool-test-reports") TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${GROUP_NAME}/${REPORT_NAME}/${REPORT_NUMBER}" ;;
52+
"cardanoapi/govtool-test-reports") TARGET_URL="https://cardanoapi.github.io/govtool-test-reports/${GROUP_NAME}/${REPORT_NAME}/${REPORT_NUMBER}" ;;
53+
*) TARGET_URL="https://intersectmbo.github.io/govtool-test-reports/${GROUP_NAME}/${REPORT_NAME}/${REPORT_NUMBER}" ;;
5454
esac
5555

5656
# Determine test result message
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
DEPLOYMENT=${DEPLOYMENT:-"govtool.cardanoapi.io/api"}
4+
GROUP_NAME="qa"
5+
6+
if [[ "$DEPLOYMENT" == "preview.gov.tools" || "$DEPLOYMENT" == "be.preview.gov.tools" || "$DEPLOYMENT" == "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr" ]]; then
7+
GROUP_NAME="preview"
8+
elif [[ "$DEPLOYMENT" == "gov.tools" || "$DEPLOYMENT" == "be.gov.tools" ]]; then
9+
GROUP_NAME="mainnet"
10+
elif [[ "$DEPLOYMENT" == "p80-z78acf3c2-zded6a792-gtw.z937eb260.rustrocks.fr" || "$DEPLOYMENT" == "z78acf3c2-z5575152b-gtw.z937eb260.rustrocks.fr" ]]; then
11+
GROUP_NAME="dev"
12+
else
13+
GROUP_NAME="qa"
14+
fi
15+
16+
# Set environment variable for GitHub Actions
17+
echo "GROUP_NAME=${GROUP_NAME}" >>$GITHUB_ENV
18+
echo "group_name=${GROUP_NAME}" >>$GITHUB_OUTPUT
19+
echo "Setting deployment environment to: ${GROUP_NAME}"

.github/workflows/test_backend.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
workflow_run:
3434
workflows: ["Build and deploy GovTool test stack"]
3535
types: [completed]
36-
branches:
36+
branches:
3737
- test
3838
- infra/test-chores
3939

@@ -59,6 +59,7 @@ jobs:
5959

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

125+
- name: Set Deployment Environment
126+
id: set-deployment-url
127+
run: |
128+
chmod +x .github/scripts/set_deployment_environment.sh
129+
.github/scripts/set_deployment_environment.sh
130+
124131
- name: Remove oldest report to save space
125132
if: ${{success()}}
126133
run: |
127134
chmod +x .github/scripts/remove_oldest_report.sh
128135
.github/scripts/remove_oldest_report.sh
129136
130-
- name: Register report
131-
id: register-project
132-
if: ${{success()}}
133-
run: |
134-
chmod +x .github/scripts/register_report.sh
135-
.github/scripts/register_report.sh
136-
137-
- if: steps.register-project.outputs.project_exists != 'true'
138-
uses: JamesIves/github-pages-deploy-action@v4
139-
with:
140-
ssh-key: ${{ secrets.DEPLOY_KEY }}
141-
repository-name: ${{vars.GH_PAGES}}
142-
branch: gh-pages
143-
folder: project
144-
145137
- name: Generate report details
146138
id: report-details
147139
run: |
@@ -153,7 +145,7 @@ jobs:
153145
id: allure-report
154146
with:
155147
allure_results: allure-results
156-
gh_pages: gh-pages/${{env.REPORT_NAME}}
148+
gh_pages: gh-pages/${{steps.set-deployment-url.outputs.group_name}}/${{env.REPORT_NAME}}
157149
allure_report: allure-report
158150
allure_history: allure-history
159151
keep_reports: 2000
@@ -172,7 +164,7 @@ jobs:
172164
repository-name: ${{vars.GH_PAGES}}
173165
branch: gh-pages
174166
folder: build
175-
target-folder: ${{ env.REPORT_NAME }}
167+
target-folder: ${{steps.set-deployment-url.outputs.group_name}}/${{ env.REPORT_NAME }}
176168

177169
publish-status:
178170
runs-on: ubuntu-latest
@@ -185,8 +177,9 @@ jobs:
185177
with:
186178
name: allure-results
187179
path: allure-results
180+
188181
- name: Set Commit Status
189-
if: always()
182+
if: always() && !github.event.schedule
190183
run: |
191184
chmod +x .github/scripts/set_commit_status.sh
192185
.github/scripts/set_commit_status.sh
@@ -198,6 +191,7 @@ jobs:
198191

199192
env:
200193
BASE_URL: https://${{github.event.schedule && 'be.preview.gov.tools' || inputs.deployment || 'govtool.cardanoapi.io/api' }}
194+
DEPLOYMENT: ${{ inputs.deployment || 'govtool.cardanoapi.io/api'}}
201195
REPORT_NAME: ${{ github.event.schedule && 'nightly-'}}govtool-backend
202196
GH_PAGES: ${{vars.GH_PAGES}}
203197
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

.github/workflows/test_integration_playwright.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
with:
6060
ref: ${{ env.COMMIT_SHA }}
6161
- name: Set pending commit status
62+
if: ${{ !github.event.schedule }}
6263
id: set-pending-status
6364
run: |
6465
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
@@ -136,7 +137,7 @@ jobs:
136137
FAUCET_ADDRESS: ${{vars.FAUCET_ADDRESS}}
137138
CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}}
138139
FAUCET_PAYMENT_PRIVATE: ${{secrets.FAUCET_PAYMENT_PRIVATE}}
139-
FAUCET_STAKE_PKH: ${{secrets.FAUCET_STAKE_PKH}}
140+
FAUCET_STAKE_PRIVATE: ${{secrets.FAUCET_STAKE_PRIVATE}}
140141

141142
publish-report:
142143
runs-on: ubuntu-latest
@@ -161,27 +162,18 @@ jobs:
161162
repository: ${{vars.GH_PAGES}}
162163
ssh-key: ${{ secrets.DEPLOY_KEY }}
163164

165+
- name: Set Deployment Environment
166+
id: set-deployment-url
167+
run: |
168+
chmod +x .github/scripts/set_deployment_environment.sh
169+
.github/scripts/set_deployment_environment.sh
170+
164171
- name: Remove oldest report to save space
165172
if: ${{success()}}
166173
run: |
167174
chmod +x .github/scripts/remove_oldest_report.sh
168175
.github/scripts/remove_oldest_report.sh
169176
170-
- name: Register report
171-
id: register-project
172-
if: ${{success()}}
173-
run: |
174-
chmod +x .github/scripts/register_report.sh
175-
.github/scripts/register_report.sh
176-
177-
- if: steps.register-project.outputs.project_exists != 'true'
178-
uses: JamesIves/github-pages-deploy-action@v4
179-
with:
180-
ssh-key: ${{ secrets.DEPLOY_KEY }}
181-
repository-name: ${{vars.GH_PAGES}}
182-
branch: gh-pages
183-
folder: project
184-
185177
- name: Generate report details
186178
id: report-details
187179
run: |
@@ -194,7 +186,7 @@ jobs:
194186
id: allure-report
195187
with:
196188
allure_results: allure-results
197-
gh_pages: gh-pages/${{env.REPORT_NAME}}
189+
gh_pages: gh-pages/${{steps.set-deployment-url.outputs.group_name}}/${{env.REPORT_NAME}}
198190
allure_report: allure-report
199191
allure_history: allure-history
200192
keep_reports: 2000
@@ -213,7 +205,7 @@ jobs:
213205
repository-name: ${{vars.GH_PAGES}}
214206
branch: gh-pages
215207
folder: build
216-
target-folder: ${{ env.REPORT_NAME }}
208+
target-folder: ${{steps.set-deployment-url.outputs.group_name}}/${{ env.REPORT_NAME }}
217209

218210
publish-status:
219211
runs-on: ubuntu-latest
@@ -226,8 +218,9 @@ jobs:
226218
with:
227219
name: allure-results
228220
path: allure-results
221+
229222
- name: Set Commit Status
230-
if: always()
223+
if: always() && !github.event.schedule
231224
run: |
232225
chmod +x .github/scripts/set_commit_status.sh
233226
.github/scripts/set_commit_status.sh

0 commit comments

Comments
 (0)