Skip to content

Commit

Permalink
Improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
xiwenc committed Apr 12, 2024
1 parent 4d01992 commit 4bdd3c4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ on:

jobs:

build:
Policies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Test Policies
run: ./run-policy-tests.sh

CLI:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -26,7 +34,7 @@ jobs:
run: go test -v ./...

- name: xunit-report
run: ./bin/mendix-cli lint --xunit-report report.xml
run: ./bin/mendix-cli lint --xunit-report report.xml || true

- name: Process xunit-report
uses: dorny/test-reporter@v1
Expand Down
18 changes: 15 additions & 3 deletions run-policy-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@ set -e

OPA="./bin/opa"

UNAME="$(uname -s)"
echo "OS: $UNAME"

if [ "$UNAME" = "Linux" ]; then
OPA_DL="opa_linux_amd64"
elif [ "$UNAME" = "Darwin" ]; then
OPA_DL="opa_darwin_amd64"
else
echo "Unsupported OS"
exit 1
fi

if [ ! -f "$OPA" ]; then
echo "Program not found, downloading..."
curl -L -o "$OPA" https://openpolicyagent.org/downloads/v0.63.0/opa_darwin_amd64
mkdir -p bin
curl -L -o "$OPA" "https://openpolicyagent.org/downloads/v0.63.0/$OPA_DL"
chmod +x "$OPA"
fi

OPA test -v policies

$OPA test -v policies

0 comments on commit 4bdd3c4

Please sign in to comment.