2023-02-10 03:00:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								CGO_FLAGS := '-extldflags "-static" -linkmode external'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								TAGS      := 'sqlite sqlite_unlock_notify netgo'
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-30 19:50:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								dev *FLAGS:
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 14:31:10 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    #!/usr/bin/env bash
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set -euxo pipefail
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 16:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set -a # automatically export all variables
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    source .env-dev
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set +a
							 
						 
					
						
							
								
									
										
										
										
											2024-04-30 19:50:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    go run -tags '{{TAGS}}' . {{FLAGS}}
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 20:43:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								build:
							 
						 
					
						
							
								
									
										
										
										
											2023-02-10 03:00:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    CGO_ENABLED=1 go build -tags '{{TAGS}}' -ldflags '-s -w {{CGO_FLAGS}}' -v -o build/codeberg-pages-server ./
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 16:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-14 18:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								build-tag VERSION:
							 
						 
					
						
							
								
									
										
										
										
											2023-02-10 03:00:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    CGO_ENABLED=1 go build -tags '{{TAGS}}' -ldflags '-s -w -X "codeberg.org/codeberg/pages/server/version.Version={{VERSION}}" {{CGO_FLAGS}}' -v -o build/codeberg-pages-server ./
							 
						 
					
						
							
								
									
										
										
										
											2022-06-14 18:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 16:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								lint: tool-golangci tool-gofumpt
							 
						 
					
						
							
								
									
										
										
										
											2022-06-11 21:17:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    golangci-lint run --timeout 5m --build-tags integration
							 
						 
					
						
							
								
									
										
										
										
											2022-11-11 22:51:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    # TODO: run editorconfig-checker
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 16:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-11 21:02:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								fmt: tool-gofumpt
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    gofumpt -w --extra .
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-15 19:21:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								clean:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    go clean ./...
							 
						 
					
						
							
								
									
										
										
										
											2023-02-11 02:04:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    rm -rf build/ integration/certs.sqlite integration/acme-account.json
							 
						 
					
						
							
								
									
										
										
										
											2022-07-15 19:21:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 16:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								tool-golangci:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    @hash golangci-lint> /dev/null 2>&1; if [ $? -ne 0 ]; then \
							 
						 
					
						
							
								
									
										
										
										
											2022-05-30 21:55:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 16:13:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								tool-gofumpt:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    @hash gofumpt> /dev/null 2>&1; if [ $? -ne 0 ]; then \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    go install mvdan.cc/gofumpt@latest; \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    fi
							 
						 
					
						
							
								
									
										
										
										
											2022-06-13 12:43:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test:
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 16:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    go test -race -cover -tags '{{TAGS}}' codeberg.org/codeberg/pages/config/ codeberg.org/codeberg/pages/html/ codeberg.org/codeberg/pages/server/...
							 
						 
					
						
							
								
									
										
										
										
											2022-06-13 12:43:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-14 18:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test-run TEST:
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 16:08:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    go test -race -tags '{{TAGS}}' -run "^{{TEST}}$" codeberg.org/codeberg/pages/config/ codeberg.org/codeberg/pages/html/ codeberg.org/codeberg/pages/server/...
							 
						 
					
						
							
								
									
										
										
										
											2022-06-14 18:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-13 12:43:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								integration:
							 
						 
					
						
							
								
									
										
										
										
											2023-02-10 03:00:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    go test -race -tags 'integration {{TAGS}}' codeberg.org/codeberg/pages/integration/...
							 
						 
					
						
							
								
									
										
										
										
											2022-06-14 18:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								integration-run TEST:
							 
						 
					
						
							
								
									
										
										
										
											2023-02-10 03:00:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    go test -race -tags 'integration {{TAGS}}' -run "^{{TEST}}$" codeberg.org/codeberg/pages/integration/...
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 20:14:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								docker:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    docker run --rm -it --user $(id -u) -v $(pwd):/work --workdir /work -e HOME=/work codeberg.org/6543/docker-images/golang_just