compliance: Fix file report upload (#53425)

Applies https://github.com/zed-industries/zed/pull/53424 to the main
branch

Release Notes:

- N/A
This commit is contained in:
Finn Evers authored and GitHub committed 2026-04-09 08:27:30 +02:00
1 parent 91b0ea270d
commit aac50b9fb9
4 files changed
+40 -52

No files matched your search

+4 -5
View File
@@ -36,18 +36,17 @@ jobs:
- id: run-compliance-check
name: compliance_check::scheduled_compliance_check::run_compliance_check
run: |
echo "tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
cargo xtask compliance "$LATEST_TAG" --branch main --report-path compliance-report
cargo xtask compliance "$LATEST_TAG" --branch main --report-path "compliance-report-${GITHUB_REF_NAME}.md"
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: '@actions/upload-artifact compliance-report.md'
- name: '@actions/upload-artifact compliance-report-${GITHUB_REF_NAME}.md'
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: compliance-report.md
path: target/compliance-report.md
name: compliance-report-${GITHUB_REF_NAME}.md
path: compliance-report-${GITHUB_REF_NAME}.md
if-no-files-found: error
- name: send_compliance_slack_notification
if: always()
+13 -12
View File
@@ -307,19 +307,19 @@ jobs:
cache: rust
path: ~/.rustup
- id: run-compliance-check
name: release::compliance_check::run_compliance_check
name: release::run_compliance_check
run: |
cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report
cargo xtask compliance "$GITHUB_REF_NAME" --report-path "compliance-report-${GITHUB_REF_NAME}.md"
env:
GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
continue-on-error: true
- name: '@actions/upload-artifact compliance-report.md'
- name: '@actions/upload-artifact compliance-report-${GITHUB_REF_NAME}.md'
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: compliance-report.md
path: target/compliance-report.md
name: compliance-report-${GITHUB_REF_NAME}.md
path: compliance-report-${GITHUB_REF_NAME}.md
if-no-files-found: error
- name: send_compliance_slack_notification
if: always()
@@ -672,19 +672,20 @@ jobs:
with:
cache: rust
path: ~/.rustup
- id: run-post-upload-compliance-check
name: release::validate_release_assets::run_post_upload_compliance_check
- id: run-compliance-check
name: release::run_compliance_check
run: |
cargo xtask compliance "$GITHUB_REF_NAME" --report-path compliance-report
cargo xtask compliance "$GITHUB_REF_NAME" --report-path "compliance-report-${GITHUB_REF_NAME}.md"
env:
GITHUB_APP_ID: ${{ secrets.ZED_ZIPPY_APP_ID }}
GITHUB_APP_KEY: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
- name: '@actions/upload-artifact compliance-report.md'
continue-on-error: true
- name: '@actions/upload-artifact compliance-report-${GITHUB_REF_NAME}.md'
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: compliance-report.md
path: target/compliance-report.md
name: compliance-report-${GITHUB_REF_NAME}.md
path: compliance-report-${GITHUB_REF_NAME}.md
if-no-files-found: error
overwrite: true
- name: send_compliance_slack_notification
@@ -703,7 +704,7 @@ jobs:
"$SLACK_WEBHOOK"
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}
COMPLIANCE_OUTCOME: ${{ steps.run-post-upload-compliance-check.outcome }}
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
auto_release_preview:
@@ -2,7 +2,10 @@ use gh_workflow::{Event, Job, Run, Schedule, Step, Workflow, WorkflowDispatch};
use indoc::formatdoc;
use crate::tasks::workflows::{
release::{COMPLIANCE_REPORT_PATH, ComplianceContext, add_compliance_notification_steps},
release::{
COMPLIANCE_REPORT_PATH, COMPLIANCE_STEP_ID, ComplianceContext,
add_compliance_notification_steps,
},
runners,
steps::{self, CommonJobConditions, named},
vars::{self, StepOutput},
@@ -37,12 +40,11 @@ fn scheduled_compliance_check() -> steps::NamedJob {
fn run_compliance_check(tag: &StepOutput) -> Step<Run> {
named::bash(
formatdoc! {r#"
echo "tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
cargo xtask compliance "$LATEST_TAG" --branch main --report-path {COMPLIANCE_REPORT_PATH}
cargo xtask compliance "$LATEST_TAG" --branch main --report-path "{COMPLIANCE_REPORT_PATH}"
"#,
}
)
.id("run-compliance-check")
.id(COMPLIANCE_STEP_ID)
.add_env(("LATEST_TAG", tag.to_string()))
.add_env(("GITHUB_APP_ID", vars::ZED_ZIPPY_APP_ID))
.add_env(("GITHUB_APP_KEY", vars::ZED_ZIPPY_APP_PRIVATE_KEY))
@@ -61,6 +63,5 @@ fn scheduled_compliance_check() -> steps::NamedJob {
ComplianceContext::Scheduled {
tag_source: tag_output,
},
"run-compliance-check",
))
}
+17 -30
View File
@@ -151,8 +151,8 @@ pub(crate) fn create_sentry_release() -> Step<Use> {
.add_with(("environment", "production"))
}
pub(crate) const COMPLIANCE_REPORT_PATH: &str = "compliance-report";
const COMPLIANCE_REPORT_FILE: &str = "target/compliance-report.md";
pub(crate) const COMPLIANCE_REPORT_PATH: &str = "compliance-report-${GITHUB_REF_NAME}.md";
pub(crate) const COMPLIANCE_STEP_ID: &str = "run-compliance-check";
const NEEDS_REVIEW_PULLS_URL: &str = "https://github.com/zed-industries/zed/pulls?q=is%3Apr+is%3Aclosed+label%3A%22PR+state%3Aneeds+review%22";
pub(crate) enum ComplianceContext {
@@ -164,9 +164,8 @@ pub(crate) enum ComplianceContext {
pub(crate) fn add_compliance_notification_steps(
job: gh_workflow::Job,
context: ComplianceContext,
compliance_step_id: &str,
) -> gh_workflow::Job {
let upload_step = upload_artifact(COMPLIANCE_REPORT_FILE)
let upload_step = upload_artifact(COMPLIANCE_REPORT_PATH)
.if_condition(Expression::new("always()"))
.when(matches!(context, ComplianceContext::Release), |step| {
step.add_with(("overwrite", true))
@@ -203,7 +202,7 @@ pub(crate) fn add_compliance_notification_steps(
.add_env(("SLACK_WEBHOOK", vars::SLACK_WEBHOOK_WORKFLOW_FAILURES))
.add_env((
"COMPLIANCE_OUTCOME",
format!("${{{{ steps.{compliance_step_id}.outcome }}}}"),
format!("${{{{ steps.{COMPLIANCE_STEP_ID}.outcome }}}}"),
))
.add_env((
"COMPLIANCE_TAG",
@@ -222,18 +221,18 @@ pub(crate) fn add_compliance_notification_steps(
job.add_step(upload_step).add_step(notification_step)
}
fn compliance_check() -> NamedJob {
fn run_compliance_check() -> Step<Run> {
named::bash(formatdoc! {r#"
cargo xtask compliance "$GITHUB_REF_NAME" --report-path {COMPLIANCE_REPORT_PATH}
"#,
})
.id("run-compliance-check")
.add_env(("GITHUB_APP_ID", vars::ZED_ZIPPY_APP_ID))
.add_env(("GITHUB_APP_KEY", vars::ZED_ZIPPY_APP_PRIVATE_KEY))
.continue_on_error(true)
}
fn run_compliance_check() -> Step<Run> {
named::bash(formatdoc! {r#"
cargo xtask compliance "$GITHUB_REF_NAME" --report-path "{COMPLIANCE_REPORT_PATH}"
"#,
})
.id(COMPLIANCE_STEP_ID)
.add_env(("GITHUB_APP_ID", vars::ZED_ZIPPY_APP_ID))
.add_env(("GITHUB_APP_KEY", vars::ZED_ZIPPY_APP_PRIVATE_KEY))
.continue_on_error(true)
}
fn compliance_check() -> NamedJob {
let job = release_job(&[])
.runs_on(runners::LINUX_SMALL)
.add_step(
@@ -247,7 +246,6 @@ fn compliance_check() -> NamedJob {
named::job(add_compliance_notification_steps(
job,
ComplianceContext::ReleaseNonBlocking,
"run-compliance-check",
))
}
@@ -273,31 +271,20 @@ fn validate_release_assets(deps: &[&NamedJob]) -> NamedJob {
"#,
};
fn run_post_upload_compliance_check() -> Step<Run> {
named::bash(formatdoc! {r#"
cargo xtask compliance "$GITHUB_REF_NAME" --report-path {COMPLIANCE_REPORT_PATH}
"#,
})
.id("run-post-upload-compliance-check")
.add_env(("GITHUB_APP_ID", vars::ZED_ZIPPY_APP_ID))
.add_env(("GITHUB_APP_KEY", vars::ZED_ZIPPY_APP_PRIVATE_KEY))
}
let job = dependant_job(deps)
.runs_on(runners::LINUX_SMALL)
.add_step(named::bash(&validation_script).add_env(("GITHUB_TOKEN", vars::GITHUB_TOKEN)))
.add_step(
steps::checkout_repo()
.with_full_history()
.with_ref("${{ github.ref }}"),
.with_ref(Context::github().ref_()),
)
.add_step(steps::cache_rust_dependencies_namespace())
.add_step(run_post_upload_compliance_check());
.add_step(run_compliance_check());
named::job(add_compliance_notification_steps(
job,
ComplianceContext::Release,
"run-post-upload-compliance-check",
))
}