Skip to content

Wrong AppVeyor badge #693

@dtolnay

Description

@dtolnay

https://crates.io/crates/serde is showing a badge from:

https://ci.appveyor.com/api/projects/status/github/serde-rs/serde?svg=true&branch=master

The link is correct and shows that the build is passing, but the badge says "unknown".

AppVeyor tells me to use the following badge:

https://ci.appveyor.com/api/projects/status/avsuce1irt8h63u2/branch/master?svg=true

Unclear how this is generated but it would be nice if I could have crates.io show the correct badge.

Implementation steps added by @carols10cents:

  • Add an id field with type Option<String> to the Appveyor badge enum variant
  • Add id: alias('badge.attributes.id') to the appveyor badge component
  • Add an image-url attribute, computed from the id to the appveyor badge component that checks to see if id is defined; if it is, return https://ci.appveyor.com/api/projects/status/{{ id }}/branch/{{ branch }}?svg=true. If not, return https://ci.appveyor.com/api/projects/status/{{ service }}/{{ repository }}?svg=true&branch={{ branch }} (that's what the appveyor badge template currently uses for the image src)
    • I've used handlebars interpolation here but you should use js interpolation, I'm being lazy sorry sorry!
  • Change the appveyor badge template to use the image-url attribute for the img src instead
  • Publish a crate to your local instance that has the URLs dtolnay has listed for serde and manually verify the badge is displayed correctly (we used to have frontend tests for badge tests but they got deleted?)
  • Send a pull request to cargo to update the badge documentation to indicate you can specify the appveyor project id if you want to use that instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions