From 0489e264e302b15376d43e8d39e2c8eeb753700d Mon Sep 17 00:00:00 2001 From: Xiwen Cheng Date: Fri, 12 Apr 2024 23:29:37 +0200 Subject: [PATCH] Improve CI --- .github/workflows/ci.yml | 12 ++++++++++-- run-policy-tests.sh | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc2d1b2..74a5d74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/run-policy-tests.sh b/run-policy-tests.sh index fc0f536..3c530dd 100755 --- a/run-policy-tests.sh +++ b/run-policy-tests.sh @@ -4,9 +4,22 @@ 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