Check if configuration cache works #4927
Workflow file for this run
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
# This file was generated using Kotlin DSL (.github/workflows/build.main.kts). | |
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file. | |
# Generated with https://github.com/typesafegithub/github-workflows-kt | |
name: 'Build' | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: {} | |
jobs: | |
check_yaml_consistency: | |
name: 'Check YAML consistency' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- id: 'step-0' | |
name: 'Check out' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
name: 'Execute script' | |
run: 'rm ''.github/workflows/build.yaml'' && ''.github/workflows/build.main.kts''' | |
- id: 'step-2' | |
name: 'Consistency check' | |
run: 'git diff --exit-code ''.github/workflows/build.yaml''' | |
build-for-UbuntuLatest: | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'check_yaml_consistency' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
uses: 'actions/cache@v4' | |
with: | |
path: 'buildSrc/build' | |
key: 'gradle-buildSrc-build-dir-${{ runner.os }}' | |
- id: 'step-2' | |
name: 'Set up JDK' | |
uses: 'actions/setup-java@v4' | |
with: | |
java-version: '11' | |
distribution: 'zulu' | |
- id: 'step-3' | |
uses: 'gradle/actions/setup-gradle@v4' | |
with: | |
cache-encryption-key: '${{ secrets.GRADLE_ENCRYPTION_KEY }}' | |
- id: 'step-4' | |
name: 'Build' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
run: './gradlew build' | |
build-for-Windows2022: | |
runs-on: 'windows-2022' | |
needs: | |
- 'check_yaml_consistency' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
uses: 'actions/cache@v4' | |
with: | |
path: 'buildSrc/build' | |
key: 'gradle-buildSrc-build-dir-${{ runner.os }}' | |
- id: 'step-2' | |
name: 'Set up JDK' | |
uses: 'actions/setup-java@v4' | |
with: | |
java-version: '11' | |
distribution: 'zulu' | |
- id: 'step-3' | |
uses: 'gradle/actions/setup-gradle@v4' | |
with: | |
cache-encryption-key: '${{ secrets.GRADLE_ENCRYPTION_KEY }}' | |
- id: 'step-4' | |
name: 'Build' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
run: './gradlew build' | |
publish-snapshot: | |
name: 'Publish snapshot' | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'check_yaml_consistency' | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: '${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}' | |
ORG_GRADLE_PROJECT_sonatypePassword: '${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}' | |
if: '${{ github.ref == ''refs/heads/main'' }}' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
name: 'Set up JDK' | |
uses: 'actions/setup-java@v4' | |
with: | |
java-version: '11' | |
distribution: 'zulu' | |
- id: 'step-2' | |
uses: 'gradle/actions/setup-gradle@v4' | |
- id: 'step-3' | |
name: 'Check if snapshot version is set' | |
run: './gradlew setIsSnapshotFlagInGithubOutput' | |
- id: 'step-4' | |
name: 'Publish '':shared-internal'' to Sonatype' | |
run: './gradlew :shared-internal:publishToSonatype --no-configuration-cache' | |
if: '${{ steps.step-3.outputs.is-snapshot == ''true'' }}' | |
- id: 'step-5' | |
name: 'Publish '':github-workflows-kt'' to Sonatype' | |
run: './gradlew :github-workflows-kt:publishToSonatype --no-configuration-cache' | |
if: '${{ steps.step-3.outputs.is-snapshot == ''true'' }}' | |
- id: 'step-6' | |
name: 'Publish '':action-binding-generator'' to Sonatype' | |
run: './gradlew :action-binding-generator:publishToSonatype --no-configuration-cache' | |
if: '${{ steps.step-3.outputs.is-snapshot == ''true'' }}' | |
- id: 'step-7' | |
name: 'Publish '':action-updates-checker'' to Sonatype' | |
run: './gradlew :action-updates-checker:publishToSonatype --no-configuration-cache' | |
if: '${{ steps.step-3.outputs.is-snapshot == ''true'' }}' | |
build_docs: | |
name: 'Build docs' | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'check_yaml_consistency' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
uses: 'actions/setup-python@v5' | |
with: | |
python-version: '3.8' | |
- id: 'step-2' | |
run: 'pip install -r docs/requirements.txt' | |
- id: 'step-3' | |
run: 'mkdocs build --site-dir public' | |
build_kotlin_scripts: | |
name: 'Build Kotlin scripts' | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'check_yaml_consistency' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
run: |- | |
find -name *.main.kts -print0 | while read -d $'\0' file | |
do | |
# This script requires extra steps before it can be compiled, i.e. publishing | |
# the library to Maven Local. It's handled by the consistency check in this workflow. | |
if [ "$file" = "./.github/workflows/end-to-end-tests.main.kts" ]; then | |
continue | |
fi | |
echo "Compiling $file..." | |
kotlinc -Werror -Xallow-any-scripts-in-source-roots -Xuse-fir-lt=false "$file" | |
done | |
workflows_consistency_check: | |
name: 'Run consistency check on all GitHub workflows' | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'check_yaml_consistency' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
name: 'Set up Java in proper version' | |
uses: 'actions/setup-java@v4' | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
cache: 'gradle' | |
- id: 'step-2' | |
run: 'cd .github/workflows' | |
- id: 'step-3' | |
name: 'Regenerate all workflow YAMLs' | |
run: |- | |
find -name "*.main.kts" -print0 | while read -d $'\0' file | |
do | |
# This script requires extra steps before it can be compiled, i.e. publishing | |
# the library to Maven Local. It's handled by the consistency check in this workflow. | |
if [ "$file" = "./.github/workflows/end-to-end-tests.main.kts" ]; then | |
continue | |
fi | |
if [ -x "$file" ]; then | |
echo "Regenerating $file..." | |
($file) | |
fi | |
done | |
- id: 'step-4' | |
name: 'Check if some file is different after regeneration' | |
run: 'git diff --exit-code .' |