Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add force rebuild images toggle to github actions #1344

Merged
merged 57 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
faa4928
WIP Update stress tests
mesudip May 24, 2024
f69a78d
Fetch Drep and Proposal Ids for seeding
mesudip Jun 3, 2024
4aa67f8
Setup deployment for storybook
NabinKawan Jun 17, 2024
d1bdf06
Fix Storybook deployment setup
mesudip Jun 19, 2024
789a330
Configure Google tag manager in test stack
mesudip Jun 19, 2024
6d82a29
Fix SonarQube analysis
mesudip Jun 19, 2024
e13cb49
Workflow: Configure registry url and scope
mesudip Jun 19, 2024
7fcac21
Increase heap size for test run
mesudip Jun 19, 2024
3b09d37
Run SonarQube scan on test failure
mesudip Jun 19, 2024
5436aea
Merge pull request #1336 from IntersectMBO/fixes/test-stack-gtm
mesudip Jun 19, 2024
aeda2cd
Update sentry DNS variable in test stack
mesudip Jun 19, 2024
98de2a2
Merge pull request #1339 from IntersectMBO/chore/update-sentry-dns
mesudip Jun 19, 2024
0b41db6
Merge pull request #1338 from IntersectMBO/fix/sonarqube-analysis
mesudip Jun 19, 2024
b6d611c
Add placement constraint on storybook service
mesudip Jun 19, 2024
85d2f28
Merge pull request #1316 from IntersectMBO/feat/deploy-storybook
mesudip Jun 19, 2024
3dd1b06
Make user-scenarios on stress-test readable
mesudip Jun 19, 2024
f37bf63
feat: Proposal services to create,delete proposal and add poll on pro…
kneerose Jun 12, 2024
9b04367
feat: Add proposal setup and teardown
kneerose Jun 12, 2024
b489f6e
chore: Add proposal discussion and its details page
kneerose Jun 12, 2024
41a2091
chore: Add fixture of proposal discussion details page
kneerose Jun 12, 2024
c11724f
test: proposal discussion forum [WIP]
kneerose Jun 12, 2024
46e796e
chore: Make types first character capital
kneerose Jun 13, 2024
64fc37c
feat: Add proposal comment service and use it on temporary proposal c…
kneerose Jun 13, 2024
fc16116
chore: Add helper for create file
NabinKawan Jun 13, 2024
d0031e9
chore: Refactor proposal-setup to create static proposals
NabinKawan Jun 13, 2024
e04b7fa
test: Share proposed governance action and proposal discussions acces…
NabinKawan Jun 13, 2024
4a5115f
chore: Refactor proposal discussion service and creation flow
NabinKawan Jun 13, 2024
779f5a6
test: Poll voting and Proposal creation restriction
NabinKawan Jun 13, 2024
68ef3aa
chore: Remove proposal manager
kneerose Jun 13, 2024
19dfcd6
test: Sort comment and disable poll voting
kneerose Jun 13, 2024
dec2a08
fix: Base file path of mock
kneerose Jun 13, 2024
e67caf0
test: Set username
kneerose Jun 13, 2024
d546c00
chore: Add mulple proposal deletion
kneerose Jun 13, 2024
b891e62
test: Comment and reply anonymously
kneerose Jun 13, 2024
bcebe1b
chore: Setup proposal wallet
NabinKawan Jun 14, 2024
1e92c89
tempFix: Slow page loading by changing test timeout to 90 sec
NabinKawan Jun 14, 2024
c4f286a
chore: Setup/Teardown proposal using ui approach
NabinKawan Jun 14, 2024
4c5116a
test: comment and reply proposal
NabinKawan Jun 14, 2024
e7336b9
chore: Enhance fixture proposalDiscussionDetailsPage to proposal
NabinKawan Jun 14, 2024
2e3988a
tempFix: Reload after sanchonet info on login
NabinKawan Jun 14, 2024
db2dd90
test: Update anonymous username to set username in comments
NabinKawan Jun 14, 2024
140b527
chore: Mock proposal, poll for visibility testing
NabinKawan Jun 14, 2024
17ac9cc
chore: Add pollEnabled option on proposal fixture
kneerose Jun 14, 2024
42ce3c3
test: Vote and change vote functionality in proposal poll
kneerose Jun 14, 2024
815d712
test: Add and cancel poll
kneerose Jun 14, 2024
fc038b2
chore: Remove proposal teardown and setup
kneerose Jun 14, 2024
58ab129
fix: Search gov action list
kneerose Jun 14, 2024
655770e
fix: test poll proposal
NabinKawan Jun 14, 2024
2ca0cc4
chore: Refactor test username
NabinKawan Jun 14, 2024
dd464db
test: Comments visibility
NabinKawan Jun 14, 2024
4255fa3
chore: Remove unused proposal discussion services
NabinKawan Jun 19, 2024
1b147e0
chore: Fix typo in test title (6F)
NabinKawan Jun 19, 2024
d95d625
Merge pull request #1301 from IntersectMBO/feat/pdf-tests
NabinKawan Jun 19, 2024
8c337e6
Merge pull request #1149 from IntersectMBO/chore/update-stress-tests
mesudip Jun 19, 2024
4b95ff3
chore: add force rebuild images toggle to github actions
MSzalowski Jun 19, 2024
8bb1b0b
Merge pull request #1342 from IntersectMBO/chore/add-force-rebuild-im…
MSzalowski Jun 19, 2024
0b5a5ee
Merge pull request #1343 from IntersectMBO/develop
MSzalowski Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/build-and-deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ on:
options:
- "enabled"
- "disabled"
forceRebuildDockerImages:
description: "Force rebuild the docker images"
required: false
type: choice
default: "false"
options:
- "true"
- "false"

env:
ENVIRONMENT: "beta"
CARDANO_NETWORK: "sanchonet"
DOMAIN: "sanchogov.tools"
FORCE_REBUILD: ${{inputs.forceRebuildDockerImages == 'true'}}

jobs:
deploy:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ on:
options:
- "enabled"
- "disabled"
forceRebuildDockerImages:
description: "Force rebuild the docker images"
required: false
type: choice
default: "false"
options:
- "true"
- "false"

env:
ENVIRONMENT: "dev"
CARDANO_NETWORK: "sanchonet"
DOMAIN: "dev-sanchonet.govtool.byron.network"
FORCE_REBUILD: ${{inputs.forceRebuildDockerImages == 'true'}}

jobs:
deploy:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@ on:
options:
- "enabled"
- "disabled"
forceRebuildDockerImages:
description: "Force rebuild the docker images"
required: false
type: choice
default: "false"
options:
- "true"
- "false"

env:
ENVIRONMENT: "staging"
CARDANO_NETWORK: "sanchonet"
DOMAIN: "staging.govtool.byron.network"
FORCE_REBUILD: ${{inputs.forceRebuildDockerImages == 'true'}}

jobs:
deploy:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-and-deploy-test-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
SENTRY_DSN_BACKEND: ${{ secrets.SENTRY_DSN_BACKEND }}
GTM_ID: ${{ secrets.GTM_ID }}
NPMRC_TOKEN: ${{ secrets.NPMRC_TOKEN }}
SENTRY_DSN_FRONTEND: ${{ secrets.INTERSECT_SENTRY_DSN_FRONTEND }}
SENTRY_DSN_FRONTEND: ${{ secrets.SENTRY_DSN_FRONTEND }}
PIPELINE_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
USERSNAP_SPACE_API_KEY: ${{ secrets.USERSNAP_SPACE_API_KEY }}
APP_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@ on:
options:
- "enabled"
- "disabled"
forceRebuildDockerImages:
description: "Force rebuild the docker images"
required: false
type: choice
default: "false"
options:
- "true"
- "false"

env:
ENVIRONMENT: "test"
CARDANO_NETWORK: "sanchonet"
DOMAIN: "test-sanchonet.govtool.byron.network"
FORCE_REBUILD: ${{inputs.forceRebuildDockerImages == 'true'}}

jobs:
deploy:
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/frontend_sonar_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,19 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: "govtool/frontend/.nvmrc"

registry-url: "https://registry.npmjs.org/"
scope: "@intersect.mbo"
- name: 🧪 Test
working-directory: govtool/frontend
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: "--max_old_space_size=6144"
NODE_AUTH_TOKEN: ${{ secrets.NPMRC_TOKEN }}
run: |
npm install
npm ci
npm run test:coverage

# Running with docker
#
# - name: Run SonarQube Scanner
# run: |
# docker run --rm \
# -e SONAR_HOST_URL="https://sonarcloud.io" \
# -e SONAR_TOKEN="ec4183646e59dd70c8077acfabe52062ccbea7a9" \
# -v "$(pwd):/usr/src" \
# --workdir=/usr/src/govtool/frontend \
# sonarsource/sonar-scanner-cli:5.0.1

- uses: sonarsource/sonarqube-scan-action@master
if: always()
with:
projectBaseDir: govtool/frontend
env:
Expand Down
28 changes: 28 additions & 0 deletions govtool/frontend/storybook.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:18-alpine as deps
ARG NPMRC_TOKEN

WORKDIR /src

# Set npm configuration settings using environment variables
RUN npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global \
&& npm config set //registry.npmjs.org/:_authToken ${NPMRC_TOKEN} --location=global

COPY package.json package-lock.json ./
RUN npm install

FROM node:18-alpine as builder
ARG NPMRC_TOKEN
ENV NODE_OPTIONS=--max_old_space_size=8192
WORKDIR /src

COPY --from=deps /src/node_modules ./node_modules
COPY . .

RUN npm run build-storybook --quiet

FROM nginx:stable-alpine
EXPOSE 80

COPY --from=builder /src/storybook-static /usr/share/nginx/html

CMD ["nginx", "-g", "daemon off;"]
9 changes: 7 additions & 2 deletions scripts/govtool/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ check_defined = \
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))


force_rebuild := $(shell echo $${FORCE_REBUILD:-false})
# helper function for checking if image exists on ECR
check_image_on_ecr = \
$(docker) manifest inspect "$(repo_url)/$1:$2" > /dev/null 2>&1
if [ "$(force_rebuild)" = "true" ]; then \
false; \
else \
$(docker) manifest inspect "$(repo_url)/$1:$2" > /dev/null 2>&1; \
fi

.PHONY: check-env-defined
check-env-defined:
Expand Down
3 changes: 3 additions & 0 deletions tests/govtool-frontend/playwright/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ API_URL=http://localhost:3000/api

DOCS_URL=https://docs.sanchogov.tools


PDF_URL=https://dev.api.pdf.gov.tools

# 0 for testnet, 1 for mainnet
NETWORK_ID=0

Expand Down
1 change: 1 addition & 0 deletions tests/govtool-frontend/playwright/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ allure-report/
lib/_mock/registerDRepWallets.json
lib/_mock/registeredDRepWallets.json
lib/_mock/wallets.json
lib/_mock/proposals.json
./lock_logs.txt
44 changes: 44 additions & 0 deletions tests/govtool-frontend/playwright/lib/_mock/proposal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"data": {
"id": 128,
"attributes": {
"prop_likes": 0,
"prop_dislikes": 0,
"prop_comments_number": 3,
"prop_submited": false,
"prop_status_id": null,
"user_id": "52",
"createdAt": "2024-06-14T08:28:18.000Z",
"updatedAt": "2024-06-14T08:28:18.000Z",
"content": {
"id": 121,
"attributes": {
"proposal_id": "128",
"prop_rev_active": true,
"prop_abstract": "Calamitas suppono coniuratio aiunt pecto uberrime deleniti tepidus acerbitas. Nihil vitium conservo abeo tametsi odit creator basium.",
"prop_motivation": "Demonstro apparatus torrens patrocinor. Concedo campana possimus agnosco tutamen astrum conventus defendo sublime.",
"prop_rationale": "Brevis suppellex coadunatio vis. Alii terreo carbo sono utilis vicissitudo.",
"gov_action_type_id": "1",
"prop_name": "Labadie, Stehr and Rosenbaum",
"prop_receiving_address": "addr_test1qqqqqqqqqqa4kpmh",
"prop_amount": 402,
"createdAt": "2024-06-14T08:28:18.012Z",
"updatedAt": "2024-06-14T08:28:18.012Z",
"is_draft": false,
"user_id": "52",
"proposal_links": [],
"gov_action_type": {
"id": 1,
"attributes": {
"gov_action_type_name": "Info",
"createdAt": "2024-05-27T15:06:15.640Z",
"updatedAt": "2024-05-27T15:06:15.640Z"
}
}
}
},
"user_govtool_username": "Jett.Hagenes21"
}
},
"meta": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"data": [
{
"id": 139,
"attributes": {
"proposal_id": "128",
"comment_parent_id": null,
"user_id": "20",
"comment_text": "Hello",
"createdAt": "2024-06-14T13:38:35.830Z",
"updatedAt": "2024-06-14T13:38:35.830Z",
"user_govtool_username": "Anonymous",
"subcommens_number": 0
}
},
{
"id": 138,
"attributes": {
"proposal_id": "128",
"comment_parent_id": null,
"user_id": "20",
"comment_text": "Nice proposal",
"createdAt": "2024-06-14T13:38:31.279Z",
"updatedAt": "2024-06-14T13:38:31.279Z",
"user_govtool_username": "Anonymous",
"subcommens_number": 0
}
},
{
"id": 137,
"attributes": {
"proposal_id": "128",
"comment_parent_id": null,
"user_id": "20",
"comment_text": "Go Ahead",
"createdAt": "2024-06-14T13:38:27.286Z",
"updatedAt": "2024-06-14T13:38:27.286Z",
"user_govtool_username": "Anonymous",
"subcommens_number": 0
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 3
}
}
}
24 changes: 24 additions & 0 deletions tests/govtool-frontend/playwright/lib/_mock/proposalPoll.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"data": [
{
"id": 39,
"attributes": {
"proposal_id": "128",
"poll_yes": 0,
"poll_no": 0,
"poll_start_dt": "2024-06-14T08:26:34.400Z",
"is_poll_active": true,
"createdAt": "2024-06-14T08:28:20.210Z",
"updatedAt": "2024-06-14T08:28:20.210Z"
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 1,
"pageCount": 1,
"total": 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const environments = {
frontendUrl: SERVER_HOST_URL,
apiUrl: `${SERVER_HOST_URL}/api`,
docsUrl: process.env.DOCS_URL || "https://docs.sanchogov.tools",
pdfUrl: process.env.PDF_URL || "https://dev.api.pdf.gov.tools",
networkId: parseInt(process.env.NETWORK_ID) || 0,
faucet: {
apiUrl:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const adaHolder06Wallet = staticWallets[9];
// Does not takes part in transaction
export const user01Wallet: StaticWallet = staticWallets[5];

// Username is already set
export const proposal01Wallet: StaticWallet = staticWallets[10];

export const adaHolderWallets = [
adaHolder01Wallet,
adaHolder02Wallet,
Expand All @@ -28,3 +31,5 @@ export const adaHolderWallets = [
export const userWallets = [user01Wallet];

export const dRepWallets = [dRep01Wallet, dRep02Wallet];

export const proposalWallets = [proposal01Wallet];
37 changes: 37 additions & 0 deletions tests/govtool-frontend/playwright/lib/fixtures/proposal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { proposal01Wallet } from "@constants/staticWallets";
import { test as base } from "@fixtures/walletExtension";
import { createNewPageWithWallet } from "@helpers/page";
import ProposalDiscussionDetailsPage from "@pages/proposalDiscussionDetailsPage";
import ProposalDiscussionPage from "@pages/proposalDiscussionPage";

type TestOptions = {
proposalId: number;
pollEnabled: boolean;
};

export const test = base.extend<TestOptions>({
pollEnabled: [false, { option: true }],

proposalId: async ({ page, browser, pollEnabled }, use) => {
// setup
const proposalPage = await createNewPageWithWallet(browser, {
storageState: ".auth/proposal01.json",
wallet: proposal01Wallet,
});

const proposalDiscussionPage = new ProposalDiscussionPage(proposalPage);
await proposalDiscussionPage.goto();
const proposalId = await proposalDiscussionPage.createProposal();
const proposalDetailsPage = new ProposalDiscussionDetailsPage(proposalPage);

if (pollEnabled) {
await proposalDetailsPage.addPollBtn.click();
}

await use(proposalId);

// cleanup
await proposalDetailsPage.goto(proposalId);
await proposalDetailsPage.deleteProposal();
},
});
7 changes: 7 additions & 0 deletions tests/govtool-frontend/playwright/lib/helpers/cardano.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { bech32 } from "bech32";

export function lovelaceToAda(lovelace: number) {
if (lovelace === 0) return 0;

return lovelace / 1e6;
}

export function generateWalletAddress() {
const randomBytes = new Uint8Array(10);
return bech32.encode("addr_test", randomBytes);
}
Loading
Loading