ci: Add workflow dispatch trigger for compliance workflow (#53327)
Also refines the reporting a bit. Release Notes: - N/A
This commit is contained in:
1 parent
bdbad56f03
commit
92413ba605
4 files changed
+203
-143
No files matched your search
@@ -6,6 +6,7 @@ env:
|
||||
on:
|
||||
schedule:
|
||||
- cron: 30 17 * * 2
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
scheduled_compliance_check:
|
||||
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
|
||||
@@ -34,22 +35,44 @@ jobs:
|
||||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||
- id: run-compliance-check
|
||||
name: compliance_check::scheduled_compliance_check::run_compliance_check
|
||||
run: cargo xtask compliance "$LATEST_TAG" --branch main --report-path target/compliance-report
|
||||
run: |
|
||||
echo "tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
||||
cargo xtask compliance "$LATEST_TAG" --branch main --report-path compliance-report
|
||||
env:
|
||||
LATEST_TAG: ${{ steps.determine-version.outputs.tag }}
|
||||
GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
|
||||
GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
|
||||
- name: compliance_check::scheduled_compliance_check::send_failure_slack_notification
|
||||
if: failure()
|
||||
- name: '@actions/upload-artifact compliance-report.md'
|
||||
if: always()
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
|
||||
with:
|
||||
name: compliance-report.md
|
||||
path: target/compliance-report.md
|
||||
if-no-files-found: error
|
||||
- name: send_compliance_slack_notification
|
||||
if: always()
|
||||
run: |
|
||||
MESSAGE="⚠️ Scheduled compliance check failed for upcoming preview release $LATEST_TAG: There are PRs with missing reviews."
|
||||
REPORT_CONTENT=""
|
||||
if [ -f "target/compliance-report.md" ]; then
|
||||
REPORT_CONTENT=$(cat "target/compliance-report.md")
|
||||
fi
|
||||
|
||||
if [ "$COMPLIANCE_OUTCOME" == "success" ]; then
|
||||
STATUS="✅ Scheduled compliance check passed for $COMPLIANCE_TAG"
|
||||
else
|
||||
STATUS="⚠️ Scheduled compliance check failed for $COMPLIANCE_TAG"
|
||||
fi
|
||||
|
||||
MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22" "$REPORT_CONTENT")
|
||||
|
||||
curl -X POST -H 'Content-type: application/json' \
|
||||
--data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \
|
||||
"$SLACK_WEBHOOK"
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}
|
||||
LATEST_TAG: ${{ steps.determine-version.outputs.tag }}
|
||||
COMPLIANCE_OUTCOME: ${{ steps.run-compliance-check.outcome }}
|
||||
COMPLIANCE_TAG: ${{ steps.determine-version.outputs.tag }}
|
||||
ARTIFACT_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts
|
||||
defaults:
|
||||
run:
|
||||
shell: bash -euxo pipefail {0}
|
||||
@@ -295,9 +295,7 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
compliance_check:
|
||||
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
|
||||
runs-on: namespace-profile-16x32-ubuntu-2204
|
||||
env:
|
||||
COMPLIANCE_FILE_PATH: compliance.md
|
||||
runs-on: namespace-profile-2x4-ubuntu-2404
|
||||
steps:
|
||||
- name: steps::checkout_repo
|
||||
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
||||
@@ -312,25 +310,33 @@ jobs:
|
||||
path: ~/.rustup
|
||||
- id: run-compliance-check
|
||||
name: release::compliance_check::run_compliance_check
|
||||
run: cargo xtask compliance "$GITHUB_REF_NAME" --report-path "$COMPLIANCE_FILE_OUTPUT"
|
||||
run: |
|
||||
cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report
|
||||
env:
|
||||
GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
|
||||
GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
|
||||
- name: release::compliance_check::send_compliance_slack_notification
|
||||
- name: '@actions/upload-artifact compliance-report.md'
|
||||
if: always()
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
|
||||
with:
|
||||
name: compliance-report.md
|
||||
path: target/compliance-report.md
|
||||
if-no-files-found: error
|
||||
- name: send_compliance_slack_notification
|
||||
if: always()
|
||||
run: |
|
||||
if [ "$COMPLIANCE_OUTCOME" == "success" ]; then
|
||||
STATUS="✅ Compliance check passed for $GITHUB_REF_NAME"
|
||||
else
|
||||
STATUS="❌ Compliance check failed for $GITHUB_REF_NAME"
|
||||
fi
|
||||
|
||||
REPORT_CONTENT=""
|
||||
if [ -f "$COMPLIANCE_FILE_OUTPUT" ]; then
|
||||
REPORT_CONTENT=$(cat "$REPORT_FILE")
|
||||
if [ -f "target/compliance-report.md" ]; then
|
||||
REPORT_CONTENT=$(cat "target/compliance-report.md")
|
||||
fi
|
||||
|
||||
MESSAGE=$(printf "%s\n\n%s" "$STATUS" "$REPORT_CONTENT")
|
||||
if [ "$COMPLIANCE_OUTCOME" == "success" ]; then
|
||||
STATUS="✅ Compliance check passed for $COMPLIANCE_TAG"
|
||||
else
|
||||
STATUS="❌ Compliance check failed for $COMPLIANCE_TAG"
|
||||
fi
|
||||
|
||||
MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22" "$REPORT_CONTENT")
|
||||
|
||||
curl -X POST -H 'Content-type: application/json' \
|
||||
--data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \
|
||||
@@ -338,6 +344,9 @@ jobs:
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}
|
||||
COMPLIANCE_OUTCOME: ${{ steps.run-compliance-check.outcome }}
|
||||
COMPLIANCE_TAG: ${{ github.ref_name }}
|
||||
ARTIFACT_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts
|
||||
timeout-minutes: 60
|
||||
bundle_linux_aarch64:
|
||||
needs:
|
||||
- run_tests_linux
|
||||
@@ -671,32 +680,42 @@ jobs:
|
||||
path: ~/.rustup
|
||||
- id: run-post-upload-compliance-check
|
||||
name: release::validate_release_assets::run_post_upload_compliance_check
|
||||
run: cargo xtask compliance "$GITHUB_REF_NAME" --report-path target/compliance-report
|
||||
run: |
|
||||
cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report
|
||||
env:
|
||||
GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
|
||||
GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
|
||||
- name: release::validate_release_assets::send_post_upload_compliance_notification
|
||||
- name: '@actions/upload-artifact compliance-report.md'
|
||||
if: always()
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
|
||||
with:
|
||||
name: compliance-report.md
|
||||
path: target/compliance-report.md
|
||||
if-no-files-found: error
|
||||
- name: send_compliance_slack_notification
|
||||
if: always()
|
||||
run: |
|
||||
if [ -z "$COMPLIANCE_OUTCOME" ] || [ "$COMPLIANCE_OUTCOME" == "skipped" ]; then
|
||||
echo "Compliance check was skipped, not sending notification"
|
||||
exit 0
|
||||
REPORT_CONTENT=""
|
||||
if [ -f "target/compliance-report.md" ]; then
|
||||
REPORT_CONTENT=$(cat "target/compliance-report.md")
|
||||
fi
|
||||
|
||||
TAG="$GITHUB_REF_NAME"
|
||||
|
||||
if [ "$COMPLIANCE_OUTCOME" == "success" ]; then
|
||||
MESSAGE="✅ Post-upload compliance re-check passed for $TAG"
|
||||
STATUS="✅ Compliance check passed for $COMPLIANCE_TAG"
|
||||
else
|
||||
MESSAGE="❌ Post-upload compliance re-check failed for $TAG"
|
||||
STATUS="❌ Compliance check failed for $COMPLIANCE_TAG"
|
||||
fi
|
||||
|
||||
MESSAGE=$(printf "%s\n\nReport: %s\nPRs needing review: %s\n\n%s" "$STATUS" "$ARTIFACT_URL" "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22" "$REPORT_CONTENT")
|
||||
|
||||
curl -X POST -H 'Content-type: application/json' \
|
||||
--data "$(jq -n --arg text "$MESSAGE" '{"text": $text}')" \
|
||||
"$SLACK_WEBHOOK"
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}
|
||||
COMPLIANCE_OUTCOME: ${{ steps.run-post-upload-compliance-check.outcome }}
|
||||
COMPLIANCE_TAG: ${{ github.ref_name }}
|
||||
ARTIFACT_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts
|
||||
auto_release_preview:
|
||||
needs:
|
||||
- validate_release_assets
|
||||
|
||||
Reference in new issue
Block a user