forked from pinterest/ktlint
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (81 loc) · 3.08 KB
/
pull-request-with-code.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
# name must be identical to name of 'pull-request-without-code'
name: Pull request
on:
push:
branches: ['master']
paths:
- '**/*.kt'
- '**/*.kts'
- '**/*.properties'
- '**/*.toml'
pull_request:
paths:
- '**/*.kt'
- '**/*.kts'
- '**/*.properties'
- '**/*.toml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
ORG_GRADLE_PROJECT_signingKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
CLI_TEST_MAX_DURATION_IN_SECONDS: 10
# Note that all "jobs" (build, tests) including "jobs.*.runs-on" should be kept in sync with "pull-request-without-code"
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: "[build] OS=${{ matrix.os }} Kotlin=stable"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: ./.github/actions/setup-gradle-build
- name: Build with release Kotlin version
run: ./gradlew ktlintCheck build
- name: Check `data class`es are not part of public API
run: |
found=0
# Loop through all .api files in the current directory and subdirectories
for file in $(find . -type f -name "*.api" ! -path "*/build/*"); do
# Check if the file contains the 'data class' specific text
if grep -q "public static synthetic fun copy$default" "$file"; then
echo "public 'data class' found in: $file"
found=1
fi
done
if [ $found -eq 0 ]; then
exit 0
else
echo "data classes found in one or more .api files. Visit https://github.com/pinterest/ktlint/issues/2133 for more details"
exit 1
fi
shell: bash
build-dev:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: "[build] OS=${{ matrix.os }}, Kotlin=dev"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: ./.github/actions/setup-gradle-build
- name: Build with assemble Kotlin version
run: ./gradlew -PkotlinDev ktlintCheck build
tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
jdk: [8, 11, 17] # list of Java versions to run tests against (excluding `java-compilation` version for which tests already have run during `build` job)
runs-on: ${{ matrix.os }}
name: "[tests] OS=${{ matrix.os }}, Java=${{ matrix.jdk }}"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: ./.github/actions/setup-gradle-build
with:
additional-java-versions: ${{ matrix.jdk }}
- run: ./gradlew testOnJdk${{ matrix.jdk }} -PtestJdkVersion=${{ matrix.jdk }}