Unverified Commit b84b650c authored by Daz DeBoer's avatar Daz DeBoer Committed by GitHub
Browse files

Merge pull request #130 from gradle/setup-gradle

Allow action to be used without Gradle execution
parents 367ce74a eda00387
Loading
Loading
Loading
Loading
+10 −10
Changes for .github/workflows/integTest-caching-config.yml: 10 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -11,8 +11,6 @@ env:
  GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

jobs:
  # Run initial Gradle builds to push initial cache entries
  # These builds should start fresh without cache hits, due to the seed injected into the cache key above.
  seed-build:
    strategy:
      matrix:
@@ -21,11 +19,9 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Build using Gradle wrapper
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test
        # Add "wrapper" to main cache entry and remove 'wrapper-zips' cache entry
        # Exclude build-cache from main cache entry
        gradle-home-cache-includes: |
@@ -41,6 +37,9 @@ jobs:
              ["instrumented-jars", "caches/jars-*/*/"],
              ["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"]
            ]
    - name: Build using Gradle wrapper
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test

  # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
  verify-build:
@@ -52,13 +51,10 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build with --offline
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --offline
        cache-read-only: true
        # Need the same configuration when restoring state from cache
        # Use the same configuration when restoring state from cache
        gradle-home-cache-includes: |
            caches
            notifications
@@ -72,5 +68,9 @@ jobs:
              ["instrumented-jars", "caches/jars-*/*/"],
              ["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"]
            ]
        cache-read-only: true
    - name: Execute Gradle build with --offline
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --offline

+26 −27
Changes for .github/workflows/integTest-caching-configuration-cache.yml: 26 added lines, 27 removed lines.
Original line number Diff line number Diff line
@@ -21,19 +21,16 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Build with configuration-cache enabled
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --configuration-cache
    - name: Second build with configuration-cache enabled
      uses: ./
      with:
        build-root-directory: __tests__/samples/kotlin-dsl
        arguments: test --configuration-cache
    - name: Groovy build with configuration-cache enabled
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --configuration-cache
    - name: Kotlin build with configuration-cache enabled
      working-directory: __tests__/samples/kotlin-dsl
      run: ./gradlew test --configuration-cache

  # Test restore configuration-cache
  configuration-cache:
  configuration-cache-groovy:
    needs: seed-build
    strategy:
      matrix:
@@ -42,17 +39,18 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build and verify cached configuration
    - name: Setup Gradle
      uses: ./
      env: 
        VERIFY_CACHED_CONFIGURATION: true
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --configuration-cache
        cache-read-only: true
    - name: Execute Gradle build and verify cached configuration
      env: 
        VERIFY_CACHED_CONFIGURATION: true
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --configuration-cache

  # Test restore configuration-cache from second build invocation
  configuration-cache-2:
  # Test restore configuration-cache from the second build invocation
  configuration-cache-kotlin:
    needs: seed-build
    strategy:
      matrix:
@@ -61,14 +59,15 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build and verify cached configuration
    - name: Setup Gradle
      uses: ./
      env: 
        VERIFY_CACHED_CONFIGURATION: true
      with:
        build-root-directory: __tests__/samples/kotlin-dsl
        arguments: test --configuration-cache
        cache-read-only: true
    - name: Execute Gradle build and verify cached configuration
      env: 
        VERIFY_CACHED_CONFIGURATION: true
      working-directory: __tests__/samples/kotlin-dsl
      run: ./gradlew test --configuration-cache

  # Check that the build can run when no extracted cache entries are restored
  no-extracted-cache-entries-restored:
@@ -80,11 +79,11 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build with no cache extracted cache entries restored
    - name: Setup Gradle with no cache extracted cache entries restored
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --configuration-cache
        cache-read-only: true
        gradle-home-extracted-cache-entries: '[]'
    - name: Check execute Gradle build with configuration cache enabled (but not restored)
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --configuration-cache
+16 −15
Changes for .github/workflows/integTest-caching-gradle-home.yml: 16 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -10,8 +10,6 @@ env:
  GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}-

jobs:
  # Run initial Gradle builds to push initial cache entries
  # These builds should start fresh without cache hits, due to the seed injected into the cache key above.
  seed-build:
    strategy:
      matrix:
@@ -20,11 +18,11 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Build using Gradle wrapper
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test
    - name: Build using Gradle wrapper
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test

  # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
  dependencies-cache:
@@ -36,12 +34,13 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build with --offline
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --offline
        cache-read-only: true
    - name: Execute Gradle build with --offline
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --offline

  # Test that the gradle-user-home cache will cache and restore local build-cache
  build-cache:
@@ -53,12 +52,13 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build and verify tasks from cache
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test -DverifyCachedBuild=true
        cache-read-only: true
    - name: Execute Gradle build and verify tasks from cache
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test -DverifyCachedBuild=true

  # Check that the build can run when Gradle User Home is not fully restored
  no-extracted-cache-entries-restored:
@@ -70,11 +70,12 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build with no extracted cache entries restored
    - name: Setup Gradle with no extracted cache entries restored
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test
        cache-read-only: true
        gradle-home-extracted-cache-entries: '[]'
    - name: Check executee Gradle build
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test
+43
Changes for .github/workflows/integTest-execution-with-caching.yml: 43 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: Test save/restore Gradle state with direct execution

on:
  pull_request:
    types: [assigned, review_requested]
  push:
  workflow_dispatch:

env:
  GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}-

jobs:
  seed-build:
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Exucute Gradle build
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test

  # Test that the gradle-user-home is restored
  verify-build:
    needs: seed-build
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build
      uses: ./
      with:
        cache-read-only: true
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --offline -DverifyCachedBuild=true
+13 −11
Changes for .github/workflows/integTest-gradle-user-home.yml: 13 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ on:

env:
  GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}-
  GRADLE_USER_HOME: custom/gradle/home
  GRADLE_USER_HOME: ${{github.workspace}}/custom/gradle/home

jobs:
  # Run initial Gradle builds to push initial cache entries
@@ -21,11 +21,11 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Build using Gradle wrapper
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test
    - name: Build using Gradle wrapper
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --info

  # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
  dependencies-cache:
@@ -37,12 +37,13 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build with --offline
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test --offline
        cache-read-only: true
    - name: Execute Gradle build with --offline
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test --offline --info

  # Test that the gradle-user-home cache will cache and restore local build-cache
  build-cache:
@@ -54,9 +55,10 @@ jobs:
    steps:
    - name: Checkout sources
      uses: actions/checkout@v2
    - name: Execute Gradle build and verify tasks from cache
    - name: Setup Gradle
      uses: ./
      with:
        build-root-directory: __tests__/samples/groovy-dsl
        arguments: test -DverifyCachedBuild=true
        cache-read-only: true
    - name: Execute Gradle build and verify tasks from cache
      working-directory: __tests__/samples/groovy-dsl
      run: ./gradlew test -DverifyCachedBuild=true --info
Loading