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

Made the JSON valid #1

Closed
wants to merge 13 commits into from
48 changes: 43 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
name: SPDX validation
on: pull_request
on:
- pull_request
- push

jobs:
SPDX_Validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup

- name: Look for files that are not checked
run: |
find . \( -name '*.spdx' -o -name '*.json' \) \
-not -path './presentations/*' \
-not -path './tools-java/*' \
-not -path '*/spdx2.2/*' \
-not -path '*/spdx2.3/*' \
-not -path '*/spdx-3.0/*' | tee flist.txt

test "$(cat flist.txt | wc -l)" = "0"

- name: Update apt
run: |
sudo apt update -y

- name: Setup Java tools
run: |
sudo apt install -y default-jdk maven
git clone https://github.com/spdx/tools-java.git && cd tools-java
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
mvn clean install && cd ..

- name: Validate SPDX Documents

- name: Setup Python tools
run: |
python3 -m pip install -U pip
python3 -m pip install \
check-jsonschema \
pyshacl

- name: Validate SPDX 2.2 & SPDX 2.3 Documents
run: |
find . -name *.spdx -o -name *.json -exec echo {} \; -exec java -jar tools-java/target/tools-java-*-jar-with-dependencies.jar Verify {} \;
find . \( -path '*/spdx2.2/*' -o -path '*/spdx2.3/*' \) \( -name *.spdx -o -name *.json \) \
-exec echo {} \; \
-exec java -jar tools-java/target/tools-java-*-jar-with-dependencies.jar Verify {} \;

- name: Validate SPDX 3.0 Documents
run: |
SPDX30_SCHEMA_URL="https://spdx.org/schema/3.0.0/spdx-json-schema.json"
SPDX30_SHACL_URL="https://spdx.org/rdf/3.0.0/spdx-model.ttl"

for f in $(find . -type f -path '*/spdx-3.0/*.json'); do
echo "Checking $f..."
check-jsonschema -v --schemafile $SPDX30_SCHEMA_URL $f
pyshacl -s $SPDX30_SHACL_URL -e $SPDX30_SHACL_URL $f
done
Loading