Skip to content

Add configuration setting for constant names in property-naming rule #907

Add configuration setting for constant names in property-naming rule

Add configuration setting for constant names in property-naming rule #907

# 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/setup-gradle-build
with:
additional-java-versions: ${{ matrix.jdk }}
- run: ./gradlew testOnJdk${{ matrix.jdk }} -PtestJdkVersion=${{ matrix.jdk }}