From 046b8076b269d405897406e65a90dd0459ab312d Mon Sep 17 00:00:00 2001 From: Sathnindu Kottage <45420836+sathninduk@users.noreply.github.com> Date: Sat, 5 Oct 2024 02:55:17 +0530 Subject: [PATCH] Adding Verita workflow --- .github/workflows/verita.yml | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/verita.yml diff --git a/.github/workflows/verita.yml b/.github/workflows/verita.yml new file mode 100644 index 0000000..f0c2942 --- /dev/null +++ b/.github/workflows/verita.yml @@ -0,0 +1,56 @@ + +name: Verita - Formal Specification + +on: + push: + branches: + - main # Run on main branch + pull_request: + types: [opened, synchronize, reopened] + +jobs: + openjml: + name: Run OpenJML + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + - name: Download OpenJML + run: | + sudo wget https://github.com/OpenJML/OpenJML/releases/download/0.21.0-alpha-0/openjml-ubuntu-22.04-0.21.0-alpha-0.zip -O /openjml-ubuntu-22.04-0.21.0-alpha-0.zip + sudo unzip /openjml-ubuntu-22.04-0.21.0-alpha-0.zip -d /OpenJML-0.21.0-alpha-0 + - name: Verify OpenJML installation + run: | + echo $PATH + /OpenJML-0.21.0-alpha-0/openjml -version + - name: clone git repo + run: | + git clone https://github.com/sathninduk/Java-Health-System src + cd src + - name: Identify Latest Changes + run: | + git log --name-only --pretty="" -n 1 + - name: Run OpenJML and save logs + run: | + shopt -s globstar + /OpenJML-0.21.0-alpha-0/openjml -esc -progress ./src/**/*.java ./src/*.java 2>&1 | tee openjml.log + echo "Logs have been saved to $(pwd)/openjml.log" + - name: Send OpenJML logs to verita + run: | + REPO_NAME=$(echo $GITHUB_REPOSITORY) + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + COMMIT_ID=$(git rev-parse --short HEAD) + FILE_NAME="log_${GITHUB_REPOSITORY//\//_}_${BRANCH_NAME}_${COMMIT_ID}.log" + sudo curl --location 'https://verita-logger-api.dpacks.net' \ + --header 'x-api-key: 248frv384' \ + --form "filename=${FILE_NAME}" \ + --form "repository=${REPO_NAME}" \ + --form "branch=main" \ + --form "commit_id=${COMMIT_ID}" \ + --form "file=@$(pwd)/openjml.log"