mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Configure Gradle User Home for dependency-graph
Instead of requiring an action step to generate the graph, configure Gradle User Home so that subsequent Gradle invocations can generate a graph. Any generated graph files are uploaded as artifacts on job completion. - Construct job.correlator from workflow/job/matrix - Export job.correlator as an environment var - Upload artifacts at job completion in post-action step - Specify the location of dependency graph report - Only apply dependency graph init script when explicitly enabled
This commit is contained in:
		
							
								
								
									
										30
									
								
								test/jest/dependency-graph.test.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								test/jest/dependency-graph.test.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
import * as dependencyGraph from '../../src/dependency-graph'
 | 
			
		||||
 | 
			
		||||
describe('dependency-graph', () => {
 | 
			
		||||
    describe('constructs job correlator', () => {
 | 
			
		||||
        it('removes commas from workflow name', () => {
 | 
			
		||||
            const id = dependencyGraph.constructJobCorrelator('Workflow, with,commas', 'jobid', '{}')
 | 
			
		||||
            expect(id).toBe('workflowwithcommas-jobid')
 | 
			
		||||
        })
 | 
			
		||||
        it('removes non word characters', () => {
 | 
			
		||||
            const id = dependencyGraph.constructJobCorrelator('Workflow!_with()characters', 'job-*id', '{"foo": "bar!@#$%^&*("}')
 | 
			
		||||
            expect(id).toBe('workflow_withcharacters-job-id-bar')
 | 
			
		||||
        })
 | 
			
		||||
        it('without matrix', () => {
 | 
			
		||||
            const id = dependencyGraph.constructJobCorrelator('workflow', 'jobid', 'null')
 | 
			
		||||
            expect(id).toBe('workflow-jobid')
 | 
			
		||||
        })
 | 
			
		||||
        it('with dashes in values', () => {
 | 
			
		||||
            const id = dependencyGraph.constructJobCorrelator('workflow-name', 'job-id', '{"os": "ubuntu-latest"}')
 | 
			
		||||
            expect(id).toBe('workflow-name-job-id-ubuntu-latest')
 | 
			
		||||
        })
 | 
			
		||||
        it('with single matrix value', () => {
 | 
			
		||||
            const id = dependencyGraph.constructJobCorrelator('workflow', 'jobid', '{"os": "windows"}')
 | 
			
		||||
            expect(id).toBe('workflow-jobid-windows')
 | 
			
		||||
        })
 | 
			
		||||
        it('with composite matrix value', () => {
 | 
			
		||||
            const id = dependencyGraph.constructJobCorrelator('workflow', 'jobid', '{"os": "windows", "java-version": "21.1", "other": "Value, with COMMA"}')
 | 
			
		||||
            expect(id).toBe('workflow-jobid-windows-211-valuewithcomma')
 | 
			
		||||
        })
 | 
			
		||||
    })
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user