Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shell script to generate build status for READMEs #258

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tools/makebadges.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
#
# Generates markdown for README build status badges.
#
# Copyright 2025 James E. King III <jking@apache.org>
#

set -eu

ARGS=$(getopt --longoptions "project:,appveyor:,codecov:,coverity:" "p:a:v:y:" -- "$@")

if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have some help text what the options are supposed to be?


eval set -- "$ARGS"

PROJECT=
APPVEYOR=
CODECOV=
COVERITY=

while true; do
case "${1:-*}" in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default of * looks odd, I'd use an empty value. But as any value works this is fine.

-p | --project) PROJECT="$2"; shift 2 ;;
-a | --appveyor) APPVEYOR="$2"; shift 2 ;;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be enough. For Boost.CI:
[![Build status](https://ci.appveyor.com/api/projects/status/ynnd2l3gu4oiyium/branch/master?svg=true)](https://ci.appveyor.com/project/Flamefire/boost-ci/branch/master)

So we need both the appveyor project owner and that hash/id-thing

-v | --codecov) CODECOV="$2"; shift 2 ;;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially for this we need to have a comment/help text which token is required here. I fear that some might leak their secret token if it isn't clear what this is.

-y | --coverity) COVERITY="$2"; shift 2 ;;
--) shift ;;
*) break ;;
esac
done

cat <<EOF
<!-- boost-ci/tools/makebadges.sh --project ${PROJECT} --appveyor ${APPVEYOR} --codecov ${CODECOV} --coverity ${COVERITY} -->
| Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
| :-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
| [\`master\`](https://github.com/boostorg/${PROJECT}/tree/master) | [![Build Status](https://github.com/boostorg/${PROJECT}/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/${PROJECT}/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/${APPVEYOR}/branch/master?svg=true)](https://ci.appveyor.com/project/cppalliance/${PROJECT//_/-}/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/${COVERITY}/badge.svg)](https://scan.coverity.com/projects/boostorg-${PROJECT}) | [![codecov](https://codecov.io/gh/boostorg/${PROJECT}/branch/master/graph/badge.svg?token=${CODECOV})](https://codecov.io/gh/boostorg/${PROJECT}/tree/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/${PROJECT}.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/${PROJECT}) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://www.boost.org/development/tests/master/developer/${PROJECT}.html)
| [\`develop\`](https://github.com/boostorg/${PROJECT}/tree/develop) | [![Build Status](https://github.com/boostorg/${PROJECT}/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/${PROJECT}/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/${APPVEYOR}/branch/develop?svg=true)](https://ci.appveyor.com/project/cppalliance/${PROJECT//_/-}/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/${COVERITY}/badge.svg)](https://scan.coverity.com/projects/boostorg-${PROJECT}) | [![codecov](https://codecov.io/gh/boostorg/${PROJECT}/branch/develop/graph/badge.svg?token=${CODECOV})](https://codecov.io/gh/boostorg/${PROJECT}/tree/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/${PROJECT}.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/${PROJECT}) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://www.boost.org/development/tests/develop/developer/${PROJECT}.html)
EOF

Loading