mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Add test for action in containerized runner
This commit is contained in:
		
							
								
								
									
										5
									
								
								.github/workflows/ci-full-check.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/ci-full-check.yml
									
									
									
									
										vendored
									
									
								
							@@ -48,6 +48,11 @@ jobs:
 | 
			
		||||
    with:
 | 
			
		||||
      cache-key-prefix: ${{github.run_number}}-
 | 
			
		||||
 | 
			
		||||
  restore-containerized-gradle-home:
 | 
			
		||||
    uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
 | 
			
		||||
    with:
 | 
			
		||||
      cache-key-prefix: ${{github.run_number}}-
 | 
			
		||||
 | 
			
		||||
  restore-gradle-home:
 | 
			
		||||
    uses: ./.github/workflows/integ-test-restore-gradle-home.yml
 | 
			
		||||
    with:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								.github/workflows/ci-quick-check.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/workflows/ci-quick-check.yml
									
									
									
									
										vendored
									
									
								
							@@ -55,11 +55,16 @@ jobs:
 | 
			
		||||
      runner-os: '["ubuntu-latest"]'
 | 
			
		||||
      download-dist: true
 | 
			
		||||
 | 
			
		||||
  restore-containerized-gradle-home:
 | 
			
		||||
    needs: build-distribution
 | 
			
		||||
    uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
 | 
			
		||||
    with:
 | 
			
		||||
      download-dist: true
 | 
			
		||||
 | 
			
		||||
  restore-custom-gradle-home:
 | 
			
		||||
    needs: build-distribution
 | 
			
		||||
    uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
 | 
			
		||||
    with:
 | 
			
		||||
      runner-os: '["ubuntu-latest"]'
 | 
			
		||||
      download-dist: true
 | 
			
		||||
 | 
			
		||||
  restore-gradle-home:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										60
									
								
								.github/workflows/integ-test-restore-containerized-gradle-home.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								.github/workflows/integ-test-restore-containerized-gradle-home.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
name: Test restore custom Gradle Home
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  workflow_call:
 | 
			
		||||
    inputs:
 | 
			
		||||
      cache-key-prefix:
 | 
			
		||||
        type: string
 | 
			
		||||
      download-dist:
 | 
			
		||||
        type: boolean
 | 
			
		||||
        default: false
 | 
			
		||||
 | 
			
		||||
env:
 | 
			
		||||
  DOWNLOAD_DIST: ${{ inputs.download-dist }}
 | 
			
		||||
  GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
 | 
			
		||||
  GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  seed-build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    container: fedora:latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Checkout sources
 | 
			
		||||
      uses: actions/checkout@v3
 | 
			
		||||
    - name: Download distribution if required
 | 
			
		||||
      uses: ./.github/actions/download-dist
 | 
			
		||||
    - name: Setup Java
 | 
			
		||||
      uses: actions/setup-java@v3
 | 
			
		||||
      with:
 | 
			
		||||
        java-version: 11
 | 
			
		||||
        distribution: temurin
 | 
			
		||||
    - name: Setup Gradle
 | 
			
		||||
      uses: ./
 | 
			
		||||
      with:
 | 
			
		||||
        cache-read-only: false # For testing, allow writing cache entries on non-default branches
 | 
			
		||||
    - name: Build using Gradle wrapper
 | 
			
		||||
      working-directory: .github/workflow-samples/groovy-dsl
 | 
			
		||||
      run: ./gradlew test
 | 
			
		||||
 | 
			
		||||
  # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
 | 
			
		||||
  dependencies-cache:
 | 
			
		||||
    needs: seed-build
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    container: fedora:latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Checkout sources
 | 
			
		||||
      uses: actions/checkout@v3
 | 
			
		||||
    - name: Download distribution if required
 | 
			
		||||
      uses: ./.github/actions/download-dist
 | 
			
		||||
    - name: Setup Java
 | 
			
		||||
      uses: actions/setup-java@v3
 | 
			
		||||
      with:
 | 
			
		||||
        java-version: 11
 | 
			
		||||
        distribution: temurin
 | 
			
		||||
    - name: Setup Gradle
 | 
			
		||||
      uses: ./
 | 
			
		||||
      with:
 | 
			
		||||
        cache-read-only: true
 | 
			
		||||
    - name: Execute Gradle build with --offline
 | 
			
		||||
      working-directory: .github/workflow-samples/groovy-dsl
 | 
			
		||||
      run: ./gradlew test --offline
 | 
			
		||||
@@ -5,9 +5,6 @@ on:
 | 
			
		||||
    inputs:
 | 
			
		||||
      cache-key-prefix:
 | 
			
		||||
        type: string
 | 
			
		||||
      runner-os:
 | 
			
		||||
        type: string
 | 
			
		||||
        default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
 | 
			
		||||
      download-dist:
 | 
			
		||||
        type: boolean
 | 
			
		||||
        default: false
 | 
			
		||||
@@ -19,10 +16,7 @@ env:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  seed-build:
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: ${{fromJSON(inputs.runner-os)}}
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Set Gradle User Home
 | 
			
		||||
      run: |
 | 
			
		||||
@@ -43,10 +37,7 @@ jobs:
 | 
			
		||||
  # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
 | 
			
		||||
  dependencies-cache:
 | 
			
		||||
    needs: seed-build
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: ${{fromJSON(inputs.runner-os)}}
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Set Gradle User Home
 | 
			
		||||
      run: |
 | 
			
		||||
@@ -67,10 +58,7 @@ jobs:
 | 
			
		||||
  # Test that the gradle-user-home cache will cache and restore local build-cache
 | 
			
		||||
  build-cache:
 | 
			
		||||
    needs: seed-build
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        os: ${{fromJSON(inputs.runner-os)}}
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Set Gradle User Home
 | 
			
		||||
      run: |
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user