diff options
author | David Cole <40234707+DavidArthurCole@users.noreply.github.com> | 2024-09-26 03:56:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 09:56:44 +0200 |
commit | 092a29dd8b13c2b04b0b7c259446ab697201dd5e (patch) | |
tree | f3704e259d34bfccef083834cb9106578695a694 /.github | |
parent | e90fd65559ef551b29de7d28f4fea3a46cc2a4e6 (diff) | |
download | skyhanni-092a29dd8b13c2b04b0b7c259446ab697201dd5e.tar.gz skyhanni-092a29dd8b13c2b04b0b7c259446ab697201dd5e.tar.bz2 skyhanni-092a29dd8b13c2b04b0b7c259446ab697201dd5e.zip |
Backend: Dekekt (#2547)
Co-authored-by: Linnea Gräf <nea@nea.moe>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to '.github')
-rw-r--r-- | .github/actions/setup-normal-workspace/action.yml | 13 | ||||
-rw-r--r-- | .github/scripts/process_detekt_sarif.sh | 37 | ||||
-rw-r--r-- | .github/workflows/build.yml | 42 | ||||
-rw-r--r-- | .github/workflows/check-style.yaml.disabled | 16 |
4 files changed, 74 insertions, 34 deletions
diff --git a/.github/actions/setup-normal-workspace/action.yml b/.github/actions/setup-normal-workspace/action.yml new file mode 100644 index 000000000..a0781d53c --- /dev/null +++ b/.github/actions/setup-normal-workspace/action.yml @@ -0,0 +1,13 @@ +name: 'Setup Java, Gradle and check out the source code' + +runs: + using: composite + steps: + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + cache: gradle + - name: Setup gradle + uses: gradle/actions/setup-gradle@v4 diff --git a/.github/scripts/process_detekt_sarif.sh b/.github/scripts/process_detekt_sarif.sh new file mode 100644 index 000000000..7fb4f7e4e --- /dev/null +++ b/.github/scripts/process_detekt_sarif.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# This script processes the Detekt SARIF file and outputs results in a format +# suitable for annotation in CI/CD systems. + +SARIF_FILE="$1" + +# Check if SARIF file exists +if [ ! -f "$SARIF_FILE" ]; then + echo "SARIF file not found: $SARIF_FILE" + exit 1 +fi + +# Define jq command to parse SARIF file +read -r -d '' jq_command <<'EOF' +.runs[].results[] | +{ + "full_path": .locations[].physicalLocation.artifactLocation.uri | sub("file://$(pwd)/"; ""), + "file_name": (.locations[].physicalLocation.artifactLocation.uri | split("/") | last), + "l": .locations[].physicalLocation, + "level": .level, + "message": .message.text, + "ruleId": .ruleId +} | +( + "::" + (.level) + + " file=" + (.full_path) + + ",line=" + (.l.region.startLine|tostring) + + ",title=" + (.ruleId) + + ",col=" + (.l.region.startColumn|tostring) + + ",endColumn=" + (.l.region.endColumn|tostring) + + "::" + (.message.text) +) +EOF + +# Run jq command to format the output +jq -r "$jq_command" < "$SARIF_FILE" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c75f0eef..7e42909ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,15 +18,9 @@ jobs: runs-on: ubuntu-latest name: "Build and test" steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: 21 - distribution: temurin - cache: gradle - - name: Setup gradle - uses: gradle/gradle-build-action@v2 + - name: Checkout code + uses: actions/checkout@v4 + - uses: ./.github/actions/setup-normal-workspace - name: Build with Gradle run: ./gradlew assemble -x test --stacktrace - uses: actions/upload-artifact@v3 @@ -42,19 +36,31 @@ jobs: with: name: "Test Results" path: versions/1.8.9/build/reports/tests/test/ + #detekt: + # name: Run detekt + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # - uses: ./.github/actions/setup-normal-workspace + # - name: Run detekt + # run: | + # ./gradlew detekt --stacktrace + # - name: Annotate detekt failures + # if: ${{ !cancelled() }} + # run: | + # chmod +x .github/scripts/process_detekt_sarif.sh + # ./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/detekt.sarif + + preprocess: runs-on: ubuntu-latest name: "Build multi version" steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: 21 - distribution: temurin - cache: gradle - - name: Setup gradle - uses: gradle/gradle-build-action@v2 + - name: Checkout code + uses: actions/checkout@v4 + - uses: ./.github/actions/setup-normal-workspace - name: Enable preprocessor run: | mkdir -p .gradle diff --git a/.github/workflows/check-style.yaml.disabled b/.github/workflows/check-style.yaml.disabled deleted file mode 100644 index ff172208f..000000000 --- a/.github/workflows/check-style.yaml.disabled +++ /dev/null @@ -1,16 +0,0 @@ -name: check-style -on: - - pull_request -jobs: - ktlint: - name: Check Style - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - name: Checkout code - - name: ktlint - uses: ScaCap/action-ktlint@master - with: - github_token: ${{ secrets.github_token }} - reporter: github-pr-check |