From ce2ca5981fa13f599d77a316b8e77d4676bcc63c Mon Sep 17 00:00:00 2001 From: Zainab Elgohary <40770501+zaelgohary@users.noreply.github.com> Date: Tue, 13 Aug 2024 08:54:08 +0300 Subject: [PATCH] Fix Grid Nightly workflow (#3274) * Push workflow * Update workflow, add issue template * test workflow * Update search_existing * add update_existing * Edit workflow * Edit workflow to get title from env file * Add issue title env * test duplication * Edit nightly, comment issue creation, edit issue template * Edit checkout version * Checkout repo b4 creating an issue * Edit body * Edit nightly * test envs in issue template * Search issues before create new one * add token to find issues * Edit workflow url, remove unused files * Enforce running all jobs, fix run url * Edit nightly * add all networks * Test failed test * Replace continue-on-err w if:always() * Final test * Run a cron job instead on push * Edit branches in all actions, remove jq installation * Fail on purpuse * Revert cron job --- .github/workflows/build.yml | 6 +- .github/workflows/grid_client_nightly.yml | 113 +++++++++------------- .github/workflows/lint.yml | 6 +- .github/workflows/playground_build.yml | 2 - .github/workflows/yarn_audit.yml | 6 +- 5 files changed, 58 insertions(+), 75 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a81393441..28d9bd8285 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,9 +5,11 @@ name: Full Clients Build on: push: - branches: [development, development_2.6] + branches: + - development pull_request: - branches: [development, development_2.6] + branches: + - development jobs: build: diff --git a/.github/workflows/grid_client_nightly.yml b/.github/workflows/grid_client_nightly.yml index ce018c2741..c158c5eef9 100644 --- a/.github/workflows/grid_client_nightly.yml +++ b/.github/workflows/grid_client_nightly.yml @@ -6,6 +6,10 @@ on: schedule: - cron: "0 4 * * *" workflow_dispatch: +permissions: + contents: read + issues: write + jobs: deployment-scripts: runs-on: ubuntu-latest @@ -22,17 +26,6 @@ jobs: steps: - uses: actions/checkout@v4 - if: ${{ env.NETWORK == 'dev' }} - - uses: actions/checkout@v4 - if: ${{ env.NETWORK == 'qa' }} - with: - ref: refs/tags/v2.5.2 - - uses: actions/checkout@v4 - if: ${{ env.NETWORK == 'test' }} - with: - ref: refs/tags/v2.5.2 - - uses: actions/checkout@v4 - if: ${{ env.NETWORK == 'main' }} with: ref: refs/tags/v2.5.2 @@ -45,56 +38,62 @@ jobs: - name: Install deps run: | sudo apt-get update - sudo apt-get install -y git libtool tmux redis net-tools + sudo apt-get install -y git libtool tmux redis net-tools gh - name: Install run: | yarn - lerna run build --no-private + make build - name: Run test dynamic single vm - id: dynamicsinglevm - continue-on-error: true + id: single_vm + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/dynamic_single_vm.ts + - name: Run test multiple vms - id: multiplevm - continue-on-error: true + id: multiple_vm + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/multiple_vms.ts + - name: Run test kubernetes - id: kubernetes - continue-on-error: true + id: k8s + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/orchestrators/kubernetes_leader.ts + - name: Run test vm with qsfs id: vmqsfs - continue-on-error: true + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/vm_with_qsfs.ts + - name: Run test kubernetes with qsfs - id: kubernetesqsfs - continue-on-error: true + id: k8sqsfs + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/orchestrators/kubernetes_with_qsfs.ts + - name: Run test kvstore id: kvstore - continue-on-error: true + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/kvstore_example.ts + - name: Run test zdb id: zdb - continue-on-error: true + if: always() run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/zdb.ts - name: Cleanup - Delete all contracts - id: deleteall + if: always() + id: delete_all run: | yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/delete_all_contracts.ts - name: Run check up - List all contracts - id: command_step run: | sleep 15 yarn run ts-node --project packages/grid_client/tsconfig-node.json packages/grid_client/scripts/list_all_contracts.ts > output.txt @@ -111,53 +110,33 @@ jobs: exit 1 fi - - name: Test Results + - name: Find issues + if: failure() + id: find-issues + env: + GH_TOKEN: ${{ github.token }} run: | - echo Dynamic Single Vm: ${{ steps.dynamicsinglevm.outcome }} - echo Multiple Vm: ${{ steps.multiplevm.outcome }} - echo Kubernetes: ${{ steps.kubernetes.outcome }} - echo Vmq Qsfs: ${{ steps.vmqsfs.outcome }} - echo Kubernetes Qsfs: ${{ steps.kubernetesqsfs.outcome }} - echo Kvstore: ${{ steps.kvstore.outcome }} - echo Zdb: ${{ steps.zdb.outcome }} - echo Delete all contracts: ${{ steps.deleteall.outcome }} - - - name: Check test script status - if: | - steps.dynamicsinglevm.outcome != 'success' || - steps.multiplevm.outcome != 'success' || - steps.kubernetes.outcome != 'success' || - steps.vmqsfs.outcome != 'success' || - steps.kubernetesqsfs.outcome != 'success' || - steps.kvstore.outcome != 'success' || - steps.zdb.outcome != 'success' || - steps.deleteall.outcome != 'success' - run: exit 1 + ISSUE_COUNT=$(gh issue list --search "${{github.workflow}} failed during schedule on ${{ env.NETWORK }}" --json title --jq '. | length') + echo "issue_count=$ISSUE_COUNT" >> $GITHUB_ENV - name: Create GitHub Issue on Failure - if: failure() && '$(date +%u)' != '5' && '$(date +%u)' != '6' + if: failure() && env.issue_count == '0' uses: dacbd/create-issue-action@main with: token: ${{ github.token }} - title: | - ${{ github.workflow }} failed during ${{ github.event_name }} on network ${{ env.NETWORK }} + title: ${{github.workflow}} failed during schedule on ${{ env.NETWORK }} body: | - ## Failure Report: - + ## Failure Report + > [!IMPORTANT] - > Details on failed run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - - - Author: @${{ github.triggering_actor }} - - Branch: `${{ github.ref }}` - - Commit: ${{ github.sha }} - - Network: `${{ env.NETWORK }}` - - Dynamic Single Vm: ${{ steps.dynamicsinglevm.outcome }} - Multiple Vm: ${{ steps.multiplevm.outcome }} - Kubernetes: ${{ steps.kubernetes.outcome }} - Vmq Qsfs: ${{ steps.vmqsfs.outcome }} - Kubernetes Qsfs: ${{ steps.kubernetesqsfs.outcome }} - Kvstore: ${{ steps.kvstore.outcome }} - Zdb: ${{ steps.zdb.outcome }} - Delete all contracts: ${{ steps.deleteall.outcome }} + > **Details on failed run**: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + + - **Dynamic Single Vm**: ${{ steps.single_vm.outcome }} + - **Multiple Vm**: ${{ steps.multiple_vm.outcome }} + - **Kubernetes**: ${{ steps.k8s.outcome }} + - **Vmq QSFS**: ${{ steps.vmqsfs.outcome }} + - **Kubernetes QSFS**: ${{ steps.k8sqsfs.outcome }} + - **Kvstore**: ${{ steps.kvstore.outcome }} + - **Zdb**: ${{ steps.zdb.outcome }} + - **Delete all contracts**: ${{ steps.delete_all.outcome }} labels: type_bug, grid_client diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ba40884c5a..780025f397 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,9 +5,11 @@ name: Full Clients Lint on: push: - branches: [development, development_2.6] + branches: + - development pull_request: - branches: [development, development_2.6] + branches: + - development jobs: lint: diff --git a/.github/workflows/playground_build.yml b/.github/workflows/playground_build.yml index 6301773009..d83fc75fc9 100644 --- a/.github/workflows/playground_build.yml +++ b/.github/workflows/playground_build.yml @@ -6,13 +6,11 @@ on: push: branches: - development - - development_2.6 paths: - "packages/playground/**" pull_request: branches: - development - - development_2.6 paths: - "packages/playground/**" diff --git a/.github/workflows/yarn_audit.yml b/.github/workflows/yarn_audit.yml index 4996ba7bae..a0354ee3e2 100644 --- a/.github/workflows/yarn_audit.yml +++ b/.github/workflows/yarn_audit.yml @@ -4,9 +4,11 @@ name: Full Clients Audit on: push: - branches: [development, development_2.6] + branches: + - development pull_request: - branches: [development, development_2.6] + branches: + - development jobs: audit-and-open-issue: