From c4341290c4d626d0cc16c9c2002a4403108b6e76 Mon Sep 17 00:00:00 2001 From: Varad Gupta Date: Tue, 24 Sep 2024 15:29:13 +0530 Subject: [PATCH] fix: Implement workflows status check functions --- .github/workflows/lint-pr.yml | 11 +++-------- .github/workflows/release.yml | 12 ++++++++++++ .github/workflows/sync-keep-workflows.yml | 14 +++++++++++++ .github/workflows/test-docs.yml | 17 +++++++++++++++- .github/workflows/test-pr-e2e.yml | 24 +++++++++++++++++++++++ 5 files changed, 69 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index 2045027e4..52b32be20 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -41,15 +41,10 @@ jobs: header: pr-title-lint-error delete: true - # Log the result of linting - name: Log lint status - run: | - if [ "${{ steps.lint_pr_title.outputs.error_message }}" == "" ]; then - echo "Linting passed successfully!"; - else - echo "Linting failed with message: ${{ steps.lint_pr_title.outputs.error_message }}"; - fi - + if: ${{ success() && steps.lint_pr_title.outputs.error_message == '' }} + run: echo "PR title is valid" + links: runs-on: ubuntu-latest name: Validate PR to Issue link diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4020f083..8d7cbc237 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,10 @@ jobs: tag: true commit: true + - name: Check Release Status + if: ${{ success() }} + run: echo "Release was successfull." + - name: Open PR for release branch id: pr-step uses: peter-evans/create-pull-request@v6.1.0 @@ -40,6 +44,10 @@ jobs: body: "This PR contains the latest release changes." draft: false base: main + + - name: Check PR Creation Status + if: ${{ success() }} + run: echo "Pull request created successfully" - uses: peter-evans/enable-pull-request-automerge@v3 with: @@ -56,3 +64,7 @@ jobs: --title="v${{ steps.release-step.outputs.version }}" \ --target="release/${{ steps.release-step.outputs.version }}" \ --generate-notes + + - name: Check Release Creation Status + if: ${{ success() }} + run: echo "Release created successfully with tag" diff --git a/.github/workflows/sync-keep-workflows.yml b/.github/workflows/sync-keep-workflows.yml index 1681a1391..4d0f6fd3d 100644 --- a/.github/workflows/sync-keep-workflows.yml +++ b/.github/workflows/sync-keep-workflows.yml @@ -30,6 +30,20 @@ jobs: - name: Check out the repo uses: actions/checkout@v2 + - name: Check Checkout Status + if: ${{ success() }} + run: echo "Repository checked out successfully." + - name: Run Keep CLI run: | keep workflow apply -f examples/workflows + + - name: Check Keep CLI Status + if: ${{ success() }} + run: echo "Keep CLI command executed successfully." + + - name: Handle Keep CLI Failure + if: ${{ failure() }} + run: | + echo "Keep CLI command failed. Please check the logs for details." + exit 1 diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 7628a3423..77e230acd 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -21,9 +21,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + - name: Check Checkout Status + if: ${{ success() }} + run: echo "Repository checked out successfully." - uses: chartboost/ruff-action@v1 with: src: "./keep" + - name: Check Ruff Linter Status + if: ${{ success() }} + run: echo "Ruff linter ran successfully." - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: @@ -37,4 +43,13 @@ jobs: python3 docs_get_providers_list.py --validate; # Todo: validate if openapi schema is matching with the code - \ No newline at end of file + + - name: Check Documentation Validation Status + if: ${{ success() }} + run: echo "Documentation validation commands executed successfully." + + - name: Handle Documentation Validation Failure + if: ${{ failure() }} + run: | + echo "Documentation validation failed. Please check the logs for details." + exit 1 \ No newline at end of file diff --git a/.github/workflows/test-pr-e2e.yml b/.github/workflows/test-pr-e2e.yml index fa7bb31d6..3432e53cb 100644 --- a/.github/workflows/test-pr-e2e.yml +++ b/.github/workflows/test-pr-e2e.yml @@ -34,10 +34,18 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + + - name: Check Checkout Status + if: ${{ success() }} + run: echo "Repository checked out successfully." - uses: chartboost/ruff-action@v1 with: src: "./keep" + + - name: Check Ruff Linter Status + if: ${{ success() }} + run: echo "Ruff linter ran successfully." - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 @@ -59,13 +67,25 @@ jobs: - name: Install dependencies using poetry run: poetry install --no-interaction --no-root --with dev + + - name: Check Poetry Installation Status + if: ${{ success() }} + run: echo "Poetry dependencies installed successfully." - name: Install Playwright dependencies run: npx playwright install --with-deps + - name: Check Playwright Installation Status + if: ${{ success() }} + run: echo "Playwright dependencies installed successfully. + - name: Install playwright run: poetry run playwright install + - name: Check Playwright Installation Status + if: ${{ success() }} + run: echo "Playwright installed successfully." + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -127,6 +147,10 @@ jobs: - name: Run e2e tests and report coverage run: | poetry run coverage run --branch -m pytest -s tests/e2e_tests/ + + - name: Check E2E Test Status + if: ${{ success() }} + run: echo "E2E tests executed successfully." - name: Convert coverage results to JSON (for CodeCov support) run: poetry run coverage json --omit="keep/providers/*"