From 4d9c43cf19545914f0544ab94ac02b0484dc2f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szpiech?= Date: Thu, 22 Sep 2022 16:07:18 +0200 Subject: [PATCH] Chore/improve ci test times (#1423) * chore: disable video record for token e2e * chore: disable videos in all tests * fix: change main-branch-name to base-ref * chore: disable capsule being run when not necessary * fix: missing true * chore: fix typo * chore: fix if contruction * chore: fix env * chore: fix envs * chore: try to fix develop ref --- .github/workflows/capsule-cypress.yml | 57 ++++++++++++------- .github/workflows/ipfs.yml | 32 ----------- apps/console-lite-e2e/cypress.config.js | 2 +- apps/explorer-e2e/cypress.config.js | 2 +- .../cypress.config.js | 2 +- apps/stats-e2e/cypress.config.js | 2 +- apps/token-e2e/cypress.config.js | 2 +- apps/trading-e2e/cypress.config.js | 4 +- 8 files changed, 44 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/ipfs.yml diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index 0a74eb470..960ed141d 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -35,7 +35,7 @@ jobs: node-version: 16 ####### - ## Checkout capsule + ## Checkout repos ####### # Checkout front ends @@ -55,16 +55,7 @@ jobs: token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './capsule' - ####### - ## Build binaries - ####### - - name: Build capsule - run: go install - working-directory: capsule - - - name: Set GOBIN - run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV - + # Checkout vega - name: Checkout Vega uses: actions/checkout@v2 with: @@ -73,28 +64,58 @@ jobs: token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './vega' + # Install frontend dependencies + - name: Install root dependencies + run: yarn install + working-directory: frontend-monorepo + + # See affected apps to see if building all binaries is necessary + - name: See affected apps + run: echo AFFECTED=$(yarn nx print-affected --base=origin/${{github.base_ref}} --head=${{github.head_ref}} --select=projects) >> $GITHUB_ENV + working-directory: frontend-monorepo + + - name: See if capsule is necessary + if: ${{ contains(env.AFFECTED, 'token') || contains(env.AFFECTED, 'token-e2e') || contains(env.AFFECTED, 'explorer') || contains(env.AFFECTED, 'explorer-e2e') }} + run: echo RUN_CAPSULE=true >> $GITHUB_ENV + + ####### + ## Build binaries + ####### + - name: Build capsule + if: ${{ env.RUN_CAPSULE }} + run: go install + working-directory: capsule + + - name: Set GOBIN + run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV + - name: Install Vega binaries + if: ${{ env.RUN_CAPSULE }} run: go install -v ./cmd/vega working-directory: vega + - name: Install date-node binaries + if: ${{ env.RUN_CAPSULE }} + run: go install ./cmd/data-node + working-directory: vega + - name: Install Vega wallet binaries run: go install ./cmd/vegawallet working-directory: vega - - name: Install date-node binaries - run: go install ./cmd/data-node - working-directory: vega - ###### ## Start capsule ###### - name: Login to docker + if: ${{ env.RUN_CAPSULE }} run: echo -n ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} | docker login https://ghcr.io -u vega-ci-bot --password-stdin - name: Start nomad + if: ${{ env.RUN_CAPSULE }} run: vegacapsule nomad & - name: Bootstrap network + if: ${{ env.RUN_CAPSULE }} run: vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl --force working-directory: capsule @@ -123,11 +144,7 @@ jobs: uses: nrwl/nx-set-shas@v2 with: working-directory: frontend-monorepo - main-branch-name: master - - - name: Install root dependencies - run: yarn install - working-directory: frontend-monorepo + main-branch-name: ${{github.base_ref}} - name: Run Cypress tests run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/.github/workflows/ipfs.yml b/.github/workflows/ipfs.yml deleted file mode 100644 index 2d4cd0310..000000000 --- a/.github/workflows/ipfs.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Deploy affected projects to IPFS - -'on': - # Triggers the workflow on push to main branch - push: - branches: [master] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: null - -jobs: - master: - name: Publish NX Affected - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - - name: Use Node.js 16 - id: Node - uses: actions/setup-node@v2 - with: - node-version: 16.14.0 - - name: Install root dependencies - run: yarn install - - name: Run deploy for affected sites - env: - FLEEK_API_KEY: ${{ secrets.FLEEK_API_KEY }} - run: ./tools/ipfs-deploy.js diff --git a/apps/console-lite-e2e/cypress.config.js b/apps/console-lite-e2e/cypress.config.js index 230854502..845d9543b 100644 --- a/apps/console-lite-e2e/cypress.config.js +++ b/apps/console-lite-e2e/cypress.config.js @@ -10,7 +10,7 @@ module.exports = defineConfig({ excludeSpecPattern: '**/*.js', modifyObstructiveCode: false, supportFile: './src/support/index.ts', - video: true, + video: false, videoUploadOnPasses: false, videosFolder: '../../dist/cypress/apps/console-lite-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/console-lite-e2e/screenshots', diff --git a/apps/explorer-e2e/cypress.config.js b/apps/explorer-e2e/cypress.config.js index bf18b240d..e6c6fe95e 100644 --- a/apps/explorer-e2e/cypress.config.js +++ b/apps/explorer-e2e/cypress.config.js @@ -10,7 +10,7 @@ module.exports = defineConfig({ specPattern: '**/*.cy.{js,jsx,ts,tsx}', modifyObstructiveCode: false, supportFile: './src/support/index.ts', - video: true, + video: false, videoUploadOnPasses: false, videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', diff --git a/apps/liquidity-provision-dashboard-e2e/cypress.config.js b/apps/liquidity-provision-dashboard-e2e/cypress.config.js index 18eb4aa47..97ddb85b9 100644 --- a/apps/liquidity-provision-dashboard-e2e/cypress.config.js +++ b/apps/liquidity-provision-dashboard-e2e/cypress.config.js @@ -11,7 +11,7 @@ module.exports = defineConfig({ excludeSpecPattern: '**/*.js', modifyObstructiveCode: false, supportFile: './src/support/index.ts', - video: true, + video: false, videoUploadOnPasses: false, videosFolder: '../../dist/cypress/apps/liquidity-provision-dashboard-e2e/videos', diff --git a/apps/stats-e2e/cypress.config.js b/apps/stats-e2e/cypress.config.js index dd9c84416..edc0e123a 100644 --- a/apps/stats-e2e/cypress.config.js +++ b/apps/stats-e2e/cypress.config.js @@ -10,7 +10,7 @@ module.exports = defineConfig({ excludeSpecPattern: '**/*.js', modifyObstructiveCode: false, supportFile: './src/support/index.ts', - video: true, + video: false, videoUploadOnPasses: false, videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', diff --git a/apps/token-e2e/cypress.config.js b/apps/token-e2e/cypress.config.js index 9d2b25f16..89fa6e643 100644 --- a/apps/token-e2e/cypress.config.js +++ b/apps/token-e2e/cypress.config.js @@ -16,7 +16,7 @@ module.exports = defineConfig({ : ['./src/integration/view/**/*.cy.{js,jsx,ts,tsx}'], modifyObstructiveCode: false, supportFile: './src/support/index.ts', - video: true, + video: false, videoUploadOnPasses: false, videosFolder: '../../dist/cypress/apps/token-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/token-e2e/screenshots', diff --git a/apps/trading-e2e/cypress.config.js b/apps/trading-e2e/cypress.config.js index 9d3b2a09f..91ca2afe6 100644 --- a/apps/trading-e2e/cypress.config.js +++ b/apps/trading-e2e/cypress.config.js @@ -7,7 +7,7 @@ module.exports = defineConfig({ fixturesFolder: false, specPattern: '**/*.cy.{js,jsx,ts,tsx}', supportFile: './src/support/index.ts', - video: true, + video: false, videosFolder: '../../dist/cypress/apps/trading-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/trading-e2e/screenshots', chromeWebSecurity: false, @@ -20,7 +20,7 @@ module.exports = defineConfig({ fixturesFolder: false, specPattern: '**/*.cy.{js,jsx,ts,tsx}', supportFile: './src/support/index.ts', - video: true, + video: false, videosFolder: '../../dist/cypress/apps/trading-e2e/videos', videoUploadOnPasses: false, screenshotsFolder: '../../dist/cypress/apps/trading-e2e/screenshots',