mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Enforce tests do not change files in source tree (#9625)
This commit is contained in:
		@@ -118,7 +118,7 @@ steps:
 | 
				
			|||||||
    pull: always
 | 
					    pull: always
 | 
				
			||||||
    image: golang:1.13
 | 
					    image: golang:1.13
 | 
				
			||||||
    commands:
 | 
					    commands:
 | 
				
			||||||
      - make unit-test-coverage
 | 
					      - make unit-test-coverage test-check
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      GOPROXY: off
 | 
					      GOPROXY: off
 | 
				
			||||||
      TAGS: bindata sqlite sqlite_unlock_notify
 | 
					      TAGS: bindata sqlite sqlite_unlock_notify
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Makefile
									
									
									
									
									
								
							@@ -226,6 +226,18 @@ fmt-check:
 | 
				
			|||||||
test:
 | 
					test:
 | 
				
			||||||
	GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
 | 
						GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PHONY: test-check
 | 
				
			||||||
 | 
					test-check:
 | 
				
			||||||
 | 
						@echo "Checking if tests have changed the source tree...";
 | 
				
			||||||
 | 
						@diff=$$(git status -s); \
 | 
				
			||||||
 | 
						if [ -n "$$diff" ]; then \
 | 
				
			||||||
 | 
							echo "make test has changed files in the source tree:"; \
 | 
				
			||||||
 | 
							echo "$${diff}"; \
 | 
				
			||||||
 | 
							echo "You should change the tests to create these files in a temporary directory."; \
 | 
				
			||||||
 | 
							echo "Do not simply add these files to .gitignore"; \
 | 
				
			||||||
 | 
							exit 1; \
 | 
				
			||||||
 | 
						fi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: test\#%
 | 
					.PHONY: test\#%
 | 
				
			||||||
test\#%:
 | 
					test\#%:
 | 
				
			||||||
	GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(PACKAGES)
 | 
						GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(PACKAGES)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user