Skip to content

Commit

Permalink
chore: depedabot for all used ecosystems (#424)
Browse files Browse the repository at this point in the history
- add dependabot for all used ecosystems
- revisit doc gen scripts to make dependencies/maintenance more easily


---------

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Apr 10, 2024
1 parent 95c5820 commit 0f00800
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 34 deletions.
40 changes: 40 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,43 @@ updates:
prefix: 'chore' ## prefix maximum string length of 15
include: 'scope'
open-pull-requests-limit: 999
- package-ecosystem: 'maven'
directory: '/tools'
schedule:
interval: 'weekly'
day: 'saturday'
labels: [ 'dependencies' ]
commit-message:
prefix: 'chore' ## prefix maximum string length of 15
include: 'scope'
open-pull-requests-limit: 999
- package-ecosystem: 'composer'
directory: '/tools/src/test/php'
schedule:
interval: 'weekly'
day: 'saturday'
labels: [ 'dependencies' ]
commit-message:
prefix: 'chore' ## prefix maximum string length of 15
include: 'scope'
open-pull-requests-limit: 999
- package-ecosystem: 'npm'
directory: '/tools/src/test/js'
schedule:
interval: 'weekly'
day: 'saturday'
labels: [ 'dependencies' ]
commit-message:
prefix: 'chore' ## prefix maximum string length of 15
include: 'scope'
open-pull-requests-limit: 999
- package-ecosystem: 'pip'
directory: '/docgen/json'
schedule:
interval: 'weekly'
day: 'saturday'
labels: [ 'dependencies' ]
commit-message:
prefix: 'chore' ## prefix maximum string length of 15
include: 'scope'
open-pull-requests-limit: 999
11 changes: 6 additions & 5 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ jobs:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Setup Python Environment
# see https://github.com/actions/setup-python
uses: actions/setup-python@v5
- name: Set up JDK
# see https://github.com/actions/setup-java
uses: actions/setup-java@v4
with:
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
architecture: 'x64'
java-version: '21'
distribution: 'zulu'
java-package: jdk
- name: Generate Schema documentation
run: ./gen.sh
- name: Archive Schema documentation
Expand Down
57 changes: 39 additions & 18 deletions docgen/json/gen.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
#!/bin/bash
rm -f -R docs
mkdir -p docs/{1.2,1.3,1.4,1.5,1.6}
set -eu

THIS_PATH="$(realpath "$(dirname "$0")")"
SCHEMA_PATH="$(realpath "$THIS_PATH/../../schema")"
DOCS_PATH="$THIS_PATH/docs"
TEMPLATES_PATH="$THIS_PATH/templates"

rm -f -R "$DOCS_PATH"
mkdir -p "$DOCS_PATH/"{1.2,1.3,1.4,1.5,1.6}

# Check to see if generate-schema-doc is executable and is in the path. If not, install JSON Schema for Humans.
if ! [ -x "$(command -v generate-schema-doc)" ]; then
pip3 install json-schema-for-humans==0.47
if ! [ -x "$(command -v generate-schema-doc)" ]
then
# dependencies managed externally, so dependebot/renovate can pick it up
pip3 install -r "$THIS_PATH/requirements.txt"
fi

generate () {
version=$1
title='CycloneDX v'$version' JSON Reference'
echo Generating $title
STRICT_SCHEMA_FILE='../../schema/bom-'$version'-strict.schema.json'
if [ -f "$STRICT_SCHEMA_FILE" ]; then
SCHEMA_FILE='../../schema/bom-'$version'-strict.schema.json'
else
SCHEMA_FILE='../../schema/bom-'$version'.schema.json'
version="$1"
title="CycloneDX v${version} JSON Reference"
echo "Generating: $title"

SCHEMA_FILE="$SCHEMA_PATH/bom-${version}.schema.json"
STRICT_SCHEMA_FILE="$SCHEMA_PATH/bom-${version}-strict.schema.json"
if [ -f "$STRICT_SCHEMA_FILE" ]
then
SCHEMA_FILE="$STRICT_SCHEMA_FILE"
fi
echo $SCHEMA_FILE
generate-schema-doc --config no_link_to_reused_ref --config no_show_breadcrumbs --config no_collapse_long_descriptions --deprecated-from-description --config title="$title" --config custom_template_path=$(pwd)'/templates/cyclonedx/base.html' --minify $SCHEMA_FILE 'docs/'$version'/index.html'
sed -i -e "s/\${quotedTitle}/\"$title\"/g" 'docs/'$version'/index.html'
sed -i -e "s/\${title}/$title/g" 'docs/'$version'/index.html'
sed -i -e "s/\${version}/$version/g" 'docs/'$version'/index.html'
echo "$SCHEMA_FILE"

generate-schema-doc \
--config no_link_to_reused_ref \
--config no_show_breadcrumbs \
--config no_collapse_long_descriptions \
--deprecated-from-description \
--config title="$title" \
--config custom_template_path="$TEMPLATES_PATH/cyclonedx/base.html" \
--minify \
"$SCHEMA_FILE" \
"$DOCS_PATH/$version/index.html"

sed -i -e "s/\${quotedTitle}/\"$title\"/g" "$DOCS_PATH/$version/index.html"
sed -i -e "s/\${title}/$title/g" "$DOCS_PATH/$version/index.html"
sed -i -e "s/\${version}/$version/g" "$DOCS_PATH/$version/index.html"
}

generate 1.2
generate 1.3
generate 1.4
generate 1.5
generate 1.6
generate 1.6
1 change: 1 addition & 0 deletions docgen/json/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
json-schema-for-humans==0.47
29 changes: 22 additions & 7 deletions docgen/xml/gen.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
#!/bin/bash
set -eu

THIS_PATH="$(realpath "$(dirname "$0")")"
SCHEMA_PATH="$(realpath "$THIS_PATH/../../schema")"
DOCS_PATH="$THIS_PATH/docs"

SAXON_JAR='Saxon-HE-9.9.1-8.jar'

rm -f -R docs
if [ ! -f "Saxon-HE-9.9.1-8.jar" ]; then
curl -O https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/9.9.1-8/Saxon-HE-9.9.1-8.jar
if [ ! -f "$THIS_PATH/$SAXON_JAR" ]; then
curl --output-dir "$THIS_PATH" -O \
"https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/9.9.1-8/$SAXON_JAR"
fi

generate () {
version=$1
title='CycloneDX v'$version' XML Reference'
echo Generating $title
java -jar Saxon-HE-9.9.1-8.jar -s:'../../schema/bom-'$version'.xsd' -xsl:xs3p.xsl -o:'./docs/'$version'/index.html' cycloneDxVersion="$version" title="$title"
version="$1"
title="CycloneDX v$version XML Reference"
echo "Generating: $title"

java -jar "$THIS_PATH/$SAXON_JAR" \
-s:"$SCHEMA_PATH/bom-${version}.xsd" \
-xsl:"$THIS_PATH/xs3p.xsl" \
-o:"$DOCS_PATH/$version/index.html" \
cycloneDxVersion="$version" \
title="$title"
}

generate 1.0
Expand All @@ -17,4 +32,4 @@ generate 1.2
generate 1.3
generate 1.4
generate 1.5
generate 1.6
generate 1.6
10 changes: 6 additions & 4 deletions tools/src/test/proto/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ TEST_RES_DIR='tools/src/test/resources'

REMOTE="https://github.com/${GITHUB_REPOSITORY:-CycloneDX/specification}.git"

BUF_IMAGE_VERSION='1.30.0'


## ----

Expand All @@ -28,7 +30,7 @@ function schema-lint () {
--volume "${ROOT_PATH}/${SCHEMA_DIR}:/workspace/${SCHEMA_DIR}:ro" \
--volume "${THIS_PATH}/buf_lint.yaml:/workspace/buf.yaml:ro" \
--workdir '/workspace' \
bufbuild/buf:1.30.0 \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
lint --path "$SCHEMA_DIR" \
--config 'buf.yaml' \
--error-format "$LOG_FORMAT"
Expand Down Expand Up @@ -59,7 +61,7 @@ function schema-breaking-version () {
--volume "${ROOT_PATH}/${SCHEMA_DIR}/${OLD}:/workspace/${SCHEMA_DIR_OLD}/${NEW}:ro" \
--volume "${THIS_PATH}/buf_breaking-version.yaml:/workspace/buf.yaml:ro" \
--workdir '/workspace' \
bufbuild/buf:1.30.0 \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
breaking "$SCHEMA_DIR" \
--against "$SCHEMA_DIR_OLD" \
--config 'buf.yaml' \
Expand Down Expand Up @@ -87,7 +89,7 @@ function schema-breaking-remote () {
--volume "${ROOT_PATH}/${SCHEMA_DIR}:/workspace/${SCHEMA_DIR}:ro" \
--volume "${THIS_PATH}/buf_breaking-remote.yaml:/workspace/buf.yaml:ro" \
--workdir '/workspace' \
bufbuild/buf:1.30.0 \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
breaking "$SCHEMA_DIR" \
--against "${REMOTE}#subdir=${SCHEMA_DIR}" \
--config 'buf.yaml' \
Expand All @@ -113,7 +115,7 @@ function schema-functional () {
--volume "${ROOT_PATH}/${SCHEMA_DIR}:/workspace/${SCHEMA_DIR}:ro" \
--volume "${FILE}:/workspace/test_res:ro" \
--workdir '/workspace' \
bufbuild/buf:1.30.0 \
bufbuild/buf:"$BUF_IMAGE_VERSION" \
convert "${SCHEMA_DIR}/${SCHEMA_FILE}" \
--type "$MESSAGE" \
--from 'test_res#format=txtpb' \
Expand Down

0 comments on commit 0f00800

Please sign in to comment.