Skip to content

Commit

Permalink
CT
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Feb 23, 2024
1 parent 8503f10 commit 96a4a63
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test_proto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: CT ProtoBuf

on:
push:
branches: ['master', 'main']
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout
# see https://github.com/actions/checkout
uses: actions/checkout@v4
- name: run tests
run: tools/src/test/proto-test.sh
Empty file added proto-test/*.textproto
Empty file.
34 changes: 29 additions & 5 deletions tools/src/test/proto-test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
#!/usr/bin/env bash
mkdir -p proto-test
for filename in resources/1.3/*.textproto;
do
protoc --proto_path=../../../schema/ --encode=cyclonedx.v1_3.Bom bom-1.3-SNAPSHOT.proto < $filename | protoc --proto_path=../../../schema/ --decode=cyclonedx.v1_3.Bom bom-1.3-SNAPSHOT.proto > proto-test/${filename##*/}
done;
set -ex

if [[ -n "$CI" ]]
then
LOG_FORMAT="github-actions"
else
LOG_FORMAT="json"
fi

# lint protobuf schema files
docker run \
--volume "$(pwd):/workspace" \
--workdir /workspace \
bufbuild/buf:1.29.0 \
lint --error-format "$LOG_FORMAT"

# check protobuf schema files for breaking changes
# docker run \
# --volume "$(pwd):/workspace" \
# --workdir /workspace \
# bufbuild/buf:1.29.0 \
# breaking

# test all examples against the schema files
# mkdir -p proto-test
# for filename in resources/1.3/*.textproto;
# do
# protoc --proto_path=../../../schema/ --encode=cyclonedx.v1_3.Bom bom-1.3-SNAPSHOT.proto < $filename | protoc --proto_path=../../../schema/ --decode=cyclonedx.v1_3.Bom bom-1.3-SNAPSHOT.proto > proto-test/${filename##*/}
# done

0 comments on commit 96a4a63

Please sign in to comment.