Skip to content

Commit f0e0e61

Browse files
authored
Merge pull request #3809 from IntersectMBO/develop
V2.0.26.1
2 parents 8b48865 + 0d7d150 commit f0e0e61

File tree

9 files changed

+290
-42
lines changed

9 files changed

+290
-42
lines changed
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
name: Check and Build QA
2+
3+
on:
4+
push:
5+
branches:
6+
- test
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
packages: write
13+
14+
jobs:
15+
check-build:
16+
if: contains(fromJson('["test"]'), github.ref_name)
17+
environment: ${{ matrix.network }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- branch: test
23+
network: qa-govtool
24+
workdir: ./govtool/backend
25+
name: govtool-backend
26+
dockerfile: ./govtool/backend/Dockerfile.qovery
27+
image: ghcr.io/${{ github.repository }}-backend
28+
qovery_container_name: govtool-backend
29+
- branch: test
30+
network: qa-govtool
31+
workdir: ./govtool/frontend
32+
name: govtool-frontend
33+
dockerfile: ./govtool/frontend/Dockerfile.qovery
34+
image: ghcr.io/${{ github.repository }}-frontend
35+
qovery_container_name: govtool-frontend
36+
- branch: test
37+
network: qa-govtool
38+
workdir: ./govtool/metadata-validation
39+
name: govtool-metadata-validation
40+
dockerfile: ./govtool/metadata-validation/Dockerfile
41+
image: ghcr.io/${{ github.repository }}-metadata-validation
42+
qovery_container_name: govtool-metadata-validation
43+
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v4
48+
49+
- name: Ensure Job Runs Only for Matching Branch
50+
if: github.ref_name != matrix.branch
51+
run: |
52+
echo "Branch mismatch, exiting..."
53+
exit 0
54+
55+
- name: Set TAG Environment Variable
56+
id: set_tag
57+
run: |
58+
SANITIZED_BRANCH=$(echo "${{ github.ref_name }}" | tr '/' '-')
59+
echo "COMMIT_TAG=${SANITIZED_BRANCH}-${{ github.sha }}-${{ github.run_number }}" >> $GITHUB_ENV
60+
echo "STATIC_TAG=qa-latest" >> $GITHUB_ENV
61+
echo "Generated TAG: $COMMIT_TAG"
62+
echo "Generated STATIC_TAG: $STATIC_TAG"
63+
64+
65+
- name: Lint Dockerfile
66+
id: hadolint
67+
uses: hadolint/[email protected]
68+
with:
69+
failure-threshold: error
70+
format: json
71+
dockerfile: ${{ matrix.dockerfile }}
72+
# output-file: hadolint_output.json
73+
74+
- name: Save Hadolint output
75+
id: save_hadolint_output
76+
if: always()
77+
run: cd ${{ matrix.workdir }} && echo "$HADOLINT_RESULTS" | jq '.' > hadolint_output.json
78+
79+
- name: Print Dockerfile lint output
80+
run: |
81+
cd ${{ matrix.workdir }}
82+
echo "-----HADOLINT RESULT-----"
83+
echo "Outcome: ${{ steps.hadolint.outcome }}"
84+
echo "-----DETAILS--------"
85+
cat hadolint_output.json
86+
echo "--------------------"
87+
88+
- name: Code lint
89+
id: code_lint
90+
run: |
91+
cd ${{ matrix.workdir }}
92+
if [ ! -f lint.sh ]; then
93+
echo "lint skipped" | tee code_lint_output.txt
94+
exit 0
95+
fi
96+
set -o pipefail
97+
sudo chmod +x lint.sh && ./lint.sh 2>&1 | tee code_lint_output.txt
98+
99+
- name: Unit tests
100+
id: unit_tests
101+
run: |
102+
cd ${{ matrix.workdir }}
103+
if [ ! -f unit-test.sh ]; then
104+
echo "unit tests skipped" | tee code_lint_output.txt
105+
exit 0
106+
fi
107+
set -o pipefail
108+
sudo chmod +x unit-test.sh && ./unit-test.sh 2>&1 | tee unit_test_output.txt
109+
110+
- name: Set up Docker Buildx
111+
uses: docker/setup-buildx-action@v2
112+
113+
- name: Cache Docker layers
114+
uses: actions/cache@v4
115+
with:
116+
path: /tmp/.buildx-cache
117+
key: ${{ runner.os }}-buildx-${{ github.sha }}-${{ github.run_number}}
118+
restore-keys: |
119+
${{ runner.os }}-buildx-
120+
121+
- id: image_lowercase
122+
uses: ASzc/change-string-case-action@v6
123+
with:
124+
string: ${{ matrix.image }}
125+
126+
- name: Set ENVIRONMENT Variable
127+
run: echo "ENVIRONMENT=${{ matrix.network }}" >> $GITHUB_ENV
128+
129+
- name: Sanitize Network Name
130+
run: |
131+
CLEAN_NETWORK=$(echo "${{ matrix.network }}" | sed 's/-govtool$//')
132+
echo "CLEAN_NETWORK=$CLEAN_NETWORK" >> $GITHUB_ENV
133+
134+
- name: Build Docker image
135+
uses: docker/build-push-action@v5
136+
with:
137+
context: ${{ matrix.workdir }}
138+
file: ${{ matrix.dockerfile }}
139+
tags: >
140+
${{ steps.image_lowercase.outputs.lowercase }}-${{ env.CLEAN_NETWORK }}:${{ env.COMMIT_TAG }},
141+
${{ steps.image_lowercase.outputs.lowercase }}-${{ env.CLEAN_NETWORK }}:${{ env.STATIC_TAG }}
142+
load: false
143+
cache-from: type=local,src=/tmp/.buildx-cache
144+
cache-to: type=local,dest=/tmp/.buildx-cache
145+
outputs: type=docker,dest=/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar
146+
build-args: |
147+
VITE_APP_ENV=${{ secrets.VITE_APP_ENV }}
148+
VITE_BASE_URL=${{ secrets.VITE_BASE_URL }}
149+
VITE_METADATA_API_URL=${{ secrets.VITE_METADATA_API_URL }}
150+
VITE_NETWORK_FLAG=${{ secrets.VITE_NETWORK_FLAG }}
151+
VITE_SENTRY_DSN=${{ secrets.VITE_SENTRY_DSN }}
152+
VITE_USERSNAP_SPACE_API_KEY=${{ secrets.VITE_USERSNAP_SPACE_API_KEY }}
153+
VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED=${{ secrets.VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED }}
154+
VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED=${{ secrets.VITE_IS_GOVERNANCE_OUTCOMES_PILLAR_ENABLED }}
155+
VITE_OUTCOMES_API_URL=${{secrets.VITE_OUTCOMES_API_URL}}
156+
VITE_PDF_API_URL=${{ secrets.VITE_PDF_API_URL }}
157+
VITE_IPFS_GATEWAY=${{ secrets.IPFS_GATEWAY }}
158+
VITE_IPFS_PROJECT_ID=${{ secrets.IPFS_PROJECT_ID }}
159+
IPFS_GATEWAY=${{ secrets.IPFS_GATEWAY }}
160+
IPFS_PROJECT_ID=${{ secrets.IPFS_PROJECT_ID }}
161+
162+
- name: Login to GHCR
163+
uses: docker/login-action@v2
164+
with:
165+
registry: ghcr.io
166+
username: ${{ github.actor }}
167+
password: ${{ secrets.GITHUB_TOKEN }}
168+
169+
- name: Scan Docker image with Dockle
170+
id: dockle
171+
run: |
172+
wget -q https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz
173+
tar zxf dockle_0.4.14_Linux-64bit.tar.gz
174+
sudo mv dockle /usr/local/bin
175+
176+
dockle --exit-code 1 --exit-level fatal --format json -ak GHC_RELEASE_KEY -ak CABAL_INSTALL_RELEASE_KEY -ak STACK_RELEASE_KEY -ak KEY_SHA512 --input '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar' --output ${{ matrix.workdir }}/dockle_scan_output.json
177+
echo " dockle exited w/ $?"
178+
cat ${{ matrix.workdir }}/dockle_scan_output.json
179+
180+
echo "outcome=success" >> $GITHUB_OUTPUT
181+
182+
- name: Debug TAG Before Docker Push
183+
run: |
184+
echo "Lowercase Image: ${{ steps.image_lowercase.outputs.lowercase }}"
185+
echo "Network: ${{ matrix.network }}"
186+
echo "COMMIT_TAG: ${{ env.COMMIT_TAG }}"
187+
echo "STATIC_TAG: ${{ env.STATIC_TAG }}"
188+
echo "Final Docker Tag: ${{ steps.image_lowercase.outputs.lowercase }}-${{ matrix.network}}:${{ env.TAG }}"
189+
190+
- name: Push Docker image to GHCR
191+
run: |
192+
docker load -i '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar'
193+
rm -rf '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar'
194+
docker push ${{ steps.image_lowercase.outputs.lowercase }}-${{ env.CLEAN_NETWORK}}:${{ env.COMMIT_TAG }}
195+
docker push ${{ steps.image_lowercase.outputs.lowercase }}-${{ env.CLEAN_NETWORK}}:${{ env.STATIC_TAG }}
196+
197+
- name: Notify Qovery of new image tag
198+
run: |
199+
curl -X POST https://api.qovery.com/organization/${{ secrets.QOVERY_ORG_ID }}/container/deploy \
200+
-H "Authorization: Token ${{ secrets.QOVERY_API_TOKEN }}" \
201+
-H "Content-Type: application/json" \
202+
-d '{
203+
"image_name": "${{ steps.image_lowercase.outputs.lowercase }}-${{ env.CLEAN_NETWORK }}",
204+
"tag": "${{ env.COMMIT_TAG }}"
205+
}'
206+
207+
- name: Add tag as a PR comment
208+
uses: ubie-oss/[email protected]
209+
id: comment-to-merged-pr
210+
with:
211+
github-token: ${{ secrets.GITHUB_TOKEN }}
212+
message: |-
213+
This PR is in the tag: ${{ env.COMMIT_TAG }} , for ${{ matrix.name }} service

govtool/frontend/package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"@emotion/styled": "^11.11.0",
2828
"@emurgo/cardano-serialization-lib-asmjs": "^14.1.1",
2929
"@hookform/resolvers": "^3.3.1",
30-
"@intersect.mbo/govtool-outcomes-pillar-ui": "v1.4.3",
30+
"@intersect.mbo/govtool-outcomes-pillar-ui": "v1.5.0",
3131
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
32-
"@intersect.mbo/pdf-ui": "1.0.2-beta",
32+
"@intersect.mbo/pdf-ui": "1.0.3-alfa",
3333
"@mui/icons-material": "^5.14.3",
3434
"@mui/material": "^5.14.4",
3535
"@rollup/plugin-babel": "^6.0.4",

tests/govtool-frontend/playwright/lib/forms/dRepForm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ export default class DRepForm {
232232
`${dRepInfo.paymentAddress} is an invalid paymentAddress`,
233233
}).toBeHidden({ timeout: 60_000 });
234234
await expect(this.continueBtn).toBeEnabled();
235+
// Wait for the form to settle after validation
236+
await this.form.waitForTimeout(500);
235237
}
236238

237239
async inValidateForm(dRepInfo: IDRepInfo) {
@@ -329,5 +331,7 @@ export default class DRepForm {
329331
}).toBeVisible();
330332

331333
await expect(this.continueBtn).toBeDisabled();
334+
// Wait for the form to settle after validation
335+
await this.form.waitForTimeout(500);
332336
}
333337
}

tests/govtool-frontend/playwright/lib/pages/outcomesPage.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,22 @@ export default class OutComesPage {
251251
return outcomeStatus.some((status) => filters.includes(status));
252252
}
253253

254-
async shouldAccessPage() {
254+
async shouldAccessPage(isLoggedIn = false) {
255255
await this.page.goto("/");
256256

257257
if (isMobile(this.page)) {
258258
await this.page.getByTestId("open-drawer-button").click();
259+
} else {
260+
if (!isLoggedIn) {
261+
await this.page.getByTestId("governance-actions").click();
262+
}
259263
}
260264
await this.page.getByTestId("governance-actions-outcomes-link").click();
261265

266+
if (!isMobile(this.page) && !isLoggedIn) {
267+
await this.page.getByTestId("governance-actions").click();
268+
}
269+
262270
await expect(this.page.getByText(/outcomes/i)).toHaveCount(2);
263271
}
264272

tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test("4A_2. Should access Governance Actions page without connecting wallet", as
4444
await page.goto("/");
4545
await page.getByTestId("move-to-governance-actions-button").click();
4646

47-
await expect(page.getByText(/Governance actions/i)).toHaveCount(1);
47+
await expect(page.getByText(/Governance actions/i)).toHaveCount(2);
4848
});
4949

5050
test("4B_2. Should restrict voting for users who are not registered as DReps (without wallet connected)", async ({

0 commit comments

Comments
 (0)