aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build.yml86
-rw-r--r--.github/workflows/infer.yml49
-rwxr-xr-x.github/workflows/send_webhook_update.sh21
3 files changed, 114 insertions, 42 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3b6d0cbd..639d3965 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -3,18 +3,22 @@ name: Build
on:
push:
branches:
- - '*'
+ - "*"
paths-ignore:
- - 'README.md'
- - 'LICENSE'
- - '.gitignore'
+ - "README.md"
+ - "COPYING"
+ - "COPYING.LESSER"
+ - ".gitignore"
+ - "Update Notes"
pull_request:
branches:
- - '*'
+ - "*"
paths-ignore:
- - 'README.md'
- - 'LICENSE'
- - '.gitignore'
+ - "README.md"
+ - "COPYING"
+ - "COPYING.LESSER"
+ - ".gitignore"
+ - "Update Notes"
workflow_dispatch:
jobs:
build:
@@ -26,36 +30,36 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: Send discord notification
- id: sendmsg
- if: ${{ env.WEBHOOK_URL }}
- run: |
- ./.github/workflows/send_webhook_update.sh
- env:
- STATUS: WORKING
- - name: Set up JDK 8
- uses: actions/setup-java@v2
- with:
- java-version: 8
- distribution: zulu
- cache: gradle
- - name: Build with Gradle
- run: chmod +x ./gradlew && ./gradlew setupCIWorkspace build --no-daemon
- - uses: actions/upload-artifact@v2
- with:
- path: build/libs/*-dep.jar
- - name: Update discord notification
- if: ${{ env.WEBHOOK_URL && success() }}
- run: |
- ./.github/workflows/send_webhook_update.sh
- env:
- STATUS: SUCCESS
- MESSAGE_ID: ${{ steps.sendmsg.outputs.MESSAGE_ID }}
- - name: Update discord notification
- if: ${{ env.WEBHOOK_URL && failure() }}
- run: |
- ./.github/workflows/send_webhook_update.sh
- env:
- STATUS: FAILURE
- MESSAGE_ID: ${{ steps.sendmsg.outputs.MESSAGE_ID }}
+ - uses: actions/checkout@v2
+ - name: Send discord notification
+ id: sendmsg
+ if: ${{ env.WEBHOOK_URL }}
+ run: |
+ ./.github/workflows/send_webhook_update.sh
+ env:
+ STATUS: WORKING
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ java-version: 17
+ distribution: temurin
+ cache: gradle
+ - name: Build with Gradle
+ run: chmod +x ./gradlew && ./gradlew clean test remapJar --no-daemon
+ - uses: actions/upload-artifact@v2
+ with:
+ path: build/libs/*-dep.jar
+ - name: Update discord notification
+ if: ${{ env.WEBHOOK_URL && success() }}
+ run: |
+ ./.github/workflows/send_webhook_update.sh
+ env:
+ STATUS: SUCCESS
+ MESSAGE_ID: ${{ steps.sendmsg.outputs.MESSAGE_ID }}
+ - name: Update discord notification
+ if: ${{ env.WEBHOOK_URL && failure() }}
+ run: |
+ ./.github/workflows/send_webhook_update.sh
+ env:
+ STATUS: FAILURE
+ MESSAGE_ID: ${{ steps.sendmsg.outputs.MESSAGE_ID }}
diff --git a/.github/workflows/infer.yml b/.github/workflows/infer.yml
new file mode 100644
index 00000000..365e748b
--- /dev/null
+++ b/.github/workflows/infer.yml
@@ -0,0 +1,49 @@
+name: Infer
+
+on:
+ - pull_request
+ - workflow_dispatch
+jobs:
+ inferering:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ name: Checkout feature
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ - name: Set up JDK 17
+ uses: actions/setup-java@v2
+ with:
+ java-version: 17
+ distribution: temurin
+ cache: gradle
+ - name: Setup Infer
+ uses: srz-zumix/setup-infer@v1
+ - name: Run Infer on feature
+ run: |
+ echo On commit $(git log --pretty=%s -1)
+ mkdir -p ciwork
+ infer capture -- ./gradlew clean test --no-daemon
+ infer analyze
+ cp infer-out/report.json ciwork/report-feature.json
+ - uses: actions/checkout@v2
+ name: Checkout base
+ with:
+ ref: ${{ github.event.pull_request.base.sha }}
+ clean: false
+ - name: Run Infer on base
+ run: |
+ echo On commit $(git log --pretty=%s -1)
+ infer capture --reactive -- ./gradlew clean test --no-daemon
+ infer analyze --reactive
+ - name: Generate report
+ run: |
+ infer reportdiff --report-current ciwork/report-feature.json --report-previous infer-out/report.json
+ jq -r '.[] | select(.severity == "ERROR") | ("::error file="+.file +",line=" +(.line|tostring)+"::" + .qualifier)' <infer-out/differential/introduced.json
+ jq -r '.[] | select(.severity == "WARNING") | ("::warning file="+.file +",line=" +(.line|tostring)+"::" + .qualifier)' <infer-out/differential/introduced.json
+ fixcount=$(jq -r "length" <infer-out/differential/fixed.json)
+ unfixcount=$(jq -r "length" <infer-out/differential/introduced.json)
+ othercount=$(jq -r "length" <infer-out/differential/preexisting.json)
+ echo "This PR fixes $fixcount potential bug(s), introduces $unfixcount potential bug(s). (Total present in feature branch: $((unfixcount + othercount)))" >>$GITHUB_STEP_SUMMARY
+ [[ $unfixcount != 0 ]] && exit 1 || echo ok.
diff --git a/.github/workflows/send_webhook_update.sh b/.github/workflows/send_webhook_update.sh
index 56852159..f0eb0051 100755
--- a/.github/workflows/send_webhook_update.sh
+++ b/.github/workflows/send_webhook_update.sh
@@ -1,4 +1,23 @@
#!/bin/bash
+#
+# Copyright (C) 2022 NotEnoughUpdates contributors
+#
+# This file is part of NotEnoughUpdates.
+#
+# NotEnoughUpdates is free software: you can redistribute it
+# and/or modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
+#
+# NotEnoughUpdates is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+#
+
set -x
COLOR_SUCCESS=8040199
@@ -69,7 +88,7 @@ function make_request() {
curl -X $1 -H "Content-Type: multipart/form-data" -F "payload_json=$json" "$upload_arg" "$upload_name=@$to_upload" "$WEBHOOK_URL$2?wait=true"
}
-echo "Should replace message with id: $MESSAGE_ID"
+echo "Should replace message with id: <$MESSAGE_ID>"
if [ "$MESSAGE_ID" != "" ]; then
discord_output=$(make_request PATCH "/messages/$MESSAGE_ID")
RESULT=$?