Allow factory methods to use generics, and to overload other factory … #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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@8ade135a41bc03ea155e62e844d188df1ea18608 # 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@8ade135a41bc03ea155e62e844d188df1ea18608 # 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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
- uses: ./.github/actions/setup-gradle-build | |
with: | |
additional-java-versions: ${{ matrix.jdk }} | |
- run: ./gradlew testOnJdk${{ matrix.jdk }} -PtestJdkVersion=${{ matrix.jdk }} |