From 8b6b904cd662678252e590a171c9325bfcf4851e Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:10:48 +0100 Subject: [PATCH 1/3] test(governance): un-skip governance tests (#4292) --- .../src/integration/flow/proposal-flow.cy.ts | 4 ++-- apps/governance-e2e/src/integration/view/home.cy.ts | 2 +- .../src/integration/view/pubkey-view.cy.ts | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts index 8c66f8689..c5f72c211 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts @@ -320,8 +320,8 @@ context( // 3001-VOTE-076 cy.getByTestId(connectToVegaWalletButton) .should('be.visible') - .and('have.text', 'Connect Vega wallet') - .click(); + .and('have.text', 'Connect Vega wallet'); + cy.getByTestId(connectToVegaWalletButton).click(); cy.getByTestId('connector-jsonRpc').click(); cy.getByTestId(vegaWalletNameElement).should('be.visible'); cy.getByTestId(connectToVegaWalletButton).should('not.exist'); diff --git a/apps/governance-e2e/src/integration/view/home.cy.ts b/apps/governance-e2e/src/integration/view/home.cy.ts index 4ceff6fa7..6e2df34fd 100644 --- a/apps/governance-e2e/src/integration/view/home.cy.ts +++ b/apps/governance-e2e/src/integration/view/home.cy.ts @@ -161,7 +161,7 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () { cy.getByTestId('menu-drawer').should('be.visible'); }); - it.skip('should have link for proposal page', function () { + it('should have link for proposal page', function () { cy.getByTestId('menu-drawer').within(() => { cy.get('[href="/proposals"]') .should('exist') diff --git a/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts b/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts index 794aeddf7..edd20d669 100644 --- a/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts +++ b/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts @@ -1,13 +1,12 @@ /// import { - navigateTo, - navigation, turnTelemetryOff, waitForSpinner, } from '../../support/common.functions'; import { - enterUniqueFreeFormProposalBody, + createTenDigitUnixTimeStampForSpecifiedDays, + enterRawProposalBody, goToMakeNewProposal, governanceProposalType, } from '../../support/governance.functions'; @@ -47,12 +46,11 @@ context('View functionality with public key', { tags: '@smoke' }, function () { .and('contain.text', 'USDC (fake)'); }); - it.skip('Unable to submit proposal with public key', function () { + it('Unable to submit proposal with public key', function () { const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`; - navigateTo(navigation.proposals); - goToMakeNewProposal(governanceProposalType.FREEFORM); - enterUniqueFreeFormProposalBody('50', 'pub key proposal test'); + goToMakeNewProposal(governanceProposalType.RAW); + enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8)); cy.getByTestId('dialog-content') .first() .within(() => { From 94a067e34b2904a2431e5db3d5a2daf37cc1ff54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Thu, 13 Jul 2023 11:19:37 +0200 Subject: [PATCH 2/3] fix(ci): disable pull_request_target (#4315) --- .github/workflows/ci-cd-trigger.yml | 12 +++++------- .github/workflows/publish-dist.yml | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index a5831f71a..9842705b5 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -5,9 +5,7 @@ on: branches: - release/* - develop - # uncomment pull_request and comment pull_request_target to test CI changes against feature branch not target branch (develop) - # pull_request: - pull_request_target: + pull_request: types: - opened - ready_for_review @@ -48,7 +46,7 @@ jobs: lint-pr-title: needs: node-modules - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ github.event_name == 'pull_request' }} name: Verify PR title uses: ./.github/workflows/lint-pr.yml secrets: inherit @@ -231,7 +229,7 @@ jobs: publish-dist: needs: lint-test-build name: '(CD) publish dist' - # if: ${{ needs.lint-test-build.outputs.projects != '[]' }} + if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'vegaprotocol/frontend-monorepo') || github.event_name == 'push' }} uses: ./.github/workflows/publish-dist.yml secrets: inherit with: @@ -242,7 +240,7 @@ jobs: needs: - publish-dist - lint-test-build - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'vegaprotocol/frontend-monorepo' }} timeout-minutes: 60 name: '(CD) comment preview links' steps: @@ -288,7 +286,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | - Previews: + Previews * governance: ${{ needs.lint-test-build.outputs.preview_governance }} * explorer: ${{ needs.lint-test-build.outputs.preview_explorer }} * trading: ${{ needs.lint-test-build.outputs.preview_trading }} diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 63b328826..51c7466de 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -30,7 +30,7 @@ jobs: echo IS_IPFS_RELEASE=false >> $GITHUB_ENV - name: Is PR - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ github.event_name == 'pull_request' }} run: | echo IS_PR=true >> $GITHUB_ENV @@ -96,8 +96,8 @@ jobs: bucketName='' if [[ "${{ github.ref }}" =~ .*release/.* ]]; then - # remove prefixing release/ and take the first string limited by / which is supposed to be name of the environment for releasing - envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '/' -f 1 )" + # remove prefixing release/ and take the first string limited by - which is supposed to be name of the environment for releasing (format: release/testnet-trading) + envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '-' -f 1 )" elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then envName="stagnet1" if [[ "${{ matrix.app }}" = "multisig-signer" ]]; then From edbdbcf38ee50eeb4814418e711a9a4a3ff225ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Thu, 13 Jul 2023 16:10:07 +0200 Subject: [PATCH 3/3] feat(ci): provide fixes for releasing individual apps --- .github/workflows/ci-cd-trigger.yml | 10 +++++++++- .github/workflows/publish-dist.yml | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index 9842705b5..851bfcaf6 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -107,6 +107,7 @@ jobs: echo "NX_HEAD: ${{ env.NX_HEAD }}" echo "Affected: ${affected}" echo "Branch slug: ${branch_slug}" + echo "Current ref: ${{ github.ref }}" echo ">>>> eof debug" projects_array=() @@ -178,20 +179,27 @@ jobs: fi # if branch starts with release/ and ends with trading / governance or explorer - overwrite the array of affected projects with fixed single application - if [[ "${{ github.ref }}" == release* ]]; then + if [[ "${{ github.ref }}" == *release* ]]; then + echo ">> This is a relase branch" case "${{ github.ref }}" in *trading) + echo ">> Only trading will be deployed" projects_array=(trading) projects_e2e_array=(trading) ;; *governance) + echo ">> Only governance will be deployed" projects_array=(governance) projects_e2e_array=(governance) ;; *explorer) + echo ">> Only explorer will be deployed" projects_array=(explorer) projects_e2e_array=(explorer) ;; + *) + echo ">> All apps will be deployed" + ;; esac fi diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 51c7466de..ef17f00cf 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -97,7 +97,7 @@ jobs: if [[ "${{ github.ref }}" =~ .*release/.* ]]; then # remove prefixing release/ and take the first string limited by - which is supposed to be name of the environment for releasing (format: release/testnet-trading) - envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '-' -f 1 )" + envName="$(echo ${{ github.ref }} | sed -e "s|refs/heads/release/||" | cut -d '-' -f 1 )" elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then envName="stagnet1" if [[ "${{ matrix.app }}" = "multisig-signer" ]]; then @@ -112,7 +112,7 @@ jobs: envName="mainnet" bucketName="ui.vega.rocks" fi - elif [[ "${{ github.ref }}" =~ .*main$ ]]; then + elif [[ "${{ github.ref }}" =~ .*mainnet$ ]]; then envName="mainnet" fi @@ -282,7 +282,7 @@ jobs: # release to ipfs happens only on mainnet (represented by main branch) for trading if: ${{ env.IS_IPFS_RELEASE == 'true' }} run: | - if echo ${{ github.ref }} | grep -q main; then + if [[ "${{ env.IS_MAINNET_RELEASE }}" = "true" ]]; then # display info about app curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \ -H "Content-Type: application/json" \ @@ -295,7 +295,7 @@ jobs: -d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \ https://api.fleek.co/graphql - elif echo ${{ github.ref }} | grep -q release/testnet; then + elif [[ "${{ env.IS_TESTNET_RELEASE }}" = "true" ]]; then # display info about app curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \ -H "Content-Type: application/json" \