forked from mpetuska/kmdc
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (108 loc) · 3.52 KB
/
check.yml
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Check
on:
workflow_dispatch:
workflow_call:
concurrency:
cancel-in-progress: true
group: check-${{ github.workflow }}-${{ github.head_ref || github.ref }}
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
jobs:
lint:
name: Lint the code
runs-on: ubuntu-latest
env:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
- name: Restore Gradle cache
id: cache-gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/yarn
~/.gradle/nodejs
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Run detekt
run: ./gradlew detektAll
- name: Make artifact location URIs relative
if: ${{ always() }}
continue-on-error: true
run: |
ls '${{ github.workspace }}/build/reports/detekt/'
cp '${{ github.workspace }}/build/reports/detekt/detekt.sarif' '${{ github.workspace }}/detekt.sarif.json'
echo "$(
jq --arg github_workspace ${{ github.workspace }} \
'. | ( .runs[].results[].locations[].physicalLocation.artifactLocation.uri |= if test($github_workspace) then .[($github_workspace | length | . + 1):] else . end )' \
'${{ github.workspace }}/detekt.sarif.json'
)" > '${{ github.workspace }}/detekt.sarif.json'
- uses: github/codeql-action/upload-sarif@v3
if: ${{ always() }}
with:
sarif_file: ${{ github.workspace }}/detekt.sarif.json
checkout_path: ${{ github.workspace }}
check:
name: Check on ${{ matrix.os.runner }}
runs-on: ${{ matrix.os.runner }}
defaults:
run:
shell: ${{ matrix.os.shell }}
strategy:
fail-fast: false
matrix:
os:
- runner: ubuntu-latest
shell: bash
separator: '/'
# - runner: macos-latest
# shell: bash
# separator: '/'
# - runner: windows-latest
# shell: msys2 {0}
# separator: '\'
steps:
- uses: msys2/setup-msys2@v2
if: ${{ runner.os == 'Windows' }}
with:
release: false
msystem: MINGW64
path-type: inherit
update: true
install: >-
curl
mingw-w64-x86_64-curl
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 11
- name: Restore Gradle cache
id: cache-gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/yarn
~/.gradle/nodejs
~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Gradle Check
run: ./gradlew check -x detekt -x detektAll --scan
- name: Gradle Test Local Publishing
run: ./gradlew publishToLocal --scan
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: reports-${{ runner.os }}
path: |
**${{ matrix.os.separator }}build${{ matrix.os.separator }}reports