Fix pre-commit hook path handling for subdirectories #1471
Workflow file for this run
This file contains hidden or 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: Build and check | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-jvm-matrix: | |
| runs-on: ubuntu-latest | |
| steps: # https://michaelheap.com/dynamic-matrix-generation-github-actions/ | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| endoflife.date:443 | |
| - id: set-matrix | |
| run: echo "version_matrix=$(curl https://endoflife.date/api/oracle-jdk.json | jq -c '[.[] | select(.extendedSupport > (now | strftime("%Y-%m-%d"))) | .cycle]' | sed 's/ //g')" >> $GITHUB_OUTPUT | |
| - name: verify-matrix | |
| run: echo "The selected java versions are ${{ steps.set-matrix.outputs.version_matrix }}" | |
| outputs: | |
| version_matrix: ${{ steps.set-matrix.outputs.version_matrix }} | |
| test-jvm: | |
| needs: build-jvm-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| java_version: ${{ fromJson(needs.build-jvm-matrix.outputs.version_matrix) }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.azul.com:443 | |
| cdn.azul.com:443 | |
| dl.google.com:443 | |
| github.com:443 | |
| plugins-artifacts.gradle.org:443 | |
| plugins.gradle.org:443 | |
| release-assets.githubusercontent.com:443 | |
| repo.maven.apache.org:443 | |
| scans-in.gradle.com:443 | |
| services.gradle.org:443 | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: configure windows pagefile | |
| if: ${{ matrix.os == 'windows-latest' }} | |
| uses: al-cheb/configure-pagefile-action@9b6da52fb72a3c6147c1aad2df22d8d905681adc # v1.5 | |
| with: | |
| minimum-size: 8GB | |
| maximum-size: 8GB | |
| disk-root: "D:" | |
| - name: set up JDK | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| java-version: | | |
| ${{ matrix.java_version }} | |
| 21 | |
| distribution: 'zulu' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| - name: Restore TestKit cache | |
| # Inspired by https://github.com/actions/cache/issues/432#issuecomment-740376179 | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| plugin/.gradle-test-kit/caches/modules-2 | |
| plugin/.gradle-test-kit/caches/files-2.1 | |
| plugin/.gradle-test-kit/caches/metadata-2.96 | |
| key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}- | |
| ${{ runner.os }}-gradle-wrapper- | |
| - name: Test Plugin | |
| run: ./plugin/gradlew -p ./plugin test${{ matrix.java_version }} --no-daemon | |
| - name: Upload test results | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: failure() | |
| with: | |
| name: test-results-${{ runner.os }}-java-${{ matrix.java_version }} | |
| path: plugin/build/reports/tests/test/ | |
| - name: Upload Memory Dump | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: failure() | |
| with: | |
| name: memory-dump-${{ runner.os }} | |
| path: | | |
| hs_err_pid* | |
| replay_pid* | |
| plugin/hs_err_pid* | |
| plugin/replay_pid* | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.azul.com:443 | |
| cdn.azul.com:443 | |
| dl.google.com:443 | |
| github.com:443 | |
| plugins-artifacts.gradle.org:443 | |
| plugins.gradle.org:443 | |
| release-assets.githubusercontent.com:443 | |
| repo.maven.apache.org:443 | |
| scans-in.gradle.com:443 | |
| services.gradle.org:443 | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: set up JDK | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| java-version: 21 | |
| cache: 'gradle' | |
| distribution: 'zulu' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| with: | |
| cache-overwrite-existing: true | |
| - name: Restore TestKit cache | |
| # Inspired by https://github.com/actions/cache/issues/432#issuecomment-740376179 | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| plugin/.gradle-test-kit/caches/modules-2 | |
| plugin/.gradle-test-kit/caches/files-2.1 | |
| plugin/.gradle-test-kit/caches/metadata-2.96 | |
| key: gradle-wrapper-${{ hashFiles('**/gradlew') }}-${{ github.sha }} | |
| restore-keys: | | |
| gradle-wrapper-${{ hashFiles('**/gradlew') }}- | |
| gradle-wrapper- | |
| - name: Check Plugin | |
| run: ./plugin/gradlew -p ./plugin build --no-daemon | |
| - name: Upload test results | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: failure() | |
| with: | |
| name: test-results | |
| path: plugin/build/reports/tests/test/ | |
| - name: Check plugin codestyle | |
| run: ./plugin/gradlew -p ./plugin ktlintCheck --no-daemon | |
| check_bashisms: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.azul.com:443 | |
| azure.archive.ubuntu.com:80 | |
| cdn.azul.com:443 | |
| dl.google.com:443 | |
| esm.ubuntu.com:443 | |
| github.com:443 | |
| packages.microsoft.com:443 | |
| plugins-artifacts.gradle.org:443 | |
| plugins.gradle.org:443 | |
| release-assets.githubusercontent.com:443 | |
| repo.maven.apache.org:443 | |
| scans-in.gradle.com:443 | |
| services.gradle.org:443 | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: set up JDK 11 | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| java-version: 11 | |
| distribution: 'zulu' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| - name: update apt | |
| run: sudo apt update | |
| - name: Install lintian | |
| run: sudo apt install -qq lintian | |
| - name: Install libdistro | |
| run: sudo apt install -qq libdistro-info-perl | |
| - name: Install checkbashisms | |
| run: sudo apt-get install -qq devscripts | |
| - name: Check git bashisms | |
| run: ./gradlew compileKotlin addKtlintCheckGitPreCommitHook --no-daemon && checkbashisms .git/hooks/pre-commit | |
| check_samples: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.azul.com:443 | |
| cdn.azul.com:443 | |
| dl.google.com:443 | |
| github.com:443 | |
| plugins-artifacts.gradle.org:443 | |
| plugins.gradle.org:443 | |
| release-assets.githubusercontent.com:443 | |
| repo.maven.apache.org:443 | |
| scans-in.gradle.com:443 | |
| services.gradle.org:443 | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: set up JDK 21 | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| java-version: 21 | |
| distribution: 'zulu' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| - name: Check ktlint-plugin on samples | |
| run: ./gradlew ktlintCheck --no-daemon --stacktrace | |
| - name: Generate and submit dependency graph | |
| uses: gradle/actions/dependency-submission@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| with: | |
| dependency-graph: generate-and-upload | |
| check_release: | |
| name: Test Release Pipeline | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.azul.com:443 | |
| api.github.com:443 | |
| cdn.azul.com:443 | |
| dl.google.com:443 | |
| github.com:443 | |
| plugins-artifacts.gradle.org:443 | |
| plugins.gradle.org:443 | |
| release-assets.githubusercontent.com:443 | |
| repo.maven.apache.org:443 | |
| scans-in.gradle.com:443 | |
| services.gradle.org:443 | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Base Release Environment Setup | |
| uses: ./.github/actions/base-release | |
| - name: Verify Release Pipeline | |
| env: | |
| GITHUB_KEY: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| ./plugin/gradlew \ | |
| -p ./plugin \ | |
| -DdryRun=true \ | |
| -x test \ | |
| devSnapshot \ | |
| validatePlugins \ | |
| githubRelease |