Skip to content

Commit

Permalink
Merge pull request #1057 from IntersectMBO/fix/allure-deployment
Browse files Browse the repository at this point in the history
Fix/allure deployment
  • Loading branch information
NabinKawan authored May 21, 2024
2 parents ce10f42 + d361133 commit 495dda7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 50 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/test_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@ name: Backend Test

on:
push:
paths:
- .github/workflows/test_backend.yml
# - govtool/backend
# - tests/govtool-backend

schedule:
- cron: "0 0 * * *"
branches:
- test
workflow_dispatch:
inputs:
deployment:
required: true
type: choice
default: "staging.govtool.byron.network/api"
default: "govtool.cardanoapi.io/api"
options:
- "sanchogov.tools/api"
- "staging.govtool.byron.network/api"
- "govtool-sanchonet.cardanoapi.io/api"
- "govtool.cardanoapi.io/api"

jobs:
backend-tests:
Expand Down Expand Up @@ -70,7 +65,7 @@ jobs:
ref: gh-pages
path: gh-pages
repository: ${{vars.GH_PAGES}}
token: ${{secrets.PERSONAL_TOKEN}}
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Register report
id: register-project
Expand All @@ -81,7 +76,7 @@ jobs:
- if: steps.register-project.outputs.project_exists != 'true'
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: project
Expand Down Expand Up @@ -113,7 +108,7 @@ jobs:
- name: Deploy report to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.PERSONAL_TOKEN }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
repository-name: ${{vars.GH_PAGES}}
branch: gh-pages
folder: build
Expand Down
30 changes: 21 additions & 9 deletions .github/workflows/test_integration_playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@ name: Integration Test [Playwright]

on:
push:
paths:
- .github/workflows/test_integration_playwright.yml
branches:
- test
workflow_dispatch:
inputs:
deployment:
required: true
type: choice
default: "govtool.cardanoapi.io"
options:
- "sanchogov.tools"
- "staging.govtool.byron.network"
- "govtool.cardanoapi.io"

workflow_run:
workflows: ["Build and deploy GovTool test stack"]
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
Expand Down Expand Up @@ -50,18 +60,20 @@ jobs:
path: tests/govtool-frontend/playwright/allure-results

env:
FRONTEND_URL: ${{vars.HOST_URL}}
API_URL: ${{vars.HOST_URL}}/api
HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}
API_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}/api
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.TEST_WORKERS}}
TEST_WORKERS: ${{vars.TEST_WORKERS}}
CI: ${{vars.CI}}
CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}}

publish-report:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'push' }}
if: always()
needs: integration-tests
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -128,5 +140,5 @@ jobs:
target-folder: ${{ env.REPORT_NAME }}

env:
REPORT_NAME: integration
REPORT_NAME: govtool-frontend
GH_PAGES: ${{vars.GH_PAGES}}
2 changes: 1 addition & 1 deletion 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">
<meta http-equiv="refresh" content="0; url=/$allure_report_path/$REPORT_NAME/$REPORT_NUMBER#behaviors">
<title>Redirecting...</title>
</head>
</html>
Expand Down
8 changes: 4 additions & 4 deletions tests/govtool-frontend/playwright/lib/lockInterceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class LockInterceptor {
address: string,
lockId: string
): Promise<void> {
const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`);
const lockFilePath = path.resolve(__dirname, `../${address}`);

try {
await log(
Expand All @@ -42,7 +42,7 @@ export class LockInterceptor {
address: string,
lockId: string
): Promise<void> {
const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`);
const lockFilePath = path.resolve(__dirname, `../${address}`);

try {
await log(
Expand Down Expand Up @@ -147,7 +147,7 @@ export class LockInterceptor {
}

function checkAddressLock(address: string): boolean {
const lockFilePath = path.resolve(__dirname, `../.lock-pool/${address}`);
const lockFilePath = path.resolve(__dirname, `../${address}`);
return lockfile.checkSync(lockFilePath);
}

Expand All @@ -162,7 +162,7 @@ function log(message: string): Promise<void> {
hour12: false,
timeZone: "Asia/Kathmandu",
};
const logFilePath = path.resolve(__dirname, "../.logs/lock_logs.txt");
const logFilePath = path.resolve(__dirname, "../lock_logs.txt");
const logMessage = `[${new Date().toLocaleString("en-US", options)}] ${message}\n`;
return new Promise((resolve, reject) => {
fs.appendFile(logFilePath, logMessage, (err) => {
Expand Down
14 changes: 7 additions & 7 deletions tests/govtool-frontend/playwright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/govtool-frontend/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"format": "prettier . --write"
},
"dependencies": {
"@cardanoapi/cardano-test-wallet": "^1.1.1",
"@cardanoapi/cardano-test-wallet": "^1.1.2",
"@faker-js/faker": "^8.4.1",
"@noble/curves": "^1.3.0",
"@noble/ed25519": "^2.0.0",
Expand Down
16 changes: 0 additions & 16 deletions tests/govtool-frontend/playwright/tests/dRep.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { dRepWallets } from "@constants/staticWallets";
import { pollTransaction } from "@helpers/transaction";
import { expect, test as setup } from "@playwright/test";
import kuberService from "@services/kuberService";
import { Logger } from "../../cypress/lib/logger/logger";
import fetch = require("node-fetch");

const dRepInfo = require("../lib/_mock/dRepInfo.json");

setup.describe.configure({ timeout: environments.txTimeOut });

dRepWallets.forEach((wallet) => {
Expand All @@ -28,16 +25,3 @@ dRepWallets.forEach((wallet) => {
}
});
});

setup("Setup dRep metadata", async () => {
try {
const res = await fetch(`${environments.metadataBucketUrl}/Test_dRep`, {
method: "PUT",
body: JSON.stringify(dRepInfo),
});
Logger.success("Uploaded dRep metadata to bucket");
} catch (err) {
Logger.fail(`Failed to upload dRep metadata: ${err}`);
throw err;
}
});

0 comments on commit 495dda7

Please sign in to comment.