Skip to content

Commit

Permalink
Integrate with GitHub Actions (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti authored Jul 26, 2024
1 parent f5d9a82 commit 052e446
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Intelligence.AI SchemaHub

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref_type }}
cancel-in-progress: false

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: intelligence-ai/jsonschema@v2.6.0
- uses: actions/checkout@v4
- run: make
- run: ./scripts/no-uncommitted-changes.sh
13 changes: 13 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Intelligence.AI SchemaHub

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: intelligence-ai/jsonschema@v2.6.0
- uses: actions/checkout@v4
- run: make
- run: ./scripts/no-uncommitted-changes.sh
2 changes: 1 addition & 1 deletion scripts/collections-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ OUTPUT="$2"

echo "-- Fetching collections from $DIRECTORY into $OUTPUT" 1>&2

find "$DIRECTORY" -name '*.json' -type f -depth 2 | while IFS= read -r collection
find "$DIRECTORY" -mindepth 2 -maxdepth 2 -name '*.json' -type f | while IFS= read -r collection
do
NAMESPACE="$(basename "$(dirname "$collection")")"
ID="$(basename "$collection" .json)"
Expand Down
2 changes: 1 addition & 1 deletion scripts/collections-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ slugify() {

echo "-- Installing collection schemas from $DIRECTORY into $OUTPUT" 1>&2

find "$DIRECTORY" -name '*.json' -type f -depth 2 | while IFS= read -r collection
find "$DIRECTORY" -mindepth 2 -maxdepth 2 -name '*.json' -type f | while IFS= read -r collection
do
NAMESPACE="$(basename "$(dirname "$collection")")"
ID="$(basename "$collection" .json)"
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ copy_string_property_if_present() {
RESULT="$TMP/configuration.json"
jq --raw-output --null-input '$ARGS.named' --arg url "$BASE_URL" > "$RESULT"

find "$DIRECTORY" -name '*.json' -type f -depth 2 | while IFS= read -r collection
find "$DIRECTORY" -mindepth 2 -maxdepth 2 -name '*.json' -type f | while IFS= read -r collection
do

NAMESPACE="$(basename "$(dirname "$collection")")"
Expand All @@ -71,7 +71,7 @@ do
fi
done

find "$DIRECTORY" -name '*.json' -type f -depth 1 | while IFS= read -r manifest
find "$DIRECTORY" -mindepth 1 -maxdepth 1 -name '*.json' -type f | while IFS= read -r manifest
do
echo "-- Analyzing manifest $manifest" 1>&2
NAMESPACE="$(basename "$manifest" .json)"
Expand Down
11 changes: 11 additions & 0 deletions scripts/no-uncommitted-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

set -o errexit
set -o nounset

if [ -n "$(git status --porcelain)" ]
then
echo "ERROR: There are uncommitted changes" 1>&2
git diff
exit 1
fi

0 comments on commit 052e446

Please sign in to comment.