aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: bae846e078e4becc7d43db483ea09de0e9802e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build

on:
    push:
        branches:
            - "*"
        paths-ignore:
            - ".gitignore"
    pull_request:
        branches:
            - "*"
        paths-ignore:
            - ".gitignore"
    workflow_dispatch:
permissions: write-all
jobs:
    build:
        runs-on: ubuntu-latest
        name: "Build and test"
        steps:
            -   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
                name: Upload development build
                with:
                    name: "Development Build"
                    path: build/libs/*.jar
            -   name: Test with Gradle
                run: ./gradlew test
            -   uses: actions/upload-artifact@v3
                name: "Upload test report"
                if: ${{ !cancelled() }}
                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
                run: |
                    read -r -d '' jq_command <<'EOF'
                    .runs[].results[] |
                    {
                        "l": .locations[].physicalLocation,
                        "level": .level,
                        "message":.message,
                        "ruleId":.ruleId
                    } |
                    (
                        "::" + (.level) +
                        " file=" + ( .l.artifactLocation.uri | sub("file://$(pwd)/"; ""))
                        + ",line=" + (.l.region.startLine|tostring)
                        + ",endLine=" + (.l.region.endLine|tostring)
                        + ",col=" + (.l.region.startColumn|tostring)
                        + ",endColumn=" + (.l.region.endColumn|tostring)
                        + ",title=" + (.ruleId) + "::" + (.message.text))
                    EOF
                    jq -r "$jq_command" < versions/1.8.9/build/reports/detekt/detekt.sarif
    

    preprocess:
        runs-on: ubuntu-latest
        name: "Build multi version"
        steps:
            -   name: Checkout code
                uses: actions/checkout@v4
            -   uses: ./.github/actions/setup-normal-workspace
            -   name: Enable preprocessor
                run: |
                    mkdir -p .gradle
                    echo skyhanni.multi-version=preprocess-only > .gradle/private.properties
            -   name: Build with Gradle
                run: ./gradlew build --stacktrace