Skip to content

Commit 30094c7

Browse files
authored
Merge branch 'develop' into feat/wf-check-and-build-qa
Signed-off-by: Aaron B <[email protected]>
2 parents 8a62773 + bcaefd0 commit 30094c7

File tree

152 files changed

+3713
-16106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+3713
-16106
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.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
if [ -d "gh-pages/$GROUP_NAME/$REPORT_NAME" ]; then
4+
cd gh-pages/$GROUP_NAME/$REPORT_NAME
5+
6+
# Count the number of numerical directories
7+
dir_count=$(find . -maxdepth 1 -type d -regex './[0-9]+' | wc -l)
8+
9+
if [ "$dir_count" -gt 10 ]; then
10+
# Find the oldest numerical directory
11+
oldest_dir=$(find . -maxdepth 1 -type d -regex './[0-9]+' | sort -V | head -1)
12+
if [ -n "$oldest_dir" ]; then
13+
echo "More than 10 report directories exist. Removing oldest: $oldest_dir"
14+
rm -rf "$oldest_dir"
15+
fi
16+
else
17+
echo "Only $dir_count report directories exist (threshold: 10). Nothing to remove."
18+
fi
19+
20+
cd ../../
21+
else
22+
echo "Report directory does not exist yet"
23+
fi

.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: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- "sanchogov.tools/api"
1717
- "staging.govtool.byron.network/api"
1818
- "govtool.cardanoapi.io/api"
19+
- "be.preview.gov.tools"
1920
- "z6b8d2f7a-zca4a4c45-gtw.z937eb260.rustrocks.fr"
2021
- "z78acf3c2-z5575152b-gtw.z937eb260.rustrocks.fr"
2122
- "be.gov.tools"
@@ -28,21 +29,25 @@ on:
2829
- "preview"
2930
- "mainnet"
3031
- "preprod"
32+
3133
workflow_run:
3234
workflows: ["Build and deploy GovTool test stack"]
3335
types: [completed]
34-
branches:
36+
branches:
3537
- test
3638
- infra/test-chores
3739

40+
schedule:
41+
- cron: "0 0 * * *" # 12AM UTC
42+
3843
concurrency:
3944
group: ${{ github.workflow }}-${{ github.ref }}
4045
cancel-in-progress: false
4146

4247
jobs:
4348
backend-tests:
4449
runs-on: ubuntu-latest
45-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
50+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' || github.event.schedule }}
4651
outputs:
4752
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
4853
status: ${{ steps.run-tests.outcome }}
@@ -54,6 +59,7 @@ jobs:
5459

5560
- name: Set pending commit status
5661
id: set-pending-status
62+
if: ${{ !github.event.schedule }}
5763
run: |
5864
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
5965
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
@@ -99,6 +105,7 @@ jobs:
99105
needs: backend-tests
100106
outputs:
101107
report_number: ${{ steps.report-details.outputs.report_number }}
108+
group_name: ${{ steps.set-deployment-url.outputs.group_name }}
102109
steps:
103110
- uses: actions/checkout@v4
104111
- name: Download results
@@ -116,19 +123,17 @@ jobs:
116123
repository: ${{vars.GH_PAGES}}
117124
ssh-key: ${{ secrets.DEPLOY_KEY }}
118125

119-
- name: Register report
120-
id: register-project
126+
- name: Set Deployment Environment
127+
id: set-deployment-url
128+
run: |
129+
chmod +x .github/scripts/set_deployment_environment.sh
130+
.github/scripts/set_deployment_environment.sh
131+
132+
- name: Remove oldest report to save space
121133
if: ${{success()}}
122134
run: |
123-
chmod +x .github/scripts/register_report.sh
124-
.github/scripts/register_report.sh
125-
- if: steps.register-project.outputs.project_exists != 'true'
126-
uses: JamesIves/github-pages-deploy-action@v4
127-
with:
128-
ssh-key: ${{ secrets.DEPLOY_KEY }}
129-
repository-name: ${{vars.GH_PAGES}}
130-
branch: gh-pages
131-
folder: project
135+
chmod +x .github/scripts/remove_oldest_report.sh
136+
.github/scripts/remove_oldest_report.sh
132137
133138
- name: Generate report details
134139
id: report-details
@@ -141,7 +146,7 @@ jobs:
141146
id: allure-report
142147
with:
143148
allure_results: allure-results
144-
gh_pages: gh-pages/${{env.REPORT_NAME}}
149+
gh_pages: gh-pages/${{steps.set-deployment-url.outputs.group_name}}/${{env.REPORT_NAME}}
145150
allure_report: allure-report
146151
allure_history: allure-history
147152
keep_reports: 2000
@@ -160,7 +165,7 @@ jobs:
160165
repository-name: ${{vars.GH_PAGES}}
161166
branch: gh-pages
162167
folder: build
163-
target-folder: ${{ env.REPORT_NAME }}
168+
target-folder: ${{steps.set-deployment-url.outputs.group_name}}/${{ env.REPORT_NAME }}
164169

165170
publish-status:
166171
runs-on: ubuntu-latest
@@ -173,8 +178,9 @@ jobs:
173178
with:
174179
name: allure-results
175180
path: allure-results
181+
176182
- name: Set Commit Status
177-
if: always()
183+
if: always() && !github.event.schedule
178184
run: |
179185
chmod +x .github/scripts/set_commit_status.sh
180186
.github/scripts/set_commit_status.sh
@@ -183,9 +189,11 @@ jobs:
183189
TEST_STATUS: ${{ needs.backend-tests.outputs.status }}
184190
REPORT_NUMBER: ${{ needs.publish-report.outputs.report_number }}
185191
GITHUB_TOKEN: ${{ github.token }}
192+
GROUP_NAME: ${{ needs.publish-report.outputs.group_name }}
186193

187194
env:
188-
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
189-
REPORT_NAME: govtool-backend
195+
BASE_URL: https://${{github.event.schedule && 'be.preview.gov.tools' || inputs.deployment || 'govtool.cardanoapi.io/api' }}
196+
DEPLOYMENT: ${{ github.event.schedule && 'be.preview.gov.tools' || inputs.deployment || 'govtool.cardanoapi.io/api'}}
197+
REPORT_NAME: ${{ github.event.schedule && 'nightly-'}}govtool-backend
190198
GH_PAGES: ${{vars.GH_PAGES}}
191199
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

.github/workflows/test_integration_playwright.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,21 @@ on:
3333
workflow_run:
3434
workflows: ["Check and Build QA"]
3535
types: [completed]
36-
branches:
36+
branches:
3737
- test
3838
- infra/test-chores
3939

40+
schedule:
41+
- cron: "0 0 * * *" # 12AM UTC
42+
4043
concurrency:
4144
group: ${{ github.workflow }}-${{ github.ref }}
4245
cancel-in-progress: false
4346

4447
jobs:
4548
integration-tests:
4649
runs-on: ubuntu-latest
47-
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
50+
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' || github.event.schedule }}
4851
outputs:
4952
start_time: ${{ steps.set-pending-status.outputs.timestamp }}
5053
status: ${{ steps.run-test.outcome }}
@@ -56,6 +59,7 @@ jobs:
5659
with:
5760
ref: ${{ env.COMMIT_SHA }}
5861
- name: Set pending commit status
62+
if: ${{ !github.event.schedule }}
5963
id: set-pending-status
6064
run: |
6165
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
@@ -106,6 +110,11 @@ jobs:
106110
export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_MAINNET }}"
107111
fi
108112
113+
# Set schedule workflow variable
114+
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
115+
export SCHEDULED_WORKFLOW="true"
116+
fi
117+
109118
npm run test:headless
110119
111120
- name: Upload report
@@ -131,14 +140,15 @@ jobs:
131140
FAUCET_ADDRESS: ${{vars.FAUCET_ADDRESS}}
132141
CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}}
133142
FAUCET_PAYMENT_PRIVATE: ${{secrets.FAUCET_PAYMENT_PRIVATE}}
134-
FAUCET_STAKE_PKH: ${{secrets.FAUCET_STAKE_PKH}}
143+
FAUCET_STAKE_PRIVATE: ${{secrets.FAUCET_STAKE_PRIVATE}}
135144

136145
publish-report:
137146
runs-on: ubuntu-latest
138147
if: always() && needs.integration-tests.result != 'skipped'
139148
needs: integration-tests
140149
outputs:
141150
report_number: ${{ steps.report-details.outputs.report_number }}
151+
group_name: ${{ steps.set-deployment-url.outputs.group_name }}
142152
steps:
143153
- uses: actions/checkout@v4
144154
- name: Download report
@@ -156,19 +166,17 @@ jobs:
156166
repository: ${{vars.GH_PAGES}}
157167
ssh-key: ${{ secrets.DEPLOY_KEY }}
158168

159-
- name: Register report
160-
id: register-project
169+
- name: Set Deployment Environment
170+
id: set-deployment-url
171+
run: |
172+
chmod +x .github/scripts/set_deployment_environment.sh
173+
.github/scripts/set_deployment_environment.sh
174+
175+
- name: Remove oldest report to save space
161176
if: ${{success()}}
162177
run: |
163-
chmod +x .github/scripts/register_report.sh
164-
.github/scripts/register_report.sh
165-
- if: steps.register-project.outputs.project_exists != 'true'
166-
uses: JamesIves/github-pages-deploy-action@v4
167-
with:
168-
ssh-key: ${{ secrets.DEPLOY_KEY }}
169-
repository-name: ${{vars.GH_PAGES}}
170-
branch: gh-pages
171-
folder: project
178+
chmod +x .github/scripts/remove_oldest_report.sh
179+
.github/scripts/remove_oldest_report.sh
172180
173181
- name: Generate report details
174182
id: report-details
@@ -182,7 +190,7 @@ jobs:
182190
id: allure-report
183191
with:
184192
allure_results: allure-results
185-
gh_pages: gh-pages/${{env.REPORT_NAME}}
193+
gh_pages: gh-pages/${{steps.set-deployment-url.outputs.group_name}}/${{env.REPORT_NAME}}
186194
allure_report: allure-report
187195
allure_history: allure-history
188196
keep_reports: 2000
@@ -201,7 +209,7 @@ jobs:
201209
repository-name: ${{vars.GH_PAGES}}
202210
branch: gh-pages
203211
folder: build
204-
target-folder: ${{ env.REPORT_NAME }}
212+
target-folder: ${{steps.set-deployment-url.outputs.group_name}}/${{ env.REPORT_NAME }}
205213

206214
publish-status:
207215
runs-on: ubuntu-latest
@@ -214,8 +222,9 @@ jobs:
214222
with:
215223
name: allure-results
216224
path: allure-results
225+
217226
- name: Set Commit Status
218-
if: always()
227+
if: always() && !github.event.schedule
219228
run: |
220229
chmod +x .github/scripts/set_commit_status.sh
221230
.github/scripts/set_commit_status.sh
@@ -224,8 +233,10 @@ jobs:
224233
TEST_STATUS: ${{ needs.integration-tests.outputs.status }}
225234
REPORT_NUMBER: ${{ needs.publish-report.outputs.report_number }}
226235
GITHUB_TOKEN: ${{ github.token }}
236+
GROUP_NAME: ${{ needs.publish-report.outputs.group_name }}
227237
env:
228-
HOST_URL: https://${{inputs.deployment || 'p80-z6b8d2f7a-ze34e4cb2-gtw.z937eb260.rustrocks.fr' }}
229-
REPORT_NAME: govtool-frontend
238+
HOST_URL: https://${{ github.event.schedule && 'preview.gov.tools' || (inputs.deployment || 'p80-z6b8d2f7a-ze34e4cb2-gtw.z937eb260.rustrocks.fr') }}
239+
DEPLOYMENT: ${{ github.event.schedule && 'preview.gov.tools' || inputs.deployment || 'p80-z6b8d2f7a-ze34e4cb2-gtw.z937eb260.rustrocks.fr'}}
240+
REPORT_NAME: ${{ github.event.schedule && 'nightly-'}}govtool-frontend
230241
GH_PAGES: ${{vars.GH_PAGES}}
231242
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

0 commit comments

Comments
 (0)