1
+ name : Pull Request
2
+
3
+ on :
4
+ pull_request :
5
+
6
+ jobs :
7
+ lint :
8
+ name : Lint Kotlin
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - name : Checkout Repository
12
+ uses : actions/checkout@v2
13
+
14
+ - name : Set up JDK 17
15
+ uses : actions/setup-java@v2
16
+ with :
17
+ distribution : ' temurin'
18
+ java-version : 17
19
+
20
+ - name : Run lintKotlin
21
+ uses : gradle/gradle-build-action@v2
22
+ with :
23
+ arguments : lintKotlin --scan
24
+
25
+ - name : Collect KtLint Result
26
+ if : ${{ failure() }}
27
+ continue-on-error : true
28
+ env :
29
+ REVIEWDOG_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30
+ run : |
31
+ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s
32
+ ./gradlew lintKotlin || true
33
+ git stash -u && git stash drop || true
34
+ ./bin/reviewdog -name="ktlint" -f=diff -f.diff.strip=1 -reporter="github-pr-review" < "${TMPFILE}"
35
+ cat ${{ github.workspace }}/build/reports/ktlint/main-lint.xml | ./bin/reviewdog -f=checkstyle -name="ktlint" -reporter="github-pr-review" -level="error" -filter-mode="added" -fail-on-error="false"
36
+
37
+ build :
38
+ name : Build Project
39
+ runs-on : ubuntu-latest
40
+ steps :
41
+ - name : Checkout Repository
42
+ uses : actions/checkout@v2
43
+
44
+ - name : Set up JDK 17
45
+ uses : actions/setup-java@v2
46
+ with :
47
+ distribution : ' temurin'
48
+ java-version : 17
49
+
50
+ - name : Run build
51
+ uses : gradle/gradle-build-action@v2
52
+ with :
53
+ arguments : build --scan
54
+
55
+ - name : " Add build scan URL as PR comment"
56
+ uses : actions/github-script@v5
57
+ if : failure()
58
+ with :
59
+ github-token : ${{secrets.GITHUB_TOKEN}}
60
+ script : |
61
+ github.rest.issues.createComment({
62
+ issue_number: context.issue.number,
63
+ owner: context.repo.owner,
64
+ repo: context.repo.repo,
65
+ body: '❌ ${{ github.workflow }} failed: ${{ steps.gradle.outputs.build-scan-url }}'
66
+ })
67
+
68
+ test :
69
+ name : Run Tests
70
+ runs-on : ubuntu-latest
71
+ steps :
72
+ - name : Checkout Repository
73
+ uses : actions/checkout@v2
74
+
75
+ - name : Set up JDK 17
76
+ uses : actions/setup-java@v2
77
+ with :
78
+ distribution : ' temurin'
79
+ java-version : 17
80
+
81
+ - name : Run tests
82
+ uses : gradle/gradle-build-action@v2
83
+ with :
84
+ arguments : test --scan
85
+
86
+ - name : Publish Test Results
87
+ uses : mikepenz/action-junit-report@v2
88
+ with :
89
+ github_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments