From df4dc040de5d5aa237f5c104d78bb0b5f45f3009 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 1 Nov 2023 20:51:21 -0500 Subject: [PATCH] Run both stable and preview ecosystem checks (#8422) Closes https://github.com/astral-sh/ruff/issues/8076 Follow-up to #8358 Doubles the amount of ecosystem checks we do, adding separate groups for the stable sections. We're likely to run into GitHub comment length restrictions if there are significant deviations. However, it should not be common for changes in stable and preview to occur at the same time, nor should it be common for linter and formatter changes to occur at the same time. --- .github/workflows/ci.yaml | 51 ++++++++++++++++++++++++++----- .github/workflows/pr-comment.yaml | 4 +-- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 657760fb21..f49d3bfc32 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -209,7 +209,7 @@ jobs: run: | pip install ./python/ruff-ecosystem - - name: Run `ruff check` ecosystem check + - name: Run `ruff check` stable ecosystem check if: ${{ needs.determine_changes.outputs.linter == 'true' }} run: | # Make executable, since artifact download doesn't preserve this @@ -218,13 +218,30 @@ jobs: # Set pipefail to avoid hiding errors with tee set -eo pipefail - ruff-ecosystem check ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check + ruff-ecosystem check ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-check-stable - cat ecosystem-result-check > $GITHUB_STEP_SUMMARY - cat ecosystem-result-check > ecosystem-result + cat ecosystem-result-check-stable > $GITHUB_STEP_SUMMARY + echo "### Linter (stable)" > ecosystem-result + cat ecosystem-result-check-stable >> ecosystem-result echo "" >> ecosystem-result - - name: Run `ruff format` ecosystem check + - name: Run `ruff check` preview ecosystem check + if: ${{ needs.determine_changes.outputs.linter == 'true' }} + run: | + # Make executable, since artifact download doesn't preserve this + chmod +x ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff + + # Set pipefail to avoid hiding errors with tee + set -eo pipefail + + ruff-ecosystem check ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-check-preview + + cat ecosystem-result-check-preview > $GITHUB_STEP_SUMMARY + echo "### Linter (preview)" >> ecosystem-result + cat ecosystem-result-check-preview >> ecosystem-result + echo "" >> ecosystem-result + + - name: Run `ruff format` stable ecosystem check if: ${{ needs.determine_changes.outputs.formatter == 'true' }} run: | # Make executable, since artifact download doesn't preserve this @@ -233,10 +250,28 @@ jobs: # Set pipefail to avoid hiding errors with tee set -eo pipefail - ruff-ecosystem format ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format + ruff-ecosystem format ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown | tee ecosystem-result-format-stable - cat ecosystem-result-format > $GITHUB_STEP_SUMMARY - cat ecosystem-result-format >> ecosystem-result + cat ecosystem-result-format-stable > $GITHUB_STEP_SUMMARY + echo "### Formatter (stable)" >> ecosystem-result + cat ecosystem-result-format-stable >> ecosystem-result + echo "" >> ecosystem-result + + - name: Run `ruff format` preview ecosystem check + if: ${{ needs.determine_changes.outputs.formatter == 'true' }} + run: | + # Make executable, since artifact download doesn't preserve this + chmod +x ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff + + # Set pipefail to avoid hiding errors with tee + set -eo pipefail + + ruff-ecosystem format ./ruff ${{ steps.ruff-target.outputs.download-path }}/ruff --cache ./checkouts --output-format markdown --force-preview | tee ecosystem-result-format-preview + + cat ecosystem-result-format-preview > $GITHUB_STEP_SUMMARY + echo "### Formatter (preview)" >> ecosystem-result + cat ecosystem-result-format-preview >> ecosystem-result + echo "" >> ecosystem-result - name: Export pull request number run: | diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml index f6ac19dcb0..a7d77d0ec8 100644 --- a/.github/workflows/pr-comment.yaml +++ b/.github/workflows/pr-comment.yaml @@ -48,9 +48,7 @@ jobs: id: generate-comment if: steps.download-ecosystem-result.outputs.found_artifact == 'true' run: | - echo '## PR Check Results' >> comment.txt - - echo "### Ecosystem" >> comment.txt + echo '## `ruff-ecosystem` results' >> comment.txt cat pr/ecosystem/ecosystem-result >> comment.txt echo "" >> comment.txt